示例#1
0
def test_screep_ranged_attacks_correct_dmg():
    s1 = Screep(REDTEAM, 3, move=1, range_att=1)
    s2 = Screep(BLUETEAM, 0)
    start_hp = s2.hp
    s1.set_target([s2])
    s1.attack([s2])
    assert s2.hp == start_hp - s1.range_att_mods * RANGED_ATT_DMG
示例#2
0
def test_screep_melee_attacks_correct_dmg():
    s1 = Screep(REDTEAM, 1, move=1, melee_att=1)
    s2 = Screep(BLUETEAM, 0)
    start_hp = s2.hp
    s1.set_target([s2])
    s1.attack([s2])
    assert s2.hp == start_hp - s1.melee_att_mods * MELEE_ATT_DMG
示例#3
0
def test_screep_ranged_attacks_only_when_in_range():
    s1 = Screep(REDTEAM, 4, move=1, range_att=1, move_func=screep.maint_dist_to_target)
    s2 = Screep(BLUETEAM, 0)
    start_hp = s2.hp
    s1.set_target([s2])
    s1.attack([s2])
    assert s2.hp == start_hp
    s1.move([s2])
    s1.attack([s2])
    assert s2.hp == start_hp - s1.range_att_mods * RANGED_ATT_DMG
示例#4
0
def test_screep_does_not_attack_when_dead():
    s1 = Screep(REDTEAM, 1, range_att=1)
    s2 = Screep(BLUETEAM, 0)
    start_hp = s2.hp
    s1.set_target([s2])
    s1.attack([s2])
    assert s2.hp < start_hp
    start_hp = s2.hp
    s1.hp = 0
    s1.attack([s2])
    assert s2.hp == start_hp