I need help with the level Kelvintaph Defiler.
Here is my code:
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': 75, 'y': 68})
enemy = hero.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
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:
paladin = friend.findByType("paladin")
if friend.type == "archer":
if paladin:
hero.command(friend, "move", {'x': paladin.pos.x, 'y': paladin.pos.y})
def commandOthers():
friends = hero.findFriends()
for friend in friends:
if friend.type == "soldiers":
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
commandHero()
while True:
commandPaladin()
commandHelpers()
commandOthers()
can you please help me, I do not know what is wrong