My code for summits gate used to work, and it is very good, but recently it got me stuck where I used to be able to make it through. I get all the way to right before the warlocks, bu then everyone stops moving.
My code:
def findSkeletons(enemies):
skeletons = hero.findByType("skeleton")
skeleton = hero.findNearest(skeletons)
return skeleton
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = self.findFriends()
for friend in friends:
if friend.type != "paladin":
continue
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
return lowestFriend
def notdoor(friend):
enemies=self.findEnemies()
maxdistance=0
target=None
for enemy in enemies:
distance= friend.distanceTo(enemy)
if distance < maxdistance and enemy.type is not "door":
maxdistance=distance
focus=enemy
if focus:
self.say(focus)
return focus
else:
return False
def itempeasant(peasant):
item=peasant.findNearest(self.findItems())
if item:
return item
else:
return False
def pickUpitem():
for peasant in self.findByType("pesant",self.findFriends()):
while itempeasant(peasant):
item=itempeasant(peasant)
self.command(peasant, "attack", item.pos)
# Fight your way into the Inner Sanctum of the ogre chieftain, and kill her.
waiting={"x":7,"y":26}
waiting2={"x":7,"y":47}
points=[{"x":96,"y":34},{"x":248,"y":34},{"x":280,"y":34},{"x":248,"y":34}]
Up=False
while True:
catapult = self.findByType("catapult", self.findEnemies())
tower = self.findByType("tower", self.findEnemies())
nb_catapult=len(catapult)
nb_tower=len(tower)
#Command Troop
friends=self.findFriends()
i=1
for foo,friend in enumerate(friends):
if nb_catapult > 0:
index=i % nb_catapult
target=catapult[index]
if friend.type is "soldier":
i+=1
elif friend.pos.x > 240:
target=notdoor(friend)
elif friend.pos.x < 85 or self.pos.x > 110 :
target=friend.findNearest(self.findEnemies())
target2=self.findNearest(self.findEnemies())
if not target and target2:
target=target2
else:
target=False
target2=False
if friend.type is "paladin":
mostHurt=lowestHealthPaladin()
if self.now() > 75 and self.now() < 80:
self.command(friend, "move", {"x":180,"y":9})
elif len(catapult) > 0 and Up:
self.command(friend, "move", waiting)
Up=False
elif len(catapult) > 0 and not Up:
self.command(friend, "move", waiting2)
Up=True
elif friend.pos.x < 94 and friend.pos.x < self.pos.x-5 and self.pos.x < 340:
self.command(friend, "move", {"x":friend.pos.x+1,"y":34})
elif mostHurt and friend.canCast("heal"):
self.command(friend, "cast", "heal", self)
elif friend.pos.x < self.pos.x -25 and self.pos.x > 140:
self.command(friend, "move", {"x":self.pos.x-20,"y":self.pos.y})
elif friend.pos.x > 240:
self.command(friend, "attack", target)
else:
self.command(friend, "shield")
if friend.type is "archer":
mostHurt=lowestHealthPaladin()
warlock=self.findNearest(self.findByType("warlock"))
if warlock:
target=warlock
if self.now() > 75 and friend.pos.x < 175:
self.command(friend, "move", {"x":180,"y":9})
elif len(catapult) > 0 and Up:
self.command(friend, "move", waiting)
Up=False
elif len(catapult) > 0 and not Up:
self.command(friend, "move", waiting2)
Up=True
elif friend.pos.x < self.pos.x -20 and self.pos.x > 140:
self.command(friend, "move", {"x":self.pos.x-7,"y":self.pos.y})
elif friend.pos.x < 75 and target and friend.pos.x < self.pos.x:
self.command(friend, "attack", target)
elif target and friend.pos.x > 247:
self.command(friend, "attack", target)
elif target and self.pos.x > 118 and friend.pos.x < self.pos.x:
self.command(friend, "attack", target)
elif friend.pos.x > 247 and target :
self.command(friend, "attack", target)
else:
self.command(friend, "defend", {"x":self.pos.x-15,"y":self.pos.y-5})
if friend.type is "soldier":
if len(catapult) > 0:
if friend.pos.x < 97 and i > 3:
self.command(friend, "move", {"x":97,"y":34})
elif target:
self.command(friend, "attack", target)
else:
self.command(friend, "move", {"x":97,"y":34})
elif friend.pos.x < 95 and friend.pos.x > self.pos.x :
self.command(friend, "move", {"x":75,"y":34})
elif target and self.now() > 90:
self.command(friend, "attack", target)
#Command Hero
enemy=self.findNearest(self.findEnemies())
warlock=self.findNearest(self.findByType("warlock"))
cheiftain = hero.findNearest(hero.findByType("cheiftain"))
items = hero.findItems()
item = hero.findNearest(items)
skeleton = findSkeletons(hero.findEnemies)
gem = hero.findNearest(hero.findByType("gem"))
if len(catapult) < 1:
if self.pos.x < 130:
self.move({"x":self.pos.x+1,"y":32})
elif nb_tower > 0:
self.shield()
elif self.pos.x < 240:
self.move(points[1])
elif warlock and hero.canCast("chain-lightning", warlock) or hero.isReady("bash"):
if warlock:
if hero.isReady("bash"):
hero.bash(warlock)
else:
self.cast("chain-lightning", warlock)
elif skeleton:
hero.attack(skeleton)
elif gem:
hero.move(gem.pos)
elif self.pos.x < 275:
self.move(points[2])
elif enemy and enemy.type == cheiftain and (hero.canCast("chain-lightning", enemy) or hero.isReady("bash")):
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
else:
hero.bash(enemy)
else:
self.shield()
if self.gold >= self.costOf("archer") and (self.pos.x < 94 or nb_tower < 1) and self.now() < 120:
self.summon("archer")
please tell me what I can do here!
my gear:
boots of leaping
kithsteel blade
emperor’s gloves
gilt wristwatch
caltrop belt
programmication IV
thronprick
twilight glasses
sapphire sense stone
wooden strand
advanced flags
Boss star III
Engraved Obsidian helmet
Obsidian Breastplate
Deflector
I use Sir Tharin Thunderfist and have 1553 gems