def test_distance(self): from warlord.path import distance tileA = Mock() tileB = Mock() tileA.location = (0, 0) tileB.location = (0, 1) self.assertEquals(distance(tileA, tileB), 1)
def is_in_range(unitA, unitB): dist = distance(unitA.tile, unitB.tile) - 1 return dist in unitA.equipped_item.attack_range