first multiclass character works

This commit is contained in:
Ben Cook
2018-12-19 10:12:01 -05:00
parent 8f0ee321a4
commit e517223ad2
12 changed files with 30 additions and 13 deletions
+7 -2
View File
@@ -104,6 +104,10 @@ class Character():
self.all_wild_shapes = c.all_wild_shapes self.all_wild_shapes = c.all_wild_shapes
self.wild_shapes = c.wild_shapes self.wild_shapes = c.wild_shapes
self.can_assume_shape = c.can_assume_shape 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): def __str__(self):
return self.name return self.name
@@ -183,7 +187,7 @@ class Character():
self.race = MyRace() self.race = MyRace()
elif attr == 'background': elif attr == 'background':
MyBackground = findattr(background, val) MyBackground = findattr(background, val)
self.race = MyBackground() self.background = MyBackground()
elif attr == 'armor': elif attr == 'armor':
self.wear_armor(val) self.wear_armor(val)
elif attr == 'shield': elif attr == 'shield':
@@ -208,6 +212,7 @@ class Character():
# Instantiate them all for the spells list # Instantiate them all for the spells list
self.spells = tuple(S() for S in _spells) self.spells = tuple(S() for S in _spells)
else: else:
# this is a list of spell classes
self.spells_prepared = tuple(_spells) self.spells_prepared = tuple(_spells)
else: else:
if not hasattr(self, attr): if not hasattr(self, attr):
@@ -394,7 +399,7 @@ class Character():
'classes_levels not properly formatted. Each entry should ' 'classes_levels not properly formatted. Each entry should '
'be formatted \"class level\", but got {:s}'.format(cl)) 'be formatted \"class level\", but got {:s}'.format(cl))
try: try:
this_class = getattr(classes, c) this_class = getattr(classes, c.capitalize())
this_level = int(lvl) this_level = int(lvl)
except AttributeError: except AttributeError:
raise AttributeError( raise AttributeError(
+4
View File
@@ -287,6 +287,10 @@ class Fighter(CharClass):
_proficiencies_text = ('All armor', 'shields', 'simple weapons', _proficiencies_text = ('All armor', 'shields', 'simple weapons',
'martial weapons') 'martial weapons')
weapon_proficiencies = weapons.simple_weapons + 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', class_skill_choices = ('Acrobatics', 'Animal Handling',
'Athletics', 'History', 'Insight', 'Intimidation', 'Athletics', 'History', 'Insight', 'Intimidation',
'Perception', 'Survival') 'Perception', 'Survival')
+1 -1
View File
@@ -40,7 +40,7 @@
\noindent \noindent
\textbf{Casting Time:} [[ spl.casting_time ]] \\ \textbf{Casting Time:} [[ spl.casting_time ]] \\
\textbf{Range:} [[ spl.casting_range ]] \\ \textbf{Range:} [[ spl.casting_range ]] \\
\textbf{Components:} [[ spl.component_string() ]] \\ \textbf{Components:} [[ spl.component_string ]] \\
\textbf{Duration:} [[ spl.duration ]] \textbf{Duration:} [[ spl.duration ]]
[[ spl.__doc__|rst_to_latex ]] [[ spl.__doc__|rst_to_latex ]]
+1
View File
@@ -44,6 +44,7 @@ class Spell():
def __repr__(self): def __repr__(self):
return f'<{self.name}>' return f'<{self.name}>'
@property
def component_string(self): def component_string(self):
s = f'{", ".join(self.components)}' s = f'{", ".join(self.components)}'
if "M" in self.components: if "M" in self.components:
Binary file not shown.
+4 -2
View File
@@ -50,8 +50,10 @@ wild_shapes = ["wolf", "crocodile", "giant eagle", 'ape', 'ankylosaurus']
# List of known spells # List of known spells
# Which spells have been prepared (including cantrips) # 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 # Backstory
# TODO: Describe your backstory here # TODO: Describe your backstory here
personality_traits = """I am a leaf on the wind, personality_traits = """I am a leaf on the wind,
+7 -2
View File
@@ -1,10 +1,12 @@
all: wizard druid rogue warlock all: multiclass wizard druid rogue warlock
clobber: 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 redo: clobber all
multiclass: multiclass.pdf
wizard: wizard.pdf wizard: wizard.pdf
rogue: rogue.pdf rogue: rogue.pdf
@@ -13,6 +15,9 @@ warlock: warlock.pdf
druid: druid.pdf druid: druid.pdf
multiclass.pdf: multiclass.py
makesheets multiclass.py
wizard.pdf: wizard.py wizard.pdf: wizard.py
makesheets wizard.py makesheets wizard.py
Binary file not shown.
+5 -5
View File
@@ -4,14 +4,14 @@ dungeonsheets_version = "0.4.2"
name = 'Inara Serradon' name = 'Inara Serradon'
# classes_levels: specify class and level or, if multiclass, specify as list # classes_levels: specify class and level or, if multiclass, specify as list
# example: # example:
classes_levels = ['figher 2'] # 2nd level fighter # classes_levels = ['wizard 3'] # 3rd level wizard
subclasses = [None] # subclasses = [None]
# also accepted, as long as only one class # also accepted, as long as only one class
# classes_levels = 'fighter 2' # classes_levels = 'fighter 2'
# subclasses = None # subclasses = None
# multiclass example # multiclass example
# classes_levels = ['wizard 3', 'fighter 1', 'rogue 1'] # 5th level total classes_levels = ['wizard 3', 'fighter 1', 'rogue 1'] # 5th level total
subclasses = ['necromancer', None, None] subclasses = ['Necromancer', None, None]
player_name = 'Mark' player_name = 'Mark'
background = "Acolyte" background = "Acolyte"
race = "High-Elf" race = "High-Elf"
@@ -44,7 +44,7 @@ sp = 283
ep = 28 ep = 28
gp = 125 gp = 125
pp = 0 pp = 0
weapons = ('shortsword', 'longsword') weapons = ('greatsword', 'longsword')
equipment = ( equipment = (
"""Gallon of ale, red cloak, shortsword, longsword, jar of salt, vodka """Gallon of ale, red cloak, shortsword, longsword, jar of salt, vodka
(500mL), potion of vitality, wand of magic missiles (7/7), (500mL), potion of vitality, wand of magic missiles (7/7),
Binary file not shown.
Binary file not shown.
Binary file not shown.