Try to not attack the warlock, so command the paladin to attack their nearest enemy only if it is not the warlock, else shield (the same attack tactic for the riders but without the shirld part).
# 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):
enemyMissiles = hero.findEnemyMissiles()
missile = hero.findNearest(enemyMissiles)
# Heal the paladin with the lowest health using
enemy = hero.findNearestEnemy()
if lowestHealthPaladin():
if paladin.canCast("heal", lowestHealthPaladin()):
hero.command(paladin, "cast", "heal", 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!
if enemy:
hero.command(paladin, "attack", enemy)
pass
def commandPeasant(friend):
item = friend.findNearestItem()
if item:
hero.command(friend, "move", item.pos)
pass
def commandGriffin(friend):
enemy = hero.findNearestEnemy()
if enemy and enemy.type=="warlock":
hero.command(friend, "attack", enemy)
else:
hero.command(friend, "defend", friend.pos)
def commandFriends():
# Command your friends.
friends = hero.findFriends()
for friend in friends:
if friend.type == "peasant":
commandPeasant(friend)
pass
elif friend.type == "griffin-rider":
commandGriffin(friend)
pass
elif friend.type == "paladin":
commandPaladin(friend)
pass
while True:
commandFriends()
enemy = hero.findNearestEnemy()
# Summon griffin riders!
if hero.gold>=hero.costOf("griffin-rider"):
hero.summon("griffin-rider")
the issue is that the riders and eveyone else dies so the enmies get through after some pushing me back (no error)
So everything works well? Including the paladins casting heal? That section looks a bit fishy to me… But if it works, it works.
You could try commanding the griffins to attack specific enemies so that you have an advantage.
Deadpool is right to doubt that your paladins are being healed.
To solve this level, your soldiers need to be able to move, defend, attack, heal, shield depending on their health, their location and their foes.How this is done is explained in previous topics about the same level, use the search engine.
Example of how the level can be passed. Can be done without the fifth paladin and without any losses, but it’s funnier this way.