Now my archers do not move and my paladin will not heal:
def commandPaladin():
friends = hero.findFriends()
for friend in friends:
if friend.type == "paladin":
hero.command(friend, "move", {'x': 22, 'y': 40})
hero.command(friend, "move", {'x': 22, 'y': 66})
hero.command(friend, "move", {'x': 42, 'y': 66})
hero.command(friend, "move", {'x': 42, 'y': 82})
hero.command(friend, "move", {'x': 74, 'y': 82})
hero.command(friend, "move", {'x': 85, 'y': 74})
enemy = friend.findNearestEnemy()
if enemy and friend.pos.x == 85 and friend.pos.y == 74:
hero.command(friend, "shield")
if friend.canCast("heal") and friend.health < friend.maxHealth:
hero.command(friend, "cast", "heal", friend)
def commandHero():
hero.moveXY(34, 15)
hero.moveXY(34, 22)
def commandHelpers():
friends = hero.findFriends()
for friend in friends:
enemy = friend.findNearestEnemy()
if friend.type == "archer":
hero.command(friend, "move", {'x': 22, 'y': 40})
hero.command(friend, "move", {'x': 22, 'y': 66})
hero.command(friend, "move", {'x': 42, 'y': 66})
hero.command(friend, "move", {'x': 42, 'y': 82})
hero.command(friend, "move", {'x': 74, 'y': 82})
hero.command(friend, "move", {'x': 75, 'y': 68})
if enemy and enemy.type != "yeti":
hero.command(friend, "attack", enemy)
def commandOthers():
friends = hero.findFriends()
for friend in friends:
if friend.type == "soldier":
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
commandHero()
while True:
commandPaladin()
commandHelpers()
commandOthers()