Help with the one wizard

hey guys i need some help i can get the first 2 objectives but not the last 2 so here my code and tell me if theres a way you can help me get the last 2.

index = 0
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']
while True:
    current_plan = plan[index % len(plan)]
    if (current_plan == 'regen'):
        if hero.isReady("regen"):
            hero.cast("regen", hero)
            index += 1
        else:
            hero.moveXY(8, 30)
    elif (current_plan == 'away'):
        hero.moveXY(18, 41)
        index += 1
    elif (current_plan == 'say'):
        hero.say("booring")
        index += 1
    elif (current_plan == 'armagedon'):
        hero.moveXY(7, 41)
        index += 1
    else:
        enemy = hero.findNearestEnemy()
        if (enemy):
            if (enemy and enemy.health > 0):
                dist = hero.distanceTo(enemy)
                if (current_plan == 'attack'):
                    hero.attack(enemy)
                elif (current_plan == "chain-lightning" and hero.isReady("chain-lightning")):
                    hero.cast("chain-lightning", enemy)
                elif current_plan == "lightning-bolt" and hero.isReady("lightning-bolt"):
                    hero.cast("lightning-bolt", enemy)
            if (enemy.health <= 0):
                index += 1
        else:
            hero.moveXY(8, 30)

1 Like

Please keep posts on topic.

Please do not post finished code.

Since the level doesn’t have seeds, I just used code without ifs and loops. My strategy was lightning-bolt the catapults, chain-lightning the little guys, and regen whenever you can.

“I just used code without ifs and loops” - Using this “feature” ( i see it as a flaw…)? :

var snortt = 'Snortt',
    goreball = 'Goreball',
    zock = 'Zock',
    zozo = 'Zozo';
hero.attack(snortt);
hero.attack(snortt);
hero.attack(goreball);
hero.attack(zock);
hero.attack(zozo);
hero.attack(zozo);

@DaPandaKing - I like your approach - didn’t debug it

Mod edit: [Please don’t post successful solutions.]