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)
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.
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…
@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? I will look at your game replay and try to find a problem.
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 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.
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
# 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)