# Can't pass cursed valley

**URL:** https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904
**Category:** Bugs
**Created:** [June 6, 2016, 11:42pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904 "2016-06-06T23:42:04Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![11145](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/11145/32/4179_2.png) [@11145](https://discourse.codecombat.com/u/11145)
#### Post date: [June 6, 2016, 11:42pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/1 "2016-06-06T23:42:04Z")

</div>

to pass this level i need to kill 3 skeletons and stay alive. But my hero just can’t stay alive until the second skeleton shows up , even though he has drunk the potion  
here’s my code:

while True:  
enemies = hero.findEnemies()  
if enemies:  
for enemy in enemies:  
if enemy.team == ‘ogres’ and enemy.type == ‘skeleton’:  
hero.attack(enemy)

```
item = hero.findNearest(hero.findItems())
if item and item.type == 'potion' and hero.health < hero.maxHealth/4:
    hero.moveXY(item.pos.x, item.pos.y)
```

---

<div class="post-metadata">

### Author: ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)
#### Post date: [June 7, 2016, 6:21am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/2 "2016-06-07T06:21:55Z")

</div>

Could you show what the equipment you are using? (just a screenshot). I will try to reproduce it.

---

<div class="post-metadata">

### Author: ![11145](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/11145/32/4179_2.png) [@11145](https://discourse.codecombat.com/u/11145)
#### Post date: [June 9, 2016, 2:02am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/3 "2016-06-09T02:02:26Z")

</div>

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex016/uploads/codecombat/original/2X/a/a8880f665eeeaa04a72ca7cd9d22dea0ca44c372.png)

Thanks

---

<div class="post-metadata">

### Author: ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)
#### Post date: [June 9, 2016, 5:49am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/5 "2016-06-09T05:49:55Z")

</div>

Are you using “chain-lightning” for that level?

---

<div class="post-metadata">

### Author: ![11145](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/11145/32/4179_2.png) [@11145](https://discourse.codecombat.com/u/11145)
#### Post date: [June 9, 2016, 10:44am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/6 "2016-06-09T10:44:46Z")

</div>

No, just hero.attack()

---

<div class="post-metadata">

### Author: ![Serg](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/serg/32/3260_2.png) [@Serg](https://discourse.codecombat.com/u/Serg)
#### Post date: [June 9, 2016, 3:55pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/7 "2016-06-09T15:55:20Z")

</div>

Hello,

can you send us an email at [team@codecombat.com](mailto:team@codecombat.com) so that we can look over your session and see what may be wrong?

---

<div class="post-metadata">

### Author: ![11145](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/11145/32/4179_2.png) [@11145](https://discourse.codecombat.com/u/11145)
#### Post date: [June 9, 2016, 8:34pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/8 "2016-06-09T20:34:13Z")

</div>

sure, thanks for your time

---

<div class="post-metadata">

### Author: ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)
#### Post date: [June 16, 2016, 2:20pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/9 "2016-06-16T14:20:31Z")

</div>

Sorry for the delay. Could you try it now? There was a problem with one of component changing and I made some rebalance things. Please tell me if you failure or success that level.

---

<div class="post-metadata">

### Author: ![ant](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ant/32/3362_2.png) [@ant](https://discourse.codecombat.com/u/ant)
#### Post date: [June 17, 2016, 6:52am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/10 "2016-06-17T06:52:39Z")

</div>

Thanks, finally it works fine.

---

<div class="post-metadata">

### Author: ![11145](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/11145/32/4179_2.png) [@11145](https://discourse.codecombat.com/u/11145)
#### Post date: [June 18, 2016, 10:48am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/11 "2016-06-18T10:48:44Z")

</div>

Thanks ,i passed it . it works fine now. but i find another problem on another level… i tell u about it in a new post

---

<div class="post-metadata">

### Author: ![AttackArmy](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AttackArmy](https://discourse.codecombat.com/u/AttackArmy)
#### Post date: [September 25, 2016, 7:07pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/12 "2016-09-25T19:07:15Z")

</div>

Maybe there’s a new bug, but I can’t pass this either. I see three skeletons get killed, but it continues anyway and eventually fails because it times out. Here’s my code…

```python
[Solution is correct, so it's removed]

```

Thanks!

---

<div class="post-metadata">

### Author: ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)
#### Post date: [September 26, 2016, 1:14pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/13 "2016-09-26T13:14:17Z")

</div>

@AttackArmy Your code looks correct and I checked it with my hero - no problems. Could you sent me with direct messages your CodeCombat username or to the email [team@codecombat.com](mailto:team@codecombat.com)? I will look at your game replay and try to find a problem.

---

<div class="post-metadata">

### Author: ![AttackArmy](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AttackArmy](https://discourse.codecombat.com/u/AttackArmy)
#### Post date: [September 26, 2016, 3:16pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/14 "2016-09-26T15:16:46Z")

</div>

Thanks for looking into it. It seemed very odd that it wasn’t completing. Here’s my user name…

---

<div class="post-metadata">

### Author: ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)
#### Post date: [September 26, 2016, 3:41pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/15 "2016-09-26T15:41:39Z")

</div>

Thanks. I see a problem, but not see where it is. Give me please some time to find it.

---

<div class="post-metadata">

### Author: ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)
#### Post date: [September 26, 2016, 4:09pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/16 "2016-09-26T16:09:36Z")

</div>

Ha! It was interesting. The “problem” was in “samurai + High tier damage sword”. As the result, your hero can kill a skeleton with one hit (411 damage in one hit). The level’s referee could not process that case.

Not it’s fixed (I changed the referee logic). Could you try it again? Please, use [the direct link](https://direct.codecombat.com/play/level/cursed-valley) if you still have the same problem.

Thank you very much for the feedback - without it some players could stuck on this level and leave.

---

<div class="post-metadata">

### Author: ![wazi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wazi/32/14115_2.png) [@wazi](https://discourse.codecombat.com/u/wazi)
#### Post date: [October 4, 2020, 10:40am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/17 "2020-10-04T10:40:34Z")

</div>

Hello I have a problem with my code or my aurmor my hero first get the potion but he will not attack the ogre’s skeleton

```python
# The hot sun is draining the hero's health!

while True:
    enemy = hero.findNearestEnemy()
    # Attack if enemy exists AND enemy.team is "ogres"
    # AND enemy.type is "skeleton"
    if enemy and enemy.team == "ogres" and enemy.type == "skeleton":
        hero.attack(enemy)
    item = hero.findNearestItem()
    # Collect if item exists AND item.type is "potion"
    # AND hero.health is less than hero.maxHealth / 4
    if item and item.type == "potion" and hero.health < hero.maxHealth / 4:    
        hero.moveXY(item.pos.x, item.pos.y)

```

---

<div class="post-metadata">

### Author: ![wazi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/wazi/32/14115_2.png) [@wazi](https://discourse.codecombat.com/u/wazi)
#### Post date: [October 4, 2020, 10:58am UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/18 "2020-10-04T10:58:43Z")

</div>

I can’t find it out 🙁 🙁

---

<div class="post-metadata">

### Author: ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)
#### Post date: [October 4, 2020, 5:02pm UTC](https://discourse.codecombat.com/t/cant-pass-cursed-valley/7904/19 "2020-10-04T17:02:16Z")

</div>

Hi wazi,

Check your code - you’re not quite following the instructions:

```python
    # AND hero.health is less than hero.maxHealth / 4

```

Jenny
