Hello all, I have an issue trying to do something that is not necessary at this level, but I would like to accomplish it anyway.
That is to do the same objectives but also beating the burl.
The problem is that I made a code to beat the burl but when I run it, the normal code to beat the level stops working normally, it does what is supposed to do for some seconds and then it just stops.
Could you help me pass this in my own personal difficulty?
Here are some screenshots about the level/code/inventory:
# Ogres are attacking a nearby settlement!
# Be careful, though, for the ogres have sown the ground with poison.
# Gather coins and defeat the ogres, but avoid the burls and poison!
while True:
enemy = hero.findNearestEnemy()
if enemy.type == "munchkin" or enemy.type == "thrower":
hero.attack(enemy)
if enemy.type == "burl":
enemyPosition = enemy.pos
if hero.isReady("shadow-vortex"):
hero.shadowVortex(enemy.pos, [43, 13])
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.moveXY(52, 25)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.moveXY(22, 20)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.moveXY(6, 7)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
item = hero.findNearestItem()
if item:
itemPosition = item.pos
itemX = itemPosition.x
itemY = itemPosition.y
# Check the item type to make sure the hero doesn't pick up poison!
# If the item's type is "gem" or "coin":
if item.type == "gem" or item.type == "coin":
# Then move and pick it up:
hero.moveXY(itemX, itemY)
When I input one attack per location vs the burl what happens is that it just attacks once an then move to the next location and that is not effective. With my current weapon I need to attack him 20 times if I want to kill him, so I need to kite the maximun possible times between the locations so I avoid being killed by him.
Delete the if enemy.type == ‘burl’ and everything inside it.
you want to check if there’s enemy when you are attacking. if enemy.type == "munchkin" or enemy.type == "thrower": is not enough. It only checks enemy’s type and not existence.
Hello, Code Master, I understand that what you are trying to tell me to do is the original objective of the level, but I told that I also wanted to beat the burl
But I can say that what you said about that I need to check if there is an enemy is indeed what I was lacking in my code in order to beat the burl and the level, so thank you!