# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.
def chooseStrategy():
enemies = hero.findEnemies()
strategy = "no"
# If you can summon a griffin-rider, return "griffin-rider"
if hero.gold >= hero.costOf("griffin-rider"):
strategy = "yes"
return "griffin-rider"
# If there is a fangrider on your side of the mines, return "fight-back"
enemy = hero.findNearestEnemy()
if enemy and enemy.type == "fangrider":
strategy = "yes"
return "fight-back"
# Otherwise, return "collect-coins"
if strategy == "no":
return "collect-coins"
def summonGriffins():
hero.summon("griffin-rider")
def commandAttack():
# Command your griffin riders to attack ogres.
griffins = hero.findByType("griffin-rider")
for griffin in griffins:
enemy = griffin.findNearestEnemy()
if enemy:
hero.command(griffin, "attack", enemy)
pass
def pickUpCoin():
# Collect coins
item = hero.findNearestItem()
if item and item.pos.x < 38:
hero.moveXY(item.pos.x, item.pos.y)
pass
def heroAttack():
# Your hero should attack fang riders that cross the minefield.
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
pass
while True:
commandAttack()
strategy = chooseStrategy()
# Call a function, depending on what the current strategy is.
if strategy == "griffin-rider":
summonGriffins()
elif strategy == "fight-back":
heroAttack()
elif strategy == "collect-coins":
pickUpCoin()
What do I do in this level? The munchkin
s keep triggering the fire-trap
s, even though I’ve told my griffin-rider
s to attack.
I’m sorry if this post is bad quality. This is my very first post.
Also, this is my first post.