def test_hero_attack_by_spell_returns_false_if_no_fight(self): hero = Hero(name="Bron", title="Dragonslayer", health=100, mana=100, mana_regeneration_rate=2) map = Dungeon('level1.txt') map.spawn(hero) spell = Spell('fireball', 20, 20, 2) hero.spell = spell result = map.hero_attack(by='spell') self.assertEqual(result, False)
def test_hero_attack_by_spell_returns_true_if_fight_starts(self): hero = Hero(name="Bron", title="Dragonslayer", health=100, mana=100, mana_regeneration_rate=2) map_ = Dungeon('level1.txt') map_.spawn(hero) weapon = Weapon('Axe', damage=20) hero.equip(weapon) spell = Spell('fireball', 20, 20, 2) hero.spell = spell map_.move_hero('right') map_.move_hero('down') map_.move_hero('down') map_.move_hero('down') result = map_.hero_attack(by='spell') self.assertEqual(result, True)