# Advance through the forgotten tomb.
# Be wary, traps lay in wait to ruin your day!
# The Paladins volunteer to lead the way.
# Command them to shield against incoming projectiles.
while True:
friends = hero.findFriends()
# findEnemyMissiles finds all dangerous projectiles.
projectiles = hero.findEnemyMissiles()
for friend in friends:
# Find the projectile nearest to the friend:
projectiles = hero.findEnemyMissiles()
# If the projectile exists
# AND is closer than 10 meters to the paladin:
for projectile in projectiles:
if friend.type == "paladin":
if friend.distanceTo(projectile) <= 10:
# Command the friend to "shield":
hero.command(friend, "shield")
# ELSE, when there is no potential danger:
else:
# Advance the paladin:
hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
if friend.type == "paladin" and friend.health <= 100:
if friend.canCast("heal", friend):
hero.command(friend, "cast", "heal", friend)
else:
if friend.health >= 200:
hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
pass
else:
# If not a paladin, just advance:
hero.command(friend, "move",{'x' : friend.pos.x + 0, 'y' : friend.pos.y})
# Advance the hero in the x direction:
hero.move({'x':hero.pos.x + 50, 'y':hero.pos.y})```
# Advance through the forgotten tomb.
# Be wary, traps lay in wait to ruin your day!
# The Paladins volunteer to lead the way.
# Command them to shield against incoming projectiles.
while True:
friends = hero.findFriends()
# findEnemyMissiles finds all dangerous projectiles.
projectiles = hero.findEnemyMissiles()
for friend in friends:
if friend.type == 'paladin':
# Find the projectile nearest to the friend:
projectile = friend.findNearestEnemyMissile()
# If the projectile exists
# AND is closer than 10 meters to the paladin:
if projectile and friend.distanceTo(projectile) < 10:
# shield here
# ELSE, when there is no potential danger:
else:
# Advance the paladin:
hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
else:
# If not a paladin, just advance:
# move your other people
# Advance the hero in the x direction:
hero.move({'x':hero.pos.x + 50, 'y':hero.pos.y})
here is my updated version still does not work. the paladins don’t do anything now.
# Be wary, traps lay in wait to ruin your day!
# The Paladins volunteer to lead the way.
# Command them to shield against incoming projectiles.
while True:
friends = hero.findFriends()
# findEnemyMissiles finds all dangerous projectiles.
projectiles = hero.findEnemyMissiles()
for friend in friends:
if friend.type == 'paladin':
# Find the projectile nearest to the friend:
projectile = friend.findNearestEnemyMissile()
# If the projectile exists
# AND is closer than 10 meters to the paladin:
if projectile and friend.distanceTo(projectile) < 10:
hero.command(friend, "sheild")
# ELSE, when there is no potential danger:
else:
# Advance the paladin:
hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
else:
# If not a paladin, just advance:
hero.command(friend, "move", friend.pos.x + 1, friend.pos.y)
# Advance the hero in the x direction:
hero.move({'x':hero.pos.x + 50, 'y':hero.pos.y})```