Help. I need help with grim determination

this is my code

# Your goal is to protect Reynaldo

# Find the paladin with the lowest health.
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):
    # Heal the paladin with the lowest health using lowestHealthPaladin()
    # You can use paladin.canCast("heal") and command(paladin, "cast", "heal", target)
    # Paladins can also shield: command(paladin, "shield")
    # And don't forget, they can attack, too!
    warlock = hero.findNearest(hero.findByType("warlock"))
    enemy = paladin.findNearestEnemy()
    lowest = lowestHealthPaladin()
    if warlock:
        hero.command(paladin, "attack", warlock)
    elif lowest and paladin.canCast("heal",lowest):
        hero.command(paladin, "cast","heal", lowest)
    else:
        hero.command(paladin, "attack", enemy)
def commandGriffin(griffin):
    enemy = griffin.findNearestEnemy()
    warlock = hero.findNearest(hero.findByType("warlock"))
    if warlock:
        hero.command(griffin, "attack", warlock)
    elif enemy:
        hero.command(griffin, "attack", enemy)
    
def commandPeasant(peasant):
    item = peasant.findNearestItem()
    if item:
        hero.command(peasant, "move", {"x":item.pos.x,"y":item.pos.y})
    
def commandFriends():
    # Command your friends.
    friends = hero.findFriends()
    
    for friend in friends:
        if friend.type == "peasant":
            commandPeasant(friend)
            pass
        elif friend.type == "griffin-rider":
            commandGriffin(friend)
            pass
        elif friend.type == "paladin":
            commandPaladin(friend)

while True:
    commandFriends()
    # Summon griffin riders!
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")

this is my equipment
image
I keep making it to 32.5 secs

There is nothing wrong with your code. Maybe tell the paladin to shield when their health is less than 200?

P.S. Paladin’s shield ability blocks way more damage than hero’s shield, and it also blocks magic attacks.

Please avoid making duplicates HELP grim determination (Yes I know, I posted this twice, sorry)

sorry I completed it an hour after I completed it. I had been waiting for 3 hours for a reply and I didn’t get one. I made healing the other paladins a priority and then I waited for the right seed

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