Example #1
0
 def test_attack(self):
     gladiator_1 = new_core.NewGladiator(75, 0, 10, 10, 'Thor')
     gladiator_2 = new_core.NewGladiator(75, 0, 11, 13, 'Loki')
     gladiator_1.attack(gladiator_2)
     assert gladiator_1.rage == 15
     assert gladiator_2.health == 65
     gladiator_2 = new_core.NewGladiator(75, 100, 10, 10, 'Loki')
     gladiator_1 = new_core.NewGladiator(65, 100, 11, 13, 'Thor')
     gladiator_2.attack(gladiator_1)
     assert gladiator_2.rage == 0
     assert gladiator_1.health == 45
Example #2
0
 def test_punch(self):
     gladiator_1 = new_core.NewGladiator(50, 100, 10, 10, 'Thor')
     gladiator_2 = new_core.NewGladiator(75, 100, 10, 10, 'Loki')
     gladiator_1.punch(gladiator_2)
     assert gladiator_2.health == 55
     assert gladiator_1.rage == 0
     assert gladiator_1.health == 25
     gladiator_2 = new_core.NewGladiator(75, 0, 10, 10, 'Thor')
     gladiator_1 = new_core.NewGladiator(75, 0, 10, 10, 'Loki')
     gladiator_2.punch(gladiator_1)
     assert gladiator_1.rage == 0
     assert gladiator_2.health == 37
Example #3
0
 def test_init(self):
     gladiator = new_core.NewGladiator(100, 0, 10, 20, 'Thor')
     assert gladiator.health == 100
     assert gladiator.rage == 0
     assert gladiator.damage_low == 10
     assert gladiator.damage_high == 20
     assert gladiator.name == 'Thor'
Example #4
0
def main():
    welcome_window()
    gladiator_1 = core.NewGladiator(100, 0, 10, 20, 'Thor')
    gladiator_2 = core.NewGladiator(100, 0, 10, 20, 'Loki')
    while True:
        print(gladiator_1)
        red_text, white_text = gladiator_1.get_health_bar()
        print(red_text, end="")
        print(white_text, end="\n\n")

        print(gladiator_2)
        red_text, white_text = gladiator_2.get_health_bar()
        print(red_text, end="")
        print(white_text, end="\n\n")

        prep_player_one()
        battle(gladiator_1, gladiator_2)
        if gladiator_2.is_dead():
            dead_skull()
            game_over()
            print('{} is dead, {} wins!'.format(gladiator_2.name,
                                                gladiator_1.name))
            break

        prep_player_two()
        battle(gladiator_2, gladiator_1)
        if gladiator_1.is_dead():
            dead_skull()
            game_over()
            print('{} is dead, {} wins!'.format(gladiator_1.name,
                                                gladiator_2.name))
            break
    print(gladiator_1)
    red_text, white_text = gladiator_1.get_health_bar()
    print(red_text, end="")
    print(white_text, end="\n\n")

    print(gladiator_2)
    red_text, white_text = gladiator_2.get_health_bar()
    print(red_text, end="")
    print(white_text, end="\n\n")
Example #5
0
 def test_repr(self):
     gladiator_1 = new_core.NewGladiator(50, 100, 10, 10, 'Thor')
     assert repr(gladiator_1) == 'Gladiator(Thor: 50, 100, 10, 10)'
Example #6
0
 def test_str(self):
     gladiator_1 = new_core.NewGladiator(50, 100, 10, 10, 'Thor')
     assert str(
         gladiator_1
     ) == "Gladiator: Thor || health: 50, rage: 100, damage_low: 10, damage_high: 10"
Example #7
0
 def test_heal(self):
     gladiator_1 = new_core.NewGladiator(15, 20, 100, 10, 'Thor')
     assert gladiator_1.heal() == gladiator_1
Example #8
0
 def test_is_dead(self):
     gladiator_1 = new_core.NewGladiator(0, 20, -1, 10, 'Thor')
     assert gladiator_1.is_dead() == True
     gladiator_1 = new_core.NewGladiator(1, 20, -1, 10, 'Thor')
     assert gladiator_1.is_dead() == False