Help with level "Reaping fire"

Hi guys,
merry Christmas!
But … this level is hard for me!
I just can’t find my error (“attempted to read only property” - is there any misspelling? I can’t find it.)
Could anyone help me?

# 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):
        return "griffin-rider"
    # If there is a fangrider on your side of the mines, return "fight-back"
    enemy = hero.findNearest(hero.findByType("fangrider"))
    elif enemy and enemy.type == "fangrider" and hero.distanceTo(enemy) < 30: 
        return "fight-back"
    # Otherwise, return "collect-coins"
    else: 
        return "collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    for griffin in hero.findByType("griffin-rider"): 
        if griffin: 
            enemy = griffin.findNearest(griffin.findEnemies())
            if enemy and enemy.type == "ogre": 
                hero.command(griffin, "attack", enemy)
    
    
def pickUpCoin():
    # Collect coins
    coin = hero.findNearest(hero.findItems())
    if coin: 
        hero.move(coin.pos)
    pass
    
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    enemy = hero.findNearest(hero.findEnemies())
    if enemy and enemy.type == "fangrider" and hero.distanceTo(fangrider) < 30: 
        if hero.canCast("chain-lightning", enemy): 
            hero.cast("chain-lightning", enemy)
        elif: 
            if hero.canCast("drain-life", enemy): 
                hero.cast("drain-life", enemy)
        else: 
            hero.attack(enemy)
    
    
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": 
        hero.attack()
        
        
    if strategy == "collect-coins": 
        pickUpCoin()

In method chooseStrategy.

if hero.gold >= hero.costOf(griffin-rider) #<-- Needs double quotes for "griffin-rider"

In method commandAttack.

enemy = griffin.findNearest(griffin.findEnemies()) #<--- This is your error. Griffin can not use findEnemies() only hero can.

You can fix this by finding the enemies through the hero then using the array made from the hero for the giffin.

You’re right about the double quotes. Nice catch.

However, I’m pretty sure the line enemy = griffin.findNearest(griffin.findEnemies()) should work fine. Summoned minions can use many of the same methods as the hero can. However, it’s usually standard to use: enemy = griffin.findNearestEnemy() instead. Specifically, on the Glacier map Kelvintaph Defiler, players are required to find enemies through their allies, as a wall separates the hero from their allies, and Twilight Glasses (to see through walls) are disabled.

Thank you! I needed to add a “if enemy” statement somewhere in my code to solve this level!