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.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(