Пример #1
0
    def test_start_fight_when_hero_strike_from_distance_enemy_return_dead_hero(
            self):
        hero = Hero("Pesho", "Padawan", health=100)
        enemy = Enemy(health=200, damage=50)
        weapon = Weapon("shodow", 40)
        spell = Spell("Abraka", 40)
        hero.learn(spell)
        create_fight = Fight(hero, enemy)

        result = create_fight.start_fight(1)

        self.assertEqual(result, hero)
Пример #2
0
    def test_start_fight_when_both_are_in_same_pas_return_loser_our_hero(self):
        hero = Hero("Pesho", "Padawan")
        enemy = Enemy(health=200, damage=10)
        weapon = Weapon("shodow", 10)
        hero.equip(weapon)
        spell = Spell("Abraka", 10)
        hero.learn(spell)
        create_fight = Fight(hero, enemy, "weapon")

        result = create_fight.start_fight(0)

        self.assertEqual(result, hero)
Пример #3
0
    def test_choose_fighting_tools_when_hero_has_spec_ability_weapon_and_spell_return_spell(
            self):
        hero = Hero("Pesho", "Padawan")
        enemy = Enemy()
        weapon = Weapon("shodow", 100)
        spell = Spell("bla", 150)
        hero.equip(weapon)
        hero.learn(spell)
        create_fight = Fight(hero, enemy)

        result = create_fight.choose_fighting_tools(hero, False)

        self.assertEqual(result, [150, spell])
Пример #4
0
    def test_start_fight_when_hero_strike_after_mana_is_gone_switch_to_weapon_return_dead_enemy(
            self):
        hero = Hero("Pesho", "Padawan", health=100)
        enemy = Enemy(health=200, damage=10)
        weapon = Weapon("shodow", 40)
        hero.equip(weapon)
        spell = Spell("Abraka", 40)
        hero.learn(spell)
        create_fight = Fight(hero, enemy)

        result = create_fight.start_fight(1)

        self.assertEqual(result, enemy)
Пример #5
0
    def test_start_fight_when_hero_strike_after_mana_is_he_take_items_mana_return_dead_enemy(
            self):
        hero = Hero("Pesho", "Padawan", health=100)
        enemy = Enemy(health=200, damage=10)
        weapon = Weapon("shodow", 40)
        hero.equip(weapon)
        treasure = Treasure(value_type="mana", value=50)
        spell = Spell("Abraka", 40)
        hero.learn(spell)
        hero.add_item(treasure)
        create_fight = Fight(hero, enemy)

        result = create_fight.start_fight(1)

        self.assertEqual(result, enemy)
Пример #6
0
    def test_start_fight_when_hero_strike_from_distance_enemy_get_healing_return_dead_enemy(
            self):
        hero = Hero("Pesho", "Padawan", health=100, mana=100)
        enemy = Enemy(health=200, damage=10)
        weapon = Weapon("shodow", 40)
        treasure1 = Treasure(value_type="mana", value=100)
        treasure2 = Treasure(value_type="health", value=100)
        spell = Spell("Abraka", 40)
        hero.learn(spell)
        hero.add_item(treasure1)
        hero.add_item(treasure2)
        create_fight = Fight(hero, enemy)

        result = create_fight.start_fight(1)

        self.assertEqual(result, enemy)
Пример #7
0
    def test_round_fight_when_hero_hits_and_with_spell_enemy_is_not_gone_return_enemy_move_to_hero(
            self):
        hero = Hero("Pesho", "Padawan")
        enemy = Enemy(health=200)
        weapon = Weapon("shodow", 100)
        hero.equip(weapon)
        spell = Spell("Abraka", 120)
        hero.learn(spell)
        create_fight = Fight(hero, enemy)

        hero_result = create_fight.choose_fighting_tools(hero, False)
        enemy_result = create_fight.choose_fighting_tools(enemy, True)

        result = create_fight.round_fight(hero_result, enemy_result, True)

        self.assertEqual(hero.get_health(), 100)
        self.assertEqual(enemy.get_health(), 80)