Hi this is my code. I manage to destroy the beam towers. Then, 2 palidans come out the door and heal me. Then my hero does nothing.
Please help!
This is my gear:
Fight your way into the Inner Sanctum of the ogre chieftain, and defeat her.
Fight your way into the Inner Sanctum of the ogre chieftain, and defeat her.
def attack():
enemy = hero.findNearestEnemy()
if enemy and enemy.type == “catapult”:
hero.moveXY(87, 34)
hero.attack(enemy)
if enemy and enemy.type == “tower”:
hero.attack(enemy)
if hero.health < 100:
hero.moveXY(167, 34)
else:
if enemy:
hero.attack(enemy)
def commandArcher(archer):
if hero.gold > 100:
hero.summon("archer")
hero.summon("archer")
hero.summon("archer")
hero.summon("archer")
for friend in hero.findByType("archer"):
tower = hero.findByType("tower")
enemy = archer.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
def commandSoldier(soldier):
friends = hero.findFriends()
for friend in hero.findByType(“soldier”):
catapult = hero.findByType(“catapult”)
catapult = hero.findByType(“catapult”) # returns an array
catapult = friend.findNearest(hero.findByType(“catapult”))
if catapult:
hero.command(friend, "move", {'x': catapult.pos.x, 'y': catapult.pos.y})
def commandPaladin(paladin):
enemy = paladin.findNearestEnemy()
friends = hero.findFriends()
for friend in friends:
if paladin.canCast(“heal”) and hero.health <= 2000:
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)strong text
if friend.type == “archer”:
commandArcher(friend)
if friend.type == “soldier”:
commandSoldier(friend)
while True:
commandFriends()
attack