# \[SOLVED\] Doom glade - can't finish level

**URL:** <https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848>\
**Category:** Level Help\
**Created:** [July 7, 2020, 3:53pm UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848 "2020-07-07T15:53:50Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 7, 2020, 3:53pm UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/1 "2020-07-07T15:53:50Z")

</div>

Hi everyone, I’m currently stuck in the above mentioned level. It doesn’t seem that my code is wrong, it is more that my hero’s are not strong enough.  
Is there a master solution for the level, with regards to the hero and weapon’s I have to use?  
Btw my hero Alejandro has 997 health and my strongest sword 192,2 DPS (which is not able to cleave).

So should I still try cleave and attack or should I use build fire-traps e.g., cast,… ?

thanks for any help in advance

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 7, 2020, 3:59pm UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/2 "2020-07-07T15:59:33Z")

</div>

Hi @Naddali275 and welcome to the forum! 🥳

Could you send us your code as it is described [here](https://discourse.codecombat.com/t/essentials-how-to-post-format-your-code-correctly/15521) so we will be able to help you?

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 7, 2020, 8:52pm UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/3 "2020-07-07T20:52:47Z")

</div>

Hi Andrei, many thanks and also for your quick reply 😌  
I used the following and honestly without any idea where and when to place the flag during the fight:

```python
while(true) {
    var flag = hero.findFlag();
    var enemy = hero.findNearestEnemy();
    if (flag) {
        hero.pickUpFlag(flag);
    }
    else if (enemy) {
         if (hero.isReady("cleave")){
            hero.cleave(enemy);
    }
    else {
     hero.attack(enemy);   
        }
    }
}

```

Thank you,  
Natalie

---

<div class="post-metadata">

**Author:** ![Anna](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anna/32/8378_2.png) [@Anna](https://discourse.codecombat.com/u/Anna)\
**Post date:** [July 8, 2020, 2:05am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/4 "2020-07-08T02:05:56Z")

</div>

I’d move the flag to the area that has the highest damage ogres (to the left, i think). Then, as the battle goes on, move the flag to areas that need help (or look like they do - that’s how i did it).

Hope that helps,  
-@Anna

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 3:20am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/5 "2020-07-08T03:20:46Z")

</div>

I have done as @Anna said, but do not be afraid to experiment because you may find a better solution, all right @Naddali275?

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 8, 2020, 10:02am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/6 "2020-07-08T10:02:23Z")

</div>

Hey guys,  
Unfortunately it didn’t work out. As soon as my hero gets closer to the upper part where many ogres appear, he dies a few seconds afterwards.  
As already mentioned, I have no gems to get new weapon or heros so I tried this code:

```python
while(true) {
    var enemy = hero.findNearestEnemy();
    if (hero.canCast("drain-life"), enemy) {
        hero.cast("drain-life", enemy);
    }
    else {
        hero.attack(enemy);
    }
    if (hero.health < hero.maxHealth / 3 && hero.canCast("invisibility")) {
        hero.cast("invisibility", hero);
}
}

```

where actually happens nothing.

What hero and weapon did you guys use so it worked out with only cleave and attack? Any other ideas whats the reason I cant pass?  
Thanks a lot

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 10:05am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/7 "2020-07-08T10:05:03Z")

</div>

Can you show us your equipment?

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 8, 2020, 10:12am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/8 "2020-07-08T10:12:22Z")

</div>

This is what I used for the `cast code`

 ![Bildschirmfoto 2020-07-08 um 12.10.01](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/b/b1175af08a221f5147b1d481930b26a08fbe1250.png)

And this for `cleave` and `attack`

 ![Bildschirmfoto 2020-07-08 um 12.12.05](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/1/1a54043115f7f628b5c5d18191be3173e336ddd2.jpeg)

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 10:15am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/9 "2020-07-08T10:15:56Z")

</div>

Can you show me your recent cleave code? (The cleave is **the best** way at your level and gems to deal with swarms of munchkins.)

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 8, 2020, 10:23am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/10 "2020-07-08T10:23:38Z")

</div>

sure,

```python
while(true) {
    var flag = hero.findFlag();
    var enemy = hero.findNearestEnemy();
    if (flag) {
        hero.pickUpFlag(flag);
    }
    else if (enemy) {
        if (hero.isReady("cleave") && hero.distanceTo(enemy) < 5) {
               hero.cleave(enemy);
    }
    else {
        hero.attack(enemy);
        }
    }
    else {
            hero.shield();
        }
}

```

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 10:28am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/11 "2020-07-08T10:28:41Z")

