# Help Needed for in Backwoods Forest : The One Wizard

**URL:** <https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380>\
**Category:** Uncategorized\
**Created:** [August 1, 2018, 11:42am UTC](https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380 "2018-08-01T11:42:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![G-Dragon](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@G-Dragon](https://discourse.codecombat.com/u/G-Dragon)\
**Post date:** [August 1, 2018, 11:42am UTC](https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380/1 "2018-08-01T11:42:30Z")

</div>

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)  
Thanks

```python
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) {
        hero.attack(enemy);  
    }
    if (hero.health < 25) {
        hero.cast("regen", hero);
    }
}
```

---

<div class="post-metadata">

**Author:** ![RobAnybody](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@RobAnybody](https://discourse.codecombat.com/u/RobAnybody)\
**Post date:** [August 1, 2018, 11:56am UTC](https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380/2 "2018-08-01T11:56:52Z")

</div>

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

```python
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)]`

---

<div class="post-metadata">

**Author:** ![G-Dragon](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@G-Dragon](https://discourse.codecombat.com/u/G-Dragon)\
**Post date:** [August 1, 2018, 12:17pm UTC](https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380/4 "2018-08-01T12:17:39Z")

</div>

Hi, thanks for helping out.

May I know what is this?  
current\_plan = plan[index % len(plan)]  
sorry 😅

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

---

<div class="post-metadata">

**Author:** ![RobAnybody](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@RobAnybody](https://discourse.codecombat.com/u/RobAnybody)\
**Post date:** [August 1, 2018, 12:30pm UTC](https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380/5 "2018-08-01T12:30:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Seojin\_Roy\_Lee](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/seojin_roy_lee/32/23539_2.png) [@Seojin\_Roy\_Lee](https://discourse.codecombat.com/u/Seojin_Roy_Lee)\
**Post date:** [August 3, 2018, 3:12am UTC](https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380/6 "2018-08-03T03:12:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![G-Dragon](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@G-Dragon](https://discourse.codecombat.com/u/G-Dragon)\
**Post date:** [August 3, 2018, 2:04pm UTC](https://discourse.codecombat.com/t/help-needed-for-in-backwoods-forest-the-one-wizard/15380/7 "2018-08-03T14:04:24Z")

</div>

Will try it out, thanks for helping out! 🙂
