while True:
friends = hero.findFriends()
for friend in friends:
if friend.type is "paladin":
# Find the projectile nearest to the friend:
arrow = hero.findNearest(hero.findEnemyMissiles())
# If the projectile exists
# AND is closer than 10 meters to the paladin:
if arrow:
# Command the friend to "shield":
distance = friend.distanceTo(arrow)
if distance < 10:
hero.command(friend, "shield")
hero.command(friend, "cast", "heal", friend)
# ELSE, when there is no potential danger:
else:
# Advance the paladin:
hero.command(friend, "move", {'x':friend.pos.x +1, 'y':friend.pos.y})
else:
# If not a paladin, just advance:
hero.command(friend, "move", {'x':friend.pos.x +1, 'y':friend.pos.y})
# Advance the hero in the x direction:
x = hero.pos.x +1
y = hero.pos.y
hero.moveXY(x, y)
my code runs properly, yet my troops just won’t go for the last step to disable the traps, is this a bug or something?