[SOLVED] Summit's gate problem

Hello! I am struggling with the final stage of this level(with chieftain). My hero keeps dying and, most important he stops summoning griffins, when he has gems.
Here is the screenshot of my equipment:

Here is my code:

# Прорвись с боем в святилище вождя огров и убей его.
def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = hero.findFriends()
    for friend in friends:
        if friend.health < lowestHealth and friend.health < friend.maxHealth:
            lowestHealth = friend.health
            lowestFriend = friend
    return lowestFriend
def commandArmy(friend):
    enemy = friend.findNearestEnemy()
    if enemy and enemy.type =='warlock':
        hero.command(friend, "attack", enemy)
    elif enemy:
        hero.command(friend, "attack", enemy)
def commandPaladin(paladin):
    enemy = paladin.findNearestEnemy()
    lowestFriend = lowestHealthPaladin()
    if enemy:
        hero.command(paladin, "attack", enemy)
    if lowestFriend and paladin.canCast("heal"):
        hero.command(paladin, "cast", "heal", lowestFriend)
def commandFriends():
    # Управляй своими союзниками.
    friends = hero.findFriends()
    for friend in friends:
        if friend.type == "soldier" or friend.type == 'archer' or friend.type == 'griffin-rider':
        elif friend.type == "paladin":
def commandHeroandPet():
    enemy = hero.findNearestEnemy()
    flag = hero.findFlag("green")
    if enemy:
        if hero.canCast("chain-lightning", enemy):
            hero.cast("chain-lightning", enemy)
        elif hero.isReady("throw") and hero.distanceTo(enemy) <= hero.throwRange:
    if flag:
    if hero.isReady("phase-shift"):
    if hero.isReady("shadow-vortex"):
        hero.shadowVortex(hero.pos, {"x": enemy.pos.x, "y": enemy.pos.y})
    specialPos = {'x': 276, 'y': 34}
    if hero.isReady("wall-of-darkness") and hero.distanceTo(specialPos) < 30:
        hero.wallOfDarkness([{"x": 276, "y": 44}, {"x": 276, "y": 24}]);
while True:
    if hero.gold >= hero.costOf("griffin-rider"):

My army is doing everything great, and I use ALL of my hero's possibilities.
Please, help me!

Did you remember this post: Grim Determination problem. I checked your grim determination code in the leader board , you didn’t correct your code and here you have made the same mistakes.

Maybe try to blink to the flag?

Yes, but now paladins heal everyone, so they work perfectly.

1 Like

I tried, but that didn’t help much.

1 Like

I just thought you have low speed, because of boots. But if you unequip them you’ll have low health.

1 Like

No, Ritic is actually fast.


@Anonym Ritic is fast, but he doesn’t have the best armor, so I would recommend not using the flower bracelet or the ring of speed, and using these two instead:
image image
Hope this helps!

Hi Anonym,

Well done on getting to the Inner Sanctum. I don’t know the exact reason why your hero stops summoning - it maybe that at that point (s)he’s attacking the chieftan and can’t do anything else. There’s some things that will improve your code that might solve the problem:

As @xython says, your functions commandPaladin and commandHeroandPet both contain multiple if statements. These don’t execute in order - I think only one of them happens for each round of code. If you want to control which one runs, use elif and think about the conditions you put in.

For your lowestHealthPaladin function, you don’t seem to include checking your hero’s health, so (s)he will never be healed. Also if you just find the lowestFriend you’re likely to mostly heal archers (max health 30) before anyone else.

For the commandArmy function, you check if the nearestFriend is a warlock, but you attack the nearestFriend whether or not the answer is yes. If you want to prioritise attacking warlocks, you’ll need different code.

Hope that helps, good luck!



Thanks a lot to everyone and to you! I solved it!


Congratulations! :partying_face:

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.