[HELP] Summits gate


#1

Hi everyone,

I need a help for summit’s gate …

Thank a lot

I need the code :frowning:

 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":266,"y":34},{"x":248,"y":34}]
Up=False
loop:
    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):    
        #CHOIX DE LA CIBLE
        #SI catapult existe encore -> Target
        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)        
        #Si plus de catapul target enemy    
        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

            
        #Sinon pas de cible
        else:    
            target=False
            target2=False
    
        #Gestion des Paladins        
        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")
    
        #Gestion des Archers 
        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})
        #Gestion des Soldats
        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"))
    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 self.pos.x < 275:
            self.move(points[2])
        elif warlock and self.health > self.maxHealth/2 and self.now()> 80:    
            self.attack(warlock)        
        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")

[Help] Kelvintaph Defiler!
#2

i m so desperate !

Thx you !

:joy:


#3

It is regular policy to wait at least 24 hours before expecting a reply. However, records show you only waiting 22 minutes. Please be more patient. We can’t be on here every minute of the day.

Phrases like “I need help!” or “This code doesn’t work!” do not help you one bit. Give us more information: What happens when you run your code? Is there an error? If so, what does it say?


#4

Which part did you get to?


#5

The level is hard. My strategy was to make the troops defend at my pos.


#6

This level is hard I have not passed it myself but I got to the warlocks.


#7

just go to github and look for answers, then use pro skill flag placing.


#8

Don’t always use answers. Try using your own code.


#9

Here’s a hint for people that are stuck at the warlock part:

Set a flag function and move your hero over to the warlock’s pos and redefine nearest enemy. That’ll allow your hero to directly focus on the warlock and kill it instead of focusing on the skeletons. Or you could set a priority function in your code and have the warlocks killed first that way.

Here’s a HUGE hint for passing the level for people that seem to run out of health by the time they arrive at the inner sanctum:

Command your paladins to heal you when you are less than your maxHealth, and before you go to the warlocks,
let the paladins heal you repeatedly until you are at full health, then use your strategy for killing the warlocks (don’t look at the previous hint if you don’t have to) and enter the inner sanctum

Here’s a hint for people that think ogres are somehow unkillable in the inner sanctum:

The witch is healing them. Use your warlock priority killing strategy and target the witch before killing the rest.

Have fun with the level!! :smiley: This level is great! Shouldn’t be as hard as Kelvintaph Defiler (Once you get to Glacier)

By my experience, Summit’s Gate is easier because it’s straight-forward coding, while in Kelvintaph Defiler you have to use exploits and do some messy coding and series of steps to command your troops… Still haven’t passed Defiler yet :expressionless:


#10

Here’s another one:

Spoiler

The paladins auto heal any near allies so if you are fighting the warlocks, lure the skeletons to your allies when fighting the warlocks then finish them with backstab or scattershot.


#11

For defiler, try grouping your allies and make them fight as a team against Nalfar.


#12

The thing is, when I use the attack in mid-air exploit that is required to complete the level, I was able to free a soldier, but when the soldier goes to attack another shaman, the shaman did the fear spell on the soldier as well… some of the shamans are in cramped spaces, and my soldier couldn’t get in there and kill them.


#13

Use archers to fight the shamans


#14

*post deleted due to off topic


#15

@SuperSmacker Make a new thread. This thread is for Summit’s Gate.


#16

I had to modify the code so much though.


#17

GitHub should be banned


#18

That will not happen.


#19

github .master is okay sometimes but don’t always use it. That won’t make you learn.


#20

that is pure truth :no_mouth: