Exemplo n.º 1
0
 def test_take_damage(self):
     rand_int = random.randint(1, 100)
     magic = [{"name": "Fire", "cost": 10, "dmg": 60}]
     person = game.Person("bob", 200, rand_int, rand_int, rand_int, magic,
                          [])
     new_hp = person.take_damage(rand_int)
     self.assertEqual(200 - rand_int, new_hp)
Exemplo n.º 2
0
    def test_set_person(self):
        hp = random.randint(1, 100)
        mp = random.randint(1, 100)
        atk = random.randint(1, 100)
        df = random.randint(1, 100)
        magic = [{
            "name": "Fire",
            "cost": 10,
            "dmg": 60
        }, {
            "name": "Thunder",
            "cost": 10,
            "dmg": 80
        }, {
            "name": "Blizzard",
            "cost": 10,
            "dmg": 60
        }]

        person = game.Person("bob", hp, mp, atk, df, magic, [])
        self.assertTrue(person.hp, hp)
        self.assertTrue(person.mp, mp)
        self.assertTrue(person.atkl, atk - 10)
        self.assertTrue(person.df, df)
        self.assertTrue(person.magic, magic)
        self.assertGreater(person.mp, mp - 2)
        self.assertEqual("bob", person.name)
Exemplo n.º 3
0
 def test_reduce_mp(self):
     rand_int = random.randint(40, 100)
     spell_cost = random.randint(10, 15)
     magic = [{"name": "Fire", "cost": 10, "dmg": 60}]
     person = game.Person("bob", 200, rand_int, rand_int, rand_int, magic,
                          [])
     person.reduce_mp(spell_cost)
     self.assertEqual(person.get_mp(), rand_int - spell_cost)
Exemplo n.º 4
0
    def test_generate_damage(self):
        rand_int = random.randint(1, 100)
        magic = [{"name": "Fire", "cost": 10, "dmg": 60}]
        person = game.Person("bob", rand_int, rand_int, rand_int, rand_int,
                             magic, [])
        damage = person.generate_damage()

        self.assertLess(damage, rand_int + 11)
        self.assertGreater(damage, rand_int - 11)
Exemplo n.º 5
0
 def test_get_mp(self):
     rand_int = random.randint(1, 100)
     magic = [{"name": "Fire", "cost": 10, "dmg": 60}]
     person = game.Person("bob", 200, rand_int, rand_int, rand_int, magic,
                          [])
     self.assertEqual(rand_int, person.get_mp())
Exemplo n.º 6
0
 def test_heal(self):
     random_int = random.randint(10, 100)
     person = game.Person("bob", 300, 0, 0, 0, [], [])
     person.take_damage(200)
     new_hp = person.heal(random_int)
     self.assertEqual(new_hp, 100 + random_int)
Exemplo n.º 7
0
    "quantity": 5
}, {
    "item": superpotion,
    "quantity": 5
}, {
    "item": elixer,
    "quantity": 5
}, {
    "item": hielixer,
    "quantity": 2
}, {
    "item": grenade,
    "quantity": 5
}]
#
player1 = game.Person("JARVIS:", 3860, 132, 300, 34, player_spells,
                      player_items)
player2 = game.Person("Vision:", 3690, 188, 320, 34, player_spells,
                      player_items)
player3 = game.Person("Tony  :", 4060, 174, 280, 34, player_spells,
                      player_items)

players = [player1, player2, player3]

enemy1 = game.Person("Loki  ", 1250, 130, 560, 325, enemy_spells, [])
enemy2 = game.Person("Thanos", 9000, 701, 545, 25, enemy_spells, [])
enemy3 = game.Person("Ultron", 1250, 130, 560, 325, enemy_spells, [])

enemies = [enemy1, enemy2, enemy3]

running = True
i = 0