It’s so much harder than any boss battle I’ve completed already. Any tips and tricks?
# 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()
Cream = lowestHealthPaladin()
Badnik = paladin.findNearest(hero.findEnemies)
EggDragoon = paladin.findNearest(Unleashed)
# You can use paladin.canCast("heal") and command(paladin, "cast", "heal", target)
if Cream:
if paladin.canCast("heal", Cream):
hero.command(paladin, "cast", "heal", Cream)
# Paladins can also shield: command(paladin, "shield")
# And don't forget, they can attack, too!
elif EggDragoon and paladin.distanceTo(EggDragoon) < 10:
hero.command(paladin, "attack", EggDragoon)
elif Badnik:
hero.command(paladin, "attack", Badnik)
else:
hero.command(paladin, "defend", {"x": 86, "y": 39})
pass
def commandPeasant(peasant):
ring = peasant.findNearestItem()
if ring:
hero.command(peasant, "move", ring.pos)
def commandGriffin(Sonic):
Jet = Sonic.findNearestEnemy()
Storm = Sonic.findNearest(Unleashed)
if Storm and Sonic.distanceTo(Storm) < 10:
hero.command(Sonic, "attack", Storm)
elif Jet:
hero.command(Sonic, "attack", Jet)
def commandFriends():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
if friend.type == "peasant":
#commandPeasant(friend)
commandPeasant(friend)
pass
elif friend.type == "griffin-rider":
#commandGriffin(friend)
commandGriffin(friend)
pass
elif friend.type == "paladin":
commandPaladin(friend)
while True:
Unleashed = hero.findByType("warlock")
commandFriends()
# Summon griffin riders!
if hero.gold > hero.costOf("griffin-rider"):
hero.summon("griffin-rider")