add infusions to character template

This commit is contained in:
Robert Kubosz
2020-05-12 18:58:39 +02:00
parent bcc42c4edb
commit 666fca4217
4 changed files with 125 additions and 2 deletions
+8 -1
View File
@@ -533,7 +533,7 @@ class Character():
f'Please add it to ``infusions.py``')
warnings.warn(msg)
_infusions.sort(key=lambda infusion: infusion.name)
self.infusions = tuple(I() for I in _infusions)
self.infusions = tuple(i() for i in _infusions)
else:
if not hasattr(self, attr):
warnings.warn(f"Setting unknown character attribute {attr}",
@@ -728,6 +728,13 @@ class Character():
if hasattr(self, 'Druid'):
self.Druid.wild_shapes = new_shapes
@property
def infusions_text(self):
if hasattr(self, 'Artificer'):
return tuple([i.name for i in self.infusions])
else:
return ()
@classmethod
def load(cls, character_file):
# Create a character from the character definition
+1 -1
View File
@@ -86,7 +86,7 @@ spells_prepared = {{ char.spells_prepared }}
wild_shapes = {{ char.all_wild_shapes }} # Ex: ('ape', 'wolf', 'ankylosaurus')
# Infusions for Artificer
infusions = {{ char.infusions }} # Ex: ('repeating shot', 'replicate magic item')
infusions = {{ char.infusions_text }} # Ex: ('repeating shot', 'replicate magic item')
# Backstory
# Describe your backstory here
+3
View File
@@ -92,6 +92,9 @@ spells = spells_prepared + __spells_unprepared
# Wild shapes for Druid
wild_shapes = () # Ex: ('ape', 'wolf', 'ankylosaurus')
# Infusions for Artificer
infusions = {{ char.infusions_text }} # Ex: ('repeating shot', 'replicate magic item')
# Backstory
# Describe your backstory here
personality_traits = """{{ char.personality_traits }}"""