</div>

Can you resend me the code but use the **U** button in the level so the text will be well with the spaces?

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 8, 2020, 10:31am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/12 "2020-07-08T10:31:05Z")

</div>

```python
while (true) {
    var flag = hero.findFlag();
    var enemy = hero.findNearestEnemy();
    if (flag) {
        hero.pickUpFlag(flag);
    } else if (enemy) {
        if (hero.isReady("cleave") && hero.distanceTo(enemy) < 5) {
            hero.cleave(enemy);
        } else {
            hero.attack(enemy);
        }
    } else {
        hero.shield();
    }
}

```

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 10:32am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/13 "2020-07-08T10:32:18Z")

</div>

> [@Naddali275](#):
>
> ```python
> if (hero.isReady("cleave") && hero.distanceTo(enemy) < 5) {
> hero.cleave(enemy);
> } else {
> hero.attack(enemy);
> }
> 
> ```

Try to also use bash if you can before you attack.

Andrei

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 10:37am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/14 "2020-07-08T10:37:40Z")

</div>

> [@Naddali275](#):
>
> ` && hero.distanceTo(enemy) < 5`

And try to delete this.

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 8, 2020, 10:54am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/15 "2020-07-08T10:54:39Z")

</div>

Hi Andrei,  
My hero indeed survives longer, but it is still not enough.  
Should I try this level with cast function, what do you mean?

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 10:59am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/16 "2020-07-08T10:59:23Z")

</div>

No. But can I see the recent cleave code so I can help you finish the level with this code?

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 8, 2020, 11:03am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/17 "2020-07-08T11:03:50Z")

</div>

Alright, and sorry for taking so much of your time!

```python
while (true) {
    var flag = hero.findFlag();
    var enemy = hero.findNearestEnemy();
    if (flag) {
        hero.pickUpFlag(flag);
    } else if (enemy) {
        if (hero.isReady("cleave")) {
            hero.cleave(enemy);
        } else if (hero.isReady("bash")) {
            hero.bash(enemy);
        } else {
            hero.attack(enemy);
        }
    } else {
        hero.shield();
    }
}

```

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 11:08am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/18 "2020-07-08T11:08:28Z")

</div>

And try to check if you are low on health and you can become invisible, then cast invisibility on yourself and wait for the spell to end using the hero.wait() method.

Andrei

---

<div class="post-metadata">

**Author:** ![Naddali275](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Naddali275](https://discourse.codecombat.com/u/Naddali275)\
**Post date:** [July 8, 2020, 11:36am UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/19 "2020-07-08T11:36:02Z")

</div>

ok, here we go. I also added pet.chase, I thought the more, the better. But still not working

```python
while (true) {
    var flag = hero.findFlag();
    var enemy = hero.findNearestEnemy();
    if (flag) {
        hero.pickUpFlag(flag);
    } else if (enemy) {
        if (hero.isReady("cleave")) {
            hero.cleave(enemy);
        } else if (hero.isReady("bash")) {
            hero.bash(enemy);
        } else {
            hero.attack(enemy);
        }
        if (enemy && enemy.maxHealth < hero.maxHealth / 10) {
            pet.chase(enemy);
        }
        if (hero.health < hero.maxHealth / 3) {
            hero.cast("invisibility", hero);
            hero.wait(hero.cast("invisibility", hero));
        } else {
            hero.shield();
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 8, 2020, 12:38pm UTC](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848/20 "2020-07-08T12:38:03Z")

</div>

> [@Naddali275](#):
>
> `hero.wait(hero.cast("invisibility", hero));`

Here you should wait a number of seconds. And try to only cast invisibility before you move to pick up the flag, so you can delete this

> [@Naddali275](#):
>
> ```python
> if (hero.health < hero.maxHealth / 3) {
> hero.cast("invisibility", hero);
> hero.wait(hero.cast("invisibility", hero));
> 
> ```

And before you cast the invisibility check if hero.canCast(the name of the spell that you want to cast) is true, and only then cast the spell. Do you understand, @Naddali275 ?

Andrei

[Next page](https://discourse.codecombat.com/t/solved-doom-glade-cant-finish-level/22848.md?page=2)
