[SOLVED]Reaping fire, don't know what to do(python)

Here’s my now code. I have to get offline now though.

# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.
def chooseStrategy():
    enemies = hero.findEnemies()
    enemy = hero.findNearestEnemy()
    fangrider = enemy.type == "fangrider"
    # 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"
    elif fangrider.pos.x < 35:
        return "fight-back"
        # Otherwise, return "collect-coins"
    else:
        return "collect-coins"
        
def commandAttack():
    # Command your griffin riders to attack ogres.
    enemy = hero.findNearestEnemy()
    friends = hero.findFriends()
    
    for friend in friends:
        
        hero.command(friend, "attack", enemy)
    pass
    
def pickUpCoin():
    # Collect coins
    item = hero.findNearestItem()
    hero.moveXY(item.pos.x,item.pos.y)
    pass
    
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    fangrider = enemy.type == "fangrider"
    fangrider2 = fangrider.pos.x < 35
    if fangrider2:
        hero.attack(fangrider2)
    pass
    
while True:
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if strategy == "griffin-rider":
        hero.summon("griffin-rider")
    if strategy == "fight-back":
        heroAttack()
    if strategy == "collect-coins":
        pickUpCoin()
1 Like