here is my code i have rune sword and iron armor leather boots
while True:
enemy = hero.findNearestEnemy()
if hero.health < 10:
hero.say("ouch")
pass
else:
if hero.distanceTo(enemy) < 3:
if enemy.type == "thrower" or enemy.type == "ogre":
hero.attack(enemy)
There are plenty of ways to play this level, that is what makes it fun and challenging. A few things to think about with your code so far.
At this point, you are only attacking two types of enemies and allowing the other types to attack you without any defense or counter attack. Also, the throwers don’t usually get close to you so your combination of distance less than three and thrower type will likely prevent you from attacking the thrower type.
if hero.distanceTo(enemy) < 3:
if enemy.type == "thrower" or enemy.type == "ogre":
What hero are you using and what other gear do you have?
I am using Tharin with the Quartz sense stone, mahogany glasses, dynamic flags, crude spike, workers glove, simple wristwatch, progamantion III, leather boots and just purchased emperor’s gloves
You may want to switch from using hero.findNearestEnemy() to hero.findEnemies() to get an array of all the enemies and you can run through them with a ‘for’ loop so you don’t get stuck on one enemy. As you run through the for loop you can check what type of enemy and determine which one you want to attack. Below is a modified version of your original code using the enemies array. Don’t forget the while True: at the beginning.
enemies = hero.findEnemies()
for enemy in enemies:
if hero.distanceTo(enemy) < 3:
hero.attack(enemy)
elif enemy.type == "thrower" or enemy.type == "ogre":
hero.attack(enemy)
while True:
enemies = hero.findEnemies
enemy = hero.findNearestEnemy()
if enemy:
for enemy in enemies:
if hero.distanceTo(enemy) < 5:
hero.attack(enemy)
elif enemy.type == "thrower" or enemy.type == "ogre":
hero.attack(enemy)
while True:
enemies = hero.findEnemies
boss = hero.findNearestEnemy()
if boss:
for boss in enemies:
if hero.distanceTo(boss) < 5:
hero.attack(boss)
elif enemy.type == "thrower" or enemy.type == "ogre":
hero.attack(boss)
is what i tried because it sounded like what you said but still didn’t work