Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gm_notes: allow custom monsters #164

Merged
merged 5 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dungeonsheets/make_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ def make_gm_sheet(
if isinstance(monster, monsters.Monster):
# It's already a monster, so just add it
new_monster = monster
elif isinstance(monster, type) and issubclass(monster, monsters.Monster):
# Needs to be instantiated
new_monster = monster()
else:
try:
MyMonster = find_content(monster, valid_classes=[monsters.Monster])
Expand Down
37 changes: 35 additions & 2 deletions examples/gm-session-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

"""

from dungeonsheets import mechanics
from dungeonsheets import mechanics, monsters
from dungeonsheets.stats import Ability


# This line (or one like it) is required in order for dungeonsheets to
Expand All @@ -28,9 +29,41 @@
# *parent_sheets* attribute.
parent_sheets = ["gm-campaign-notes.py"]


class Pting(monsters.Monster):
"""
A tiny beast with an insatiable hunger for metal.
"""
name = 'Pting'
description = 'Small beast, unaligned'
challenge_rating = 0
armor_class = 14
skills = ''
senses = ''
languages = ''
strength = Ability(12)
dexterity = Ability(16)
constitution = Ability(15)
intelligence = Ability(4)
wisdom = Ability(10)
charisma = Ability(9)
speed = 30
swim_speed = 0
fly_speed = 40
climb_speed = 0
burrow_speed = 0
hp_max = 30
hit_dice = ''
condition_immunities = 'exhaustion, frightened, paralyzed, poisoned'
damage_immunities = 'necrotic, poison'
damage_resistances = ''
damage_vulnerabilities = ''
spells = []


# Defining a *monsters* attribute will include their stat blocks in
# the output
monsters = ["aboleth", "wolf", "giant eagle", "Vashta Nerada", "priest", "priest"]
monsters = ["aboleth", "wolf", "giant eagle", "Vashta Nerada", Pting]

# Arbitrary sections can be added to the GM notes. The
# ``extra_sections`` attribute should be a sequence of subclasses of
Expand Down
Loading