Anyone help? here is my code:
# Fight your way into the Inner Sanctum of the ogre chieftain, and defeat
her.
hero.cast("invisibility", hero)
while True:
flag = self.findFlag("green")
warlock = self.findNearest(self.findByType("warlock"))
chief = self.findNearest(self.findByType("chieftain"))
witch = self.findNearest(self.findByType("witch"))
friends = hero.findFriends()
if hero.time >= 67:
break
for friend in friends:
if friend.type is 'paladin':
if hero.health<1000:
hero.command(friend, "cast", 'heal', hero)
if flag:
self.pickUpFlag(flag)
if witch:
self.attack(witch)
if chief:
self.attack(chief)
if warlock:
self.attack(warlock)
else:
enemy = self.findNearest(self.findEnemies())
if enemy:
self.attack(enemy)
hero.moveXY(184, 6)
hero.cast("invisibility", hero)
while True:
def summonAndCommandArtillery():
flag = self.findFlag("green")
def avoidHazards():
warlock = self.findNearest(self.findByType("warlock"))
def findAndAttackEnemy():
chief = self.findNearest(self.findByType("chieftain"))
witch = self.findNearest(self.findByType("witch"))
friends = hero.findFriends()
hazards = hero.findHazards()
for friend in friends:
if friend.type is 'paladin':
if hero.health<1000:
hero.command(friend, "cast", 'heal', hero)
if hero.canCast("invisibility", hero):
hero.cast("invisibility", hero)
if flag:
self.pickUpFlag(flag)
if witch:
self.attack(witch)
summonAndCommandArtillery()
avoidHazards()
if chief:
self.attack(chief)
summonAndCommandArtillery()
if warlock:
self.attack(warlock)
summonAndCommandArtillery()
else:
enemy = self.findNearest(self.findEnemies())
if enemy:
self.attack(enemy)
summonAndCommandArtillery()