You got my vote for RA2 Wizard. Always and forever.
S-32, self/opponent's health, and opponent range are already in the equation...
class AvoidFoe(AI.Tactic): name = "AvoidFoe" def __init__(self, ai): AI.Tactic.__init__(self, ai) goforward = False def Evaluate(self): #do not bother : high priority, it is a draft! self.priority = 300 self.target_id, range = self.ai.GetNearestEnemy() def Execute(self): # get information about self and ennemy : if self.target_id != None: a = Arenas.currentArena target_loc = plus.getLocation(self.target_id) self_loc = self.ai.GetLocation() # dir = vector3(target_loc) - vector3(self_loc) bestDist = dir.length() dir.normalize() dir.x, dir.z = dir.z, dir.x factorD = [5, 4, 3, 2, -5, -4, -3 -2] isOk = False bestloc = self_loc for d in factorD: dest = vector3(self_loc) + dir * d if self.ai.IsStraightPathClear(self_loc, dest.asTuple()): newDist = (dest - vector3(target_loc)).length() if abs(newDist) > abs( bestDist ): bestloc = dest bestDist = newDist enAvantToute = ( newDist > 0 ) isOk = True if isOk: self.ai.DriveToLocation(bestloc.asTuple(),enAvantToute) return True