Ejemplo n.º 1
0
 def test_fight_spell_enemy_hero_none(self):
     hero = Hero(name="Bron",
                 title="Dragonslayer",
                 health=100,
                 mana=100,
                 mana_regeneration_rate=2)
     hero = Hero(name="Bron",
                 title="Dragonslayer",
                 health=100,
                 mana=100,
                 mana_regeneration_rate=2)
     w = Weapon(name="The Axe of Destiny", damage=20)
     hero.equip(w)
     s = Spell(name="Fireball", damage=30, mana_cost=50, cast_range=2)
     # hero.learn(s)
     enemy = Enemy(100, 100, 20)
     enemy = Enemy(200, 100, 20)
     enemy = Enemy(130, 100, 20)
     enemy.learn(s)
     hero.location = [0, 0]
     enemy.location = [0, 2]
     f = Fight(hero, enemy)
     print("\ntest hero no spell enime has \n")
     f.mortal_kombat()
     self.assertEqual(f.return_hero().health, 0)
Ejemplo n.º 2
0
    def test_equip_hero_with_a_weapon_returns_heros_weapon(self):
        hero = Hero(name="Bron",
                    title="Dragonslayer",
                    health=100,
                    mana=100,
                    mana_regeneration_rate=2)
        w = Weapon(name="The Axe of Destiny", damage=20)

        hero.equip(w)

        heros_weapon = hero.weapon

        self.assertEqual(heros_weapon, w)
Ejemplo n.º 3
0
 def test_fight_weapon(self):
     hero = Hero(name="Bron",
                 title="Dragonslayer",
                 health=100,
                 mana=100,
                 mana_regeneration_rate=2)
     w = Weapon(name="The Axe of Destiny", damage=20)
     hero.equip(w)
     enemy = Enemy(100, 100, 20)
     hero.location = [0, 0]
     enemy.location = [2, 1]
     f = Fight(hero, enemy)
     print("\ntest only weapon\n")
     f.mortal_kombat()
     self.assertEqual(f.return_hero().health, 20)
Ejemplo n.º 4
0
    def test_equip_with_more_weapons_returns_last_weapon(self):
        hero = Hero(name="Bron",
                    title="Dragonslayer",
                    health=100,
                    mana=100,
                    mana_regeneration_rate=2)
        w1 = Weapon(name="The Axe of Destiny", damage=20)
        w2 = Weapon(name="The sword of Destiny", damage=30)

        hero.equip(w1)
        hero.equip(w2)

        heros_weapon = hero.weapon

        self.assertEqual(heros_weapon, w2)
Ejemplo n.º 5
0
 def test_fight_direct_spell_weak(self):
     hero = Hero(name="Bron",
                 title="Dragonslayer",
                 health=100,
                 mana=100,
                 mana_regeneration_rate=2)
     w = Weapon(name="The Axe of Destiny", damage=20)
     hero.equip(w)
     enemy = Enemy(100, 100, 20)
     hero.location = [0, 0]
     enemy.location = [0, 0]
     s = Spell(name="Fireball", damage=10, mana_cost=50, cast_range=2)
     hero.learn(s)
     f = Fight(hero, enemy)
     print("\ntest hero fight one over the other\n")
     f.mortal_kombat()
     self.assertEqual(f.return_hero().health, 20)
Ejemplo n.º 6
0
    time.sleep(5)
    pygame.quit()
    quit()


map = Dungeon("level1.txt")

h = Hero(name="Bron",
         title="Dragonslayer",
         health=100,
         mana=100,
         mana_regeneration_rate=2)
w = Weapon(name="The Axe of Destiny", damage=20)
# s = Spell(name="Fireball", damage=30, mana_cost=50, cast_range=200)

h.equip(w)
# h.learn(s)

pygame.init()

white_hero = (255, 255, 255)
black_enemy = (0, 0, 0)
red_treasure = (255, 92, 51)
gray_wall = (128, 64, 0)

dis = pygame.display.set_mode((1000, 500))

pygame.display.set_caption('Dungeons And Pythons')

while len(map.spawn_locations) > 0:
    game_over = False