# Fight your way into the Inner Sanctum of the ogre chieftain, and defeat her.
def attack():
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
def commandArcher(archer):
for friend in hero.findByType("archer"):
tower = hero.findByType("tower")
enemy = hero.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
def commandSoldier(soldier):
friends = hero.findFriends()
for friend in hero.findByType("soldier"):
catapult = hero.findByType("catapult")
if catapult:
hero.command(friend, "move", {'x': catapult.pos.x, 'y': catapult.pos.y})
def commandPaladin(paladin):
enemy = hero.findNearestEnemy()
friends = hero.findFriends()
friend = hero.findNearest(friends)
if paladin.canCast("heal") and hero.health <= 1000:
hero.command(paladin,"cast" "heal", hero)
elif enemy:
hero.command(paladin, "attack", enemy)
def commandFriends():
friends = hero.findFriends()
for friend in friends:
if friend.type == "paladin":
commandPaladin(friend)
if friend.type == "archer":
commandArcher(friend)
if friend.type == "soldier":
commandSoldier(friend)
while True:
commandFriends()
attack()
I need some help about this, my soldier didn’t walk to the catapult and it’s error
can someone help me please?