Help Needed for in Backwoods Forest : The One Wizard

Hello, everyone. I need help on this level is i cant properly defeat the catapult.
My code is pasted as below. Is there any suggestion for me or any mistakes I made to defeat the catapult and the 44 ogres? (I managed to kill only 28)

while (true) {
    var enemy = hero.findNearestEnemy();
    if (enemy && hero.canCast("chain-lightning", enemy)) {
        hero.cast("chain-lightning", enemy);
    } else if (enemy && hero.canCast("lightning-bolt", enemy)) {
        hero.cast("lightning-bolt", enemy);
    } else if (enemy && hero.canCast("root", enemy)) {
        hero.cast("root", enemy);
    } else if (enemy) {
    if ( < 25) {
        hero.cast("regen", hero);

You need to control order of all actions. My solution is to create the list

plan = ["lightning-bolt", 'attack', 'attack', 'attack', 'attack', 'attack', "lightning-bolt", "chain-lightning",
        "regen", 'attack', "regen", "lightning-bolt", "chain-lightning", 'attack', 'attack', "lightning-bolt", 'attack',
        "regen", "lightning-bolt", 'say', "away", 'armagedon']

And then I just control it using
current_plan = plan[index % len(plan)]

1 Like

Hi, thanks for helping out.

May I know what is this?
current_plan = plan[index % len(plan)]
sorry :sweat_smile:

May I know how does your code basically look like in JS?

I cant post solution here. Forum rules. But my solution on python can be found on github.

1 Like

my way of beating this level is by destroying the catapult with lightning bolt, and only use that on the catapult, and use chain-lightning only against line of scouts. and going to the button in the end.

1 Like

Will try it out, thanks for helping out! :slight_smile: