What’s wrong with my code??? My allies can’t kill at least one enemy.
while True:
coin = hero.findNearestItem()
if coin:
hero.move(coin.pos)
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
for friend in hero.findFriends():
if friend.type == "soldier":
distance = hero.distanceTo(friend)
if distance < 20:
if friend.health < friend.maxHealth:
if hero.canCast("regen", friend):
hero.cast("regen", friend)
enemy = hero.findNearestEnemy()
if enemy and enemy.health > 0:
hero.command(friend, "attack", enemy)
if friend.health < friend.maxHealth*0.3:
hero.command(friend, "move", {"x": 24, "y": 46})
else:
hero.command(friend, "move", {"x": 80, "y": 46})