Beispiel #1
0
def test_fight():
    actor = Actor(0)
    actor.strength = 25
    enemy = Actor(1)
    enemy.health_points = enemy.unit_max()
    actor.location[0] = 50
    actor.location[1] = 50
    enemy.location[0] = 50
    enemy.location[1] = 50
    assert actor.fight(enemy) == 25
Beispiel #2
0
def test_fight_from_distance():
    actor = Actor(0)
    enemy = Actor(1)
    enemy.health_points = enemy.unit_max()
    actor.location[0] = 50
    actor.location[1] = 40
    enemy.location[0] = 50
    enemy.location[1] = 50
    weapon_range = 10
    weapon = 25
    assert actor.fight_from_distance(enemy, weapon_range, weapon) == 25
    weapon_range = 1
    assert actor.fight_from_distance(enemy, weapon_range, weapon) == 0
Beispiel #3
0
def test_take_damage():
    actor = Actor(0)
    actor.health_points = 50
    actor.take_damage(40)
    assert actor.health_points == 10