diff --git a/dungeonsheets/character.py b/dungeonsheets/character.py index 10b0d12..a0196c8 100644 --- a/dungeonsheets/character.py +++ b/dungeonsheets/character.py @@ -104,6 +104,10 @@ class Character(): self.all_wild_shapes = c.all_wild_shapes self.wild_shapes = c.wild_shapes self.can_assume_shape = c.can_assume_shape + # instantiate any spells not listed properly + for S in self.spells_prepared: + if S not in [type(spl) for spl in self.spells]: + self.spells += (S(),) def __str__(self): return self.name @@ -183,7 +187,7 @@ class Character(): self.race = MyRace() elif attr == 'background': MyBackground = findattr(background, val) - self.race = MyBackground() + self.background = MyBackground() elif attr == 'armor': self.wear_armor(val) elif attr == 'shield': @@ -208,6 +212,7 @@ class Character(): # Instantiate them all for the spells list self.spells = tuple(S() for S in _spells) else: + # this is a list of spell classes self.spells_prepared = tuple(_spells) else: if not hasattr(self, attr): @@ -394,7 +399,7 @@ class Character(): 'classes_levels not properly formatted. Each entry should ' 'be formatted \"class level\", but got {:s}'.format(cl)) try: - this_class = getattr(classes, c) + this_class = getattr(classes, c.capitalize()) this_level = int(lvl) except AttributeError: raise AttributeError( diff --git a/dungeonsheets/classes.py b/dungeonsheets/classes.py index bd57724..f56d863 100644 --- a/dungeonsheets/classes.py +++ b/dungeonsheets/classes.py @@ -287,6 +287,10 @@ class Fighter(CharClass): _proficiencies_text = ('All armor', 'shields', 'simple weapons', 'martial weapons') weapon_proficiencies = weapons.simple_weapons + weapons.martial_weapons + multiclass_weapon_proficiencies = weapon_proficiencies + _multiclass_proficiencies_text = ('light armor', 'medium armor', + 'shields', 'simple weapons', + 'martial weapons') class_skill_choices = ('Acrobatics', 'Animal Handling', 'Athletics', 'History', 'Insight', 'Intimidation', 'Perception', 'Survival') diff --git a/dungeonsheets/spellbook_template.tex b/dungeonsheets/spellbook_template.tex index 83f9126..c0e6e98 100644 --- a/dungeonsheets/spellbook_template.tex +++ b/dungeonsheets/spellbook_template.tex @@ -40,7 +40,7 @@ \noindent \textbf{Casting Time:} [[ spl.casting_time ]] \\ \textbf{Range:} [[ spl.casting_range ]] \\ - \textbf{Components:} [[ spl.component_string() ]] \\ + \textbf{Components:} [[ spl.component_string ]] \\ \textbf{Duration:} [[ spl.duration ]] [[ spl.__doc__|rst_to_latex ]] diff --git a/dungeonsheets/spells.py b/dungeonsheets/spells.py index d17c14d..7a70c2d 100644 --- a/dungeonsheets/spells.py +++ b/dungeonsheets/spells.py @@ -43,7 +43,8 @@ class Spell(): def __repr__(self): return f'<{self.name}>' - + + @property def component_string(self): s = f'{", ".join(self.components)}' if "M" in self.components: diff --git a/examples/druid.pdf b/examples/druid.pdf index 8a1a08d..c166c4b 100644 Binary files a/examples/druid.pdf and b/examples/druid.pdf differ diff --git a/examples/druid.py b/examples/druid.py index 217cd2d..d3bfe73 100644 --- a/examples/druid.py +++ b/examples/druid.py @@ -50,8 +50,10 @@ wild_shapes = ["wolf", "crocodile", "giant eagle", 'ape', 'ankylosaurus'] # List of known spells # Which spells have been prepared (including cantrips) -spells_prepared = ('shillelagh', 'poison spray', 'druidcraft','speak with animals', 'entangle', 'cure wounds', 'create or destroy water') - +spells_prepared = ('shillelagh', 'poison spray', 'druidcraft', + 'speak with animals', 'entangle', 'cure wounds', + 'create or destroy water') +# spells = spells_prepared # Backstory # TODO: Describe your backstory here personality_traits = """I am a leaf on the wind, diff --git a/examples/makefile b/examples/makefile index 93247b7..fa6a243 100644 --- a/examples/makefile +++ b/examples/makefile @@ -1,10 +1,12 @@ -all: wizard druid rogue warlock +all: multiclass wizard druid rogue warlock clobber: - rm -f wizard.pdf rogue.pdf warlock.pdf druid.pdf + rm -f multiclass.pdf wizard.pdf rogue.pdf warlock.pdf druid.pdf redo: clobber all +multiclass: multiclass.pdf + wizard: wizard.pdf rogue: rogue.pdf @@ -13,6 +15,9 @@ warlock: warlock.pdf druid: druid.pdf +multiclass.pdf: multiclass.py + makesheets multiclass.py + wizard.pdf: wizard.py makesheets wizard.py diff --git a/examples/multiclass.pdf b/examples/multiclass.pdf new file mode 100644 index 0000000..cf759e4 Binary files /dev/null and b/examples/multiclass.pdf differ diff --git a/examples/multiclass.py b/examples/multiclass.py index 7287fc3..b1ff67a 100644 --- a/examples/multiclass.py +++ b/examples/multiclass.py @@ -4,14 +4,14 @@ dungeonsheets_version = "0.4.2" name = 'Inara Serradon' # classes_levels: specify class and level or, if multiclass, specify as list # example: -classes_levels = ['figher 2'] # 2nd level fighter -subclasses = [None] +# classes_levels = ['wizard 3'] # 3rd level wizard +# subclasses = [None] # also accepted, as long as only one class # classes_levels = 'fighter 2' # subclasses = None # multiclass example -# classes_levels = ['wizard 3', 'fighter 1', 'rogue 1'] # 5th level total -subclasses = ['necromancer', None, None] +classes_levels = ['wizard 3', 'fighter 1', 'rogue 1'] # 5th level total +subclasses = ['Necromancer', None, None] player_name = 'Mark' background = "Acolyte" race = "High-Elf" @@ -44,7 +44,7 @@ sp = 283 ep = 28 gp = 125 pp = 0 -weapons = ('shortsword', 'longsword') +weapons = ('greatsword', 'longsword') equipment = ( """Gallon of ale, red cloak, shortsword, longsword, jar of salt, vodka (500mL), potion of vitality, wand of magic missiles (7/7), diff --git a/examples/rogue.pdf b/examples/rogue.pdf index a9fdcbc..0ad3839 100644 Binary files a/examples/rogue.pdf and b/examples/rogue.pdf differ diff --git a/examples/warlock.pdf b/examples/warlock.pdf index dd926e8..a5dda68 100644 Binary files a/examples/warlock.pdf and b/examples/warlock.pdf differ diff --git a/examples/wizard.pdf b/examples/wizard.pdf index c91ce78..704c7db 100644 Binary files a/examples/wizard.pdf and b/examples/wizard.pdf differ