Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Grim Determination SOS

Here 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":
        if < lowestHealth and < friend.maxHealth:
            lowestHealth =
            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!
    paladin = hero.findNearest(hero.findByType("paladin"))
    if paladin.canCast("heal", hero):
        hero.command(paladin, "cast", "heal", hero)

def commandFriends():
    # Command your friends.
    friends = hero.findFriends()
    for friend in friends:
        if friend.type == "peasant":
        elif friend.type == "griffin-rider":
        elif friend.type == "paladin":

while True:
    # Summon griffin riders!

Here instead of hero put lowest. Before that put that lowest is what the function lowestHealthPaladin. And delete this:

Also, command the paladin to attack or shield after you check if it can heal and after it does it.

This one put in an if that checks if >= 50 that is in the while loop.

Here write a function that commands the friend to attack their nearest enemy, and then delete the # from its beggining.

Here command the friend to move to their nearest coin, and then delet the # from its beggining.


1 Like