mirror of
https://github.com/Threnklyn/dungeon-sheets.git
synced 2026-06-07 13:15:53 +02:00
Fixing fighting style error
This commit is contained in:
@@ -337,10 +337,30 @@ class Character():
|
|||||||
@property
|
@property
|
||||||
def features(self):
|
def features(self):
|
||||||
fts = set(self.custom_features)
|
fts = set(self.custom_features)
|
||||||
|
fighting_style_defined = False
|
||||||
|
set_of_fighting_styles = {
|
||||||
|
"Fighting Style (Archery)",
|
||||||
|
"Fighting Style (Defense)",
|
||||||
|
"Fighting Style (Dueling)",
|
||||||
|
"Fighting Style (Great Weapon Fighting)",
|
||||||
|
"Fighting Style (Protection)",
|
||||||
|
"Fighting Style (Two-Weapon Fighting)"
|
||||||
|
}
|
||||||
|
for temp_feature in fts:
|
||||||
|
fighting_style_defined = (temp_feature.name in set_of_fighting_styles)
|
||||||
|
if fighting_style_defined:
|
||||||
|
break
|
||||||
|
|
||||||
if not self.has_class:
|
if not self.has_class:
|
||||||
return fts
|
return fts
|
||||||
|
print('\n\n')
|
||||||
for c in self.class_list:
|
for c in self.class_list:
|
||||||
fts |= set(c.features)
|
fts |= set(c.features)
|
||||||
|
for feature in fts:
|
||||||
|
if fighting_style_defined and feature.name == 'Fighting Style (Select One)':
|
||||||
|
temp_feature = feature
|
||||||
|
fts.remove(temp_feature)
|
||||||
|
break
|
||||||
if self.race is not None:
|
if self.race is not None:
|
||||||
fts |= set(getattr(self.race, 'features', ()))
|
fts |= set(getattr(self.race, 'features', ()))
|
||||||
# some races have level-based features (Ex: Aasimar)
|
# some races have level-based features (Ex: Aasimar)
|
||||||
@@ -349,6 +369,7 @@ class Character():
|
|||||||
fts |= set(self.race.features_by_level[lvl])
|
fts |= set(self.race.features_by_level[lvl])
|
||||||
if self.background is not None:
|
if self.background is not None:
|
||||||
fts |= set(getattr(self.background, 'features', ()))
|
fts |= set(getattr(self.background, 'features', ()))
|
||||||
|
|
||||||
return sorted(tuple(fts), key=(lambda x: x.name))
|
return sorted(tuple(fts), key=(lambda x: x.name))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user