Monsters now have a spells attribute that will eventually hold a list of spells.

This commit is contained in:
Mark Wolfman
2021-07-13 00:13:04 -05:00
parent d110ef6cda
commit f4f101e39c
14 changed files with 191 additions and 137 deletions
+12 -1
View File
@@ -1,6 +1,6 @@
from unittest import TestCase
from dungeonsheets import monsters
from dungeonsheets import monsters, spells
class AutoGeneratedMonsters(TestCase):
@@ -351,3 +351,14 @@ class AutoGeneratedMonsters(TestCase):
self.assertEqual(wolf.strength.value, 12)
self.assertEqual(wolf.strength.modifier, 1)
self.assertEqual(wolf.strength.saving_throw, 1)
class MonsterSpellcastingTests(TestCase):
def test_spells(self):
# Check that monster spells can be set, and then resolved to real spell objects
class MyMonster(monsters.Monster):
spells = ["cure wounds", spells.Bane]
self.assertIsInstance(MyMonster.spells[0], type,
msg="Monster spell is not a class")
self.assertTrue(issubclass(MyMonster.spells[0], spells.Spell))