def test_move_hero_right_should_return_true_if_can_move_or_false_if_not(
            self):
        map_ = Dungeon('level1.txt')
        h = Hero('hero', 'the hero', 100, 100, 2)
        map_.spawn(h)
        h.take_mana(-10)

        result = map_.move_hero('right')

        self.assertEqual(result, True)
        self.assertEqual(h.get_mana(), 92)
Пример #2
0
    def test_take_mana_when_hero_is_not_alive_should_return_false(self):
        h = Hero(name="Bron",
                 title="Dragonslayer",
                 health=100,
                 mana=100,
                 mana_regeneration_rate=2)

        h.health = 0
        result = h.take_mana(20)

        self.assertEqual(result, False)
Пример #3
0
    def test_take_mana_when_hero_is_alive_and_mana_is_more_than_max_should_return_true_and_make_mana_max(
            self):
        h = Hero(name="Bron",
                 title="Dragonslayer",
                 health=100,
                 mana=100,
                 mana_regeneration_rate=2)

        h.mana = 0
        result = h.take_mana(120)

        self.assertEqual(result, True)
        self.assertEqual(h.mana, 100)