def test_when_enemy_fists_are_weaker_than_spell_then_return_spell(self): enemy = Enemy(150, 50, 50) spell = Spell(name="Fireball", damage=150, mana_cost=50, cast_range=2) spell.equip_to(enemy) self.assertEqual(enemy.attack(), spell) self.assertEqual(getattr(enemy, 'mana'), 0)
def test_when_enemy_fists_are_stronger_than_weapons_then_return_fists(self): enemy = Enemy(150, 50, 50) weapon = Weapon('Axe', 10) weapon.equip_to(enemy) self.assertEqual(enemy.attack(), Weapon('Fists', 50))
def test_when_enemy_fists_are_weaker_than_weapon_then_return_weapon(self): enemy = Enemy(150, 50, 50) weapon = Weapon('Axe', 100) weapon.equip_to(enemy) self.assertEqual(enemy.attack(), weapon)
def test_when_enemy_has_no_weapons_or_spells_then_return_fists(self): test_obj = Enemy(150, 50, 20) self.assertEqual(test_obj.attack(), Weapon('Fists', 20))