Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Reaping Fire coding errror?


When I run my code, my hero continually tries to summon Griffin Riders, and, as you can imagine, stalls in place for a long time, which causes me to lose the level. Here is my code:

def chooseStrategy():
    enemies = self.findEnemies()
    enemy = self.findNearest(enemies)
    if > self.costOf("griffin-rider"):
        return "griffin-rider"
    # If you can summon a griffin-rider, return "griffin-rider"
    elif enemy:
        if enemy.type is "fangrider" and self.distanceTo(enemy) < 30:
            return "fight-back"
    # If there is a fangrider on your side of the mines, return "fight-back"
        return "collect-coins"
    # Otherwise, return "collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    for griffin in self.findByType("griffin-rider"):
        if griffin:
            enemy = griffin.findNearestEnemy()
            if enemy:
                self.command(griffin, "attack", enemy)
def pickUpCoin():
    # Collect coins
    coin = self.findNearest(self.findItems())
    if coin:
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    enemy = self.findNearest(self.findEnemies())
    if enemy and self.distanceTo(enemy) < 30:
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if strategy = "griffin-rider":
    if strategy = "fight-back":
    if strategy = "collect-coins":

What am I doing wrong?


Comparison operator is == and not =.


Question, I cant attack without my sword but, I cant summon without my hammer
what do?


You mean you can’t summon without a hammer equipped?


facepalm, I didn’t know you don’t need the hammer to summon


i can’t believe i missed this, i have literally nearly the same code and ran into the same problem.

such a simple thing to fix and yet i have looked over it for hours.