I've stuck on Summit's Gate for days. Could anyone help?

I’ve stuck on Summit’s Gate for days and I have done nearly 70% of it. But the witches are too powerful. Can you help me to finish my code and beat the witches.
here is my code:
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = hero.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 commandPaladin(paladin):
lowestFriend = lowestHealthPaladin()
healingThreshold = 0.8 * paladin.maxHealth
if lowestFriend and paladin.canCast(‘heal’) and lowestFriend.health < healingThreshold:
self.command(paladin, ‘cast’, ‘heal’, lowestFriend)
def commandPaladin2(paladin):
self.command(paladin, ‘cast’, ‘heal’, hero)
def commandPaladin3(paladin):
self.command(paladin,‘move’,{“x”:141,“y”:36})
def commandArcher(friend):
enemies= friend.findEnemies()
enemy = friend.findNearest(enemies)
if enemy:
hero.command(friend, “attack”, enemy)
def commandFriends1():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
elif friend.type == “archer”:
commandArcher(friend)
pass
elif friend.type == “paladin”:
self.command(friend, ‘move’, {“x”:85,“y”:35})
elif friend.type == “soldier”:
self.command(friend, ‘move’, {“x”:75,“y”:34})
self.command(friend, ‘move’, {“x”:83,“y”:62})
elif friend.type == “griffin-rider”:
self.command(friend, ‘move’, {“x”:75,“y”:34})
self.command(friend, ‘move’, {“x”:83,“y”:8})
def commandFriends2():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
if friend.type == “paladin”:
commandPaladin(friend)
pass
else:
commandArcher(friend)
def commandFriends3():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
hero.command(friend, ‘move’,{“x”:74,“y”:36} )
def commandFriends4():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
if friend.type == “paladin”:
commandPaladin2(friend)
pass
else:
commandArcher(friend)
def commandFriends5():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
hero.command(friend, ‘move’,{“x”:228,“y”:52} )
def commandFriends6():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
if friend.type == “paladin”:
commandPaladin2(friend)
else:
commandArcher(friend)
def commandFriends8():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
hero.command(friend, ‘move’,{“x”:268,“y”:35} )

def commandFriends7():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
if friend.type == “paladin”:
commandPaladin3(friend)

while True:
commandFriends1()
self.moveXY(91, 35)
commandFriends2()
if hero.gold>hero.costOf(“griffin-rider”):
hero.summon(“griffin-rider”)
if hero.now()>30:
while True:
if hero.gold>hero.costOf(“griffin-rider”):
hero.summon(“griffin-rider”)
commandFriends3()
hero.moveXY(82, 36)
commandFriends4()
while True:
enemies = self.findEnemies()
enemyIndex=0
while enemyIndex< len(enemies):
enemy=enemies[enemyIndex]
commandFriends4()
if hero.now()>72:
enemyIndex+=1000
if enemy:
if enemy.type==‘tower’:
hero.attack(enemy)
distance = hero.distanceTo(enemy)
if distance<40:
while enemy.health>0:
if hero.isReady(“chain -lingtning”):
hero.cast(“chain-lightning”, target)
else:
hero.attack(enemy)
enemyIndex+=1
commandFriends6()
commandFriends4()
if hero.now()>100:
commandFriends5()
hero.moveXY(228, 60)
commandFriends6()
while enemyIndex< len(enemies):
enemy=enemies[enemyIndex]
if hero.now()>120:
enemyIndex+=1000
if enemy:
while enemy.health>0:
if hero.isReady(“chain -lingtning”):
hero.cast(“chain-lightning”, target)
else:
hero.attack(enemy)


here is my equipment

We can’t help you write your code for you, but I would recommend searching through the forums for summit’s gate. There are a lot of good strategies discussed.

The two pieces of advice I would give is to make sure to kill the warlocks first, checking that you are only commanding friends whose friend.team is self.team(they will turn your own soldier against you) and not to accidentally attack the door to open the area to the chieftain until you have killed all the other enemies first.

So I’m going to ignore the orges and attack the warlock first?

and do you have any suggestion about my equipment?

Hey buddy, your equipment is fine, just beat it with the same stuff so don’t worry about that. One tip that worked for me if your getting near the end and then dying:

Think about tying your summoning of Griffins to a flag event. In JavaScript something like:

var summonflag = this.findFlag("black");
if (summonflag) {
   this.summonGriffins();
}

this.summonGriffins being a function you defined previously. This way you can build up gold from the boss star and diamonds and deploy them all in the final skirmish, and not have to worry about them being pointlessly taken out by the beam towers or early enemies.

Your equipment should be fine. Just target the warlocks, then witches, then normal ogres. Generally it is best for you and your archers to kill high value targets while the soldiers just absorb damage.

Summoning more troops will help too.