My code works at the start but then it just falls apart!
def cleaveWhenClose(target):
if hero.distanceTo(target) < 5:
pass
ready = hero.isReady(“cleave”)
hero.cleave(enemy)
=
else:
hero.attack(enemy)
while True:
enemy = hero.findNearestEnemy()
if enemy:
# Note that inside cleaveWhenClose, we refer to the enemy as target.
cleaveWhenClose(enemy)