Example #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
Example #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
Example #3
0
def test_actor_speed_is_within_1_to_100():
    actor = Actor(0)
    assert 1 <= actor.speed <= actor.unit_max()
Example #4
0
def test_actor_health_is_within_50_to_100():
    actor = Actor(0)
    assert 50 <= actor.health_points <= actor.unit_max()
Example #5
0
def test_actor_strength_is_within_1_to_100():
    actor = Actor(0)
    assert 1 <= actor.strength <= actor.unit_max()