Cloudrip Brawl: I Can't Survive

while (true) {
    let enemy = hero.findNearestEnemy();
    let coin = hero.findNearestItem();
    let soldiers = hero.findFriends();
    
    if (enemy) {
        if (hero.canCast("chain-lightning", enemy)) {
            hero.cast("chain-lightning", enemy);
        } else {
            hero.attack(enemy);
        }
    }
    if (coin) {
        hero.move(coin.pos);
    }
    if (hero.gold > hero.costOf("soldier")) {
        hero.summon("soldier");
    }
    if (soldiers) {
        for (let soldier of soldiers) {
            enemy = soldier.findNearestEnemy();
            hero.command(soldier, "attack", enemy);
        }
    }
}

I can’t survive this and I’m not sure what else to do.

Can you post a picture of your gear?

I would recommend getting a faster sword like the sword of the temple guard of sword of the forgotten to kill smaller enemies faster. Also maybe only attack enemies that are near you so you can focus on collecting gold.

Which sword will work better?

I think sword of the temple guard is better in most situations.

Alright. I will try it.

The sword did not work.

I am doing Cloudrip brawl 4.

If you want to summon soldiers more, you should only attack enemies that are close to you, although your hero is probably better at fighting at this point so you might want to only collect gold coins or not even not collect coins at all.

can you use a ranger? (Ritic the Cold)

I don’t have him and he’s really expensive

I have had success using this character and with this gear, I just didn’t submit it. It definitely can be done.

while (true) {
    let coin = hero.findNearestItem();
    let soldiers = hero.findFriends();
    let enemy = hero.findNearestEnemy();
    if (coin) {
        hero.move(coin.pos);
    }
    if (hero.gold > hero.costOf("soldier")) {
        hero.summon("soldier");
    }
    if (soldiers && enemy) {
        for (let soldier of soldiers) {
            hero.command(soldier, "attack", enemy);
        }
    }
     if (enemy) {
         if (hero.canCast("chain-lightning", enemy)) {
             hero.cast("chain-lightning", enemy);
         } else {
             hero.attack(enemy);
         }
     }
}

Anyone have suggestions about the logic of the code (not just buying new characters or gear)?

I use hero.findNearestEnemy() to pick an enemy. I assume this leads to me attacking enemies that are near to my hero.

But it will find the nearest enemy always, even if it is across the map. Adding another if statement like if (hero.distanceTo(enemy) < 20 or something would make it so your hero only attacks enemies that are near you instead of just the nearest one. I would also recommend commanding the soldiers to attack their nearest enemy instead of the hero’s nearest enemy.

I tried that, but it still doesn’t work.

I guess the earlier levels of cloudrip brawl are harder than i remember. There’s a couple more small things you can do (like rings) but the later levels are only possible with bought heroes like ritic and nalfar (or cheesing the level :wink:).

Did you pass the Cloudrip Mountain?

Yes. you don’t need to do the brawls to progress through levels.