I see what you mean, but that is the incorrect way to use the function. Currently you are just returning the last friend in the list not the friend with the lowest health, but since you need someone to meet your elif statement it works. I’m not sure why you have the code below checking for a friend with the lowest health and then healing the hero. If you are only looking to heal the hero, I’d remove the function and adjust the code just for the hero. One of my changes below.
elif mostHurt and friend.canCast("heal"):
self.command(friend, "cast", "heal", self)
After changing my gear to match yours and made three changes from your code. I was able to complete the level.
# with def findSkeletons(enemies): on line 3
# line 96
elif friend.canCast("heal") and hero.health < hero.maxHealth:
self.command(friend, "cast", "heal", self)
# line 163 fix the or combination with () like you did with the chieftain
elif warlock and hero.canCast("chain-lightning", warlock) or hero.isReady("bash"):
# line 74
elif self.pos.x < 275:
self.move(points[3]) # change to [2]