My character does not summon the griffin riders.
# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.
def chooseStrategy():
enemies = hero.findEnemies()
# If you can summon a griffin-rider, return "griffin-rider"
if hero.gold > hero.costOf("griffin-rider"):
return "griffin-rider"
# If there is a fangrider on your side of the mines, return "fight-back"
enemy = hero.findNearestEnemy()
if hero.distanceTo(enemy) < 30:
return "fight-back"
# Otherwise, return "collect-coins"
else:
return "colect-coins"
def commandAttack():
# Command your griffin riders to attack ogres.
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "attack", enemy)
pass
def pickUpCoin():
# Collect coins
item = hero.findNearestItem()
if item:
hero.move(item.pos)
pass
def heroAttack():
# Your hero should attack fang riders that cross the minefield.
enemies = hero.findEnemies()
for enemy in enemies:
if hero.distanceTo(enemy) < 35:
hero.scattershot(enemy)
pass
while True:
commandAttack()
strategy = chooseStrategy()
# Call a function, depending on what the current strategy is.
chooseStrategy()
pickUpCoin()
heroAttack()