Epub for gm notes now prints monster spells, if specified.

This commit is contained in:
Mark Wolfman
2021-07-13 12:28:56 -05:00
parent f4f101e39c
commit d26f520666
4 changed files with 49 additions and 1 deletions
@@ -64,7 +64,17 @@
<dt>Challenge<dd>[[ monster.challenge_rating ]]&nbsp;</dd>
</dl>
[% if monster.spells | length > 0 %]
<dl class="monster-spell-list">
[% for level, spells in monster.spells | groupby('level') %]
<dt>[% if level == 0 %]Cantrips[% else %]Level [[ level ]][% endif %]</dt>
<dd>[[ spells | map(attribute='name') | join(', ') ]]</dd>
[% endfor %]
</dl>
[% endif %]
[[ monster.__doc__ | rst_to_html(top_heading_level=2) ]]
[% endfor %]
+3
View File
@@ -403,6 +403,9 @@ class Priest(Monster):
climb_speed = 0
hp_max = 27
hit_dice = "5d8"
spells = ["light", "sacred_flame", "thaumaturgy", "cure wounds",
"guiding bolt", "sanctuary", "lesser_restoration",
"spiritual weapon", "dispel magic", "spirit guardians"]
class Pseudodragon(Monster):
+1 -1
View File
@@ -15,4 +15,4 @@ session_title = "Objects in Space - Session 1"
parent_sheets = ["gm-campaign-notes.py"]
monsters = ["aboleth", "wolf", "giant eagle", "Vashta Nerada"]
monsters = ["aboleth", "wolf", "giant eagle", "Vashta Nerada", "priest"]
+35
View File
@@ -135,6 +135,41 @@ class VashtaNerada(monsters.Monster):
damage_resistances = "Lightning"
damage_vulnerabilities = "Wood-based"
challenge_rating = 93
spells = ["wish"]
class HtmlCreatorTestCase(unittest.TestCase):
def test_create_monsters_html(self):
monsters_ = [monsters.Priest()]
html = make_sheets.create_monsters_content(monsters=monsters_, suffix="html")
self.assertIn(r"Priest", html)
# Check extended properties
monsters_ = [VashtaNerada()]
html = make_sheets.create_monsters_content(monsters=monsters_, suffix="html")
self.assertIn(r"Vashta Nerada", html)
self.assertIn(r"35", html)
self.assertIn(r"45 fly", html)
self.assertIn(r"55 swim", html)
self.assertIn(r"65 burrow", html)
self.assertIn(r"petrified", html)
self.assertIn(r"Saving Throws", html)
self.assertIn(r"Damage Immunities", html)
self.assertIn(r"Damage Resistances", html)
self.assertIn(r"Damage Vulnerabilities", html)
self.assertIn(r"Senses", html)
self.assertIn(r"Challenge", html)
self.assertIn(r"Languages", html)
self.assertIn(r"Skills", html)
self.assertIn(r"petrified", html)
self.assertIn(r"Dex +8", html)
# Check spells and spell descriptions
self.assertIn(r"<dt>Level 9</dt>", html)
self.assertIn(r"Wish", html)
# Check fancy extended properties
html = make_sheets.create_monsters_content(monsters=monsters_,
suffix="html",
use_dnd_decorations=True)