Grim Determination has a bug about paladins

It doesn’t work.
bug: labeled
bug type: argument error: you need something to cast upon.

#paladin = hero.findNearest(hero.findByType("paladin"))
#if paladin.canCast("heal", hero):
#    hero.command(paladin, "cast", "heal", hero)

#starts here

# 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(p):
    # 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
    weak = lowestHealthPaladin()
    if p.canCast("heal", weak):
        hero.command(p, "cast", "heal", weak)
        hero.command(p, "shield")

#peasent commanded, not shown

#griffin command, not shown

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":
    #All commandable
    #boss star 3

while True:
    if >= 50:

What’s wrong? misspelled? Several times already!

Say lowestHealthPaladin returns None, which can happen if all paladins are at full health. Does p.canCast("heal", weak) make sense? You may need to check for the existence of weak first.

How do I find paladin health? Please tell me.
I tried using, but it doesn’t work. will tell you the health of a paladin, provided it exists. Otherwise you’re trying to fetch the health of a non-existent paladin, which doesn’t make sense. You can see it used in the definition of lowestHealthPaladin.

To solve your original problem of not knowing whether the return value of lowestHealthPaladin exists or not, you should use an if, as so:

if p and p.canCast("heal", weak):

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic , which shows all essentials of this board! Thanks!
@Cheung_Wilbur can you send me a link to the level?