Help on Reaping Fire


#1

On the level Reaping Fire, my griffin-riders are not responding when I command them to attack the ogres. Can you help me?

Here is my code:


# 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"):
        hero.summon("griffin-rider")
        return "griffin-rider"
    # If there is a fangrider on your side of the mines, return "fight-back"
    for enemy in enemies:
        if enemy and enemy.type is "fang-rider":
            return "fight-back"
    # Otherwise, return "collect-coins"
        else:
            return "collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    enemy = hero.findNearest(hero.findEnemies())
    if enemy and enemy.type is "ogre":
        hero.command("griffin-rider", "attack", "ogre")
    
    
def pickUpCoin():
    # Collect coins
    items = hero.findItems()
    for item in items:
        if item and item.value > 1:
            hero.moveXY(item.pos.x, item.pos.y)
    
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    enemy = hero.findNearest(hero.findEnemies())
    if enemy and enemy.type is "fang-rider":
        hero.attack(enemy)
    
while True:
    commandAttack()
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if strategy == "griffin-rider":
        commandAttack()
    if strategy == "fight-back":
        heroAttack()
    if strategy == "collect-coins":
        pickUpCoin()

#2

Are there any ogres? Your commandAttack function specifies that the griffin riders only attack ogres.


#3

But the comments say that the the griffin riders should only attack ogres. I assumed that munchkins and throwers fell into the ogre group.


#4

Try attacking all enemies (if enemy). Also, fangrider should not be hyphenated.


#5

Yeah, I just realized that last part.


#6

Now I am not summoning enough griffin-riders. I am only summoning one.

Here is my new code:



def chooseStrategy():
    enemies = hero.findEnemies()
    # If you can summon a griffin-rider, return "griffin-rider"
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
        return "griffin-rider"
    # If there is a fangrider on your side of the mines, return "fight-back"
    for enemy in enemies:
        if enemy and enemy.type is "fangrider":
            return "fight-back"
    # Otherwise, return "collect-coins"
        else:
            return "collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    friend = hero.findNearest(hero.findFriends())
    enemy = hero.findNearest(hero.findEnemies())
    if enemy: 
        hero.command(friend, "attack", enemy)
        
def pickUpCoin():
    # Collect coins
    items = hero.findItems()
    for item in items:
        if item and item.value > 1:
            hero.moveXY(item.pos.x, item.pos.y)
    
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    enemy = hero.findNearest(hero.findEnemies())
    if enemy and enemy.type is "fangrider":
        hero.attack(enemy)
    
while True:
    commandAttack()
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if strategy == "griffin-rider":
        commandAttack()
    if strategy == "fight-back":
        heroAttack()
    if strategy == "collect-coins":
        pickUpCoin()

#7

Try defining a single coin using a different method, like hero.findNearestItem. Currently, you are using hero.findItems, which finds an array of items but doesn’t define a particular position of each item or which one to move to. With findNearestItem, you are defining a single position of a single item to move to - the nearest coin.

What character are you using and do you have the ring of speed? You need some speed to get as many grif-riders as possible.


#8

I am using Pender Spellbane and I have the ring of Speed.


#9

I was able to pass the level with Pender but couldn’t get the 60 second bonus with it. Pender just doesn’t have enough health. Are you casting haste? Mana blast? I wound up using Nalfar to get the bonus.


#10

Thanks for the advice


#11

I finished the level! I have been working for a month on it! Thanks!


#12

By the way, I got the bonus and won with Tharin


#13

Well done! You just need to keep working on it!