Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Reaping Fire help on griffin-riders

fire reaping help. I need help with my code, my griffin-riders are not responding to the command and also my code maybe has other problems.HELP

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 enemy and enemy.type == "fangrider":
        return "fight-back"
    # Otherwise, return "collect-coins"
    return "collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    friend = hero.findFriends()
    friends = hero.findFriends()
    if friend in friends:
        hero.command(friend, "attack", enemy)
        for enemy in enemies:
            hero.command(friend, "attack", enemy)
    pass
    
def pickUpCoin():
    # Collect coins
    coin = hero.findNearestItem()
    if coin:
        hero.move(coin.pos)
    pass
    
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    if enemy and enemy.pos > hero.pos:
        hero.attack(enemy)
    pass
    
while True:
    commandAttack()
    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()

i youst fixed the griffin-riders command
but i still have problems in my code

i fix it but i think its a bug but yaaay! :shushing_face: nevermined its still rong

done i deleted heroAttack() caUSE TOOTIME TO KILL A FANGRIDER

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()
    # Otherwise, return "collect-coins"
    return "collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    friend = hero.findFriends()
    friends = hero.findFriends()
    enemies = hero.findEnemies()
    for friend in friends:
        for enemy in enemies:
            hero.command(friend, "attack", enemy)
    pass
    
def pickUpCoin():
    # Collect coins
    coin = hero.findNearestItem()
    if coin:
        hero.move(coin.pos)
    pass
    

while True:
    commandAttack()
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if strategy == "griffin-rider":
        hero.summon("griffin-rider")
    elif strategy == "collect-coins":
        pickUpCoin()
1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.