while True:
enemy = hero.findNearestEnemy()
if enemy:
if enemy.type != "burl" or "thrower" < 15:
hero.attack(enemy)
item = hero.findNearestItem()
if item:
if item.type != "gem" or "mushroom" < 15:
hero.moveXY(item.pos.x, item.pos.y)
I forgot to put in hero.distance
This is my code now but I still get hit by lightning:
while True:
enemy = hero.findNearestEnemy()
if enemy:
if enemy.type != "burl" or "thrower":
if hero.distanceTo(enemy) < 15:
hero.attack(enemy)
item = hero.findNearestItem()
if item:
if item.type != "gem" or "mushroom" :
if hero.distanceTo(item) < 15:
hero.moveXY(item.pos.x, item.pos.y)