Exemple #1
0
def reset_hero_attributes(hero: Hero):
    from items.weapon import Weapon
    from items.spell import Spell
    hero.health = hero.MAX_HEALTH
    hero.mana = hero.MAX_MANA
    hero.weapon = Weapon.create_weapon(random.choice(WEAPON_NAMES))
    hero.spell = Spell.create_spell(random.choice(SPELL_NAMES))
    def test_if_regular_fight_works_when_enemy_is_killed_during_the_fight(self):
        health = 1
        hero = Hero(health=health)
        hero.weapon = Weapon(damage=1)
        enemy = Enemy(health=health)

        exp = 0

        regular_fight(hero, enemy)
        self.assertEqual(enemy.health, exp)
    def test_if_attack_returns_weapon_damagae_if_it_is_stronger(self):
        h = Hero()
        h.spell = Spell('Fireball', 10, 5, 1)
        h.weapon = Weapon('Bat', 20)

        self.assertEqual(h.attack(), 20)