Im having trouble on this one, the code seems complete and it works but for some reason I can’t pass the level. Help plz?
# 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")
This file has been truncated. show original
You need to use the lowestHealthPaladin() function to find the paladin that you need to heal. I’d also recommend only healing if the paladin is 450 health or lower.
Another thing that would help is having the paladins shield if they are low health; such as below 200.
OK, I tried again and it worked but for some reason it went back to incomplete( maybe I moved something…)
here’s my code now, what happened this time?
Oh it works now! for some reason it bugged