Help with Reaping Fire (JavaScript)

I’ve looked at other people’s questions and solutions but I can’t figure out why mine isn’t working. The problem is that as soon as my hero summons a second Griffin Rider, it flies to the edge of the minefield and then just hovers over it and doesn’t start moving and attacking until the first one is dead. I can’t figure out what is making it stop.

// The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.

function chooseStrategy() {
    var enemies = hero.findEnemies();
    var enemy = hero.findNearest(enemies);
    // 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"
    else if (enemy && enemy.pos.x < 35 && enemy.type == "fangrider") {
        return "fight-back";
    }
    // Otherwise, return "collect-coins"
    else {
        return "collect-coins";
    }
}

function commandAttack() {
    // hero.say("command Attack");
    // Command your griffin riders to attack ogres.
    var friends = hero.findFriends();
    for (var i = 0; i < friends.length; i++) {
        var friend = friends[i];
        var enemy = friend.findNearest(friend.findEnemies());
        if (enemy && enemy.type != "fangrider" ) {
            hero.command(friend, "attack", enemy);
        }
    }
}

function pickUpCoin() {
    // Collect coins
    var item = hero.findNearestItem();
    if (item) {
        hero.moveXY(item.pos.x, item.pos.y);
    }
}

function heroAttack() {
    // Your hero should attack fang riders that cross the minefield.
    var enemy = hero.findNearestEnemy();
    if (enemy && enemy.type == "fangrider") {
        while (enemy.health > 0) {
            hero.attack(enemy);
        }
    }
}

while(true) {
    commandAttack();
    var strategy = chooseStrategy();
    // Call a function, depending on what the current strategy is.
    if (strategy == "collect-coins") {
        pickUpCoin();
    } else if (strategy == "griffin-rider") {
        hero.summon("griffin-rider");
    } else if (strategy == "fight-back") {
        heroAttack();
    }
}

(Additionally, how do I log out from the forums? It seems separate from the main website/game and I am on a shared computer.)

        if (enemy && enemy.type != "fangrider")
                hero.command(friend, "attack", enemy);

What happens when the nearest enemy is a fangrider? What about other enemies?
It’s a dirty patch but try

        else hero.command(friend, "defend", ({x:75,y:35})); 
        // or some other point

Think what to do when the traps are blown, because then your griffin riders will be killed mercilessly

When the nearest enemy is a fangrider they would do nothing, true. But it also stops when there is no fangrider on the screen, which is what is confusing me. I would assume any other enemy type would just be attacked, or should, but it’s not, apparently. And so it either waits for the other griffin to be killed, or moves forward incrementally whenever the other griffin kills an enemy and switches targets. I can’t figure out why it’s waiting with every step and not just also attacking the enemies.

Sending them to a location to defend does work somewhat, but then they attack passing fangriders as well instead of ignoring them and focusing on other enemies. I actually managed to pass it earlier by some fluke, lucky placement of enemies that allowed the minefield to survive just long enough, but I just can’t reliably make it work, even with this alteration.

And I have no idea what to do when the minefield is gone, by that time there are so many enemies that everything gets overwhelmed no matter what I do. I’m not even sure if and how I can track when the minefield is gone. How do I even find mines?

One way of finding the mines could be hero.findHazards()…however, why not just walk right through them, from the start? I moved to a point due east of the starting position, to just outside of explosion range, then started summoning and attacking like crazy. Typically, the fangriders would fly on across the mine field, then get stuck. Remember, the field only needs to stand for 30 seconds.