This is the code i currently have:
This shows how to define a function called cleaveWhenClose
The function defines a parameter called target
if hero.distanceTo(target) < 5:
# Put your attack code here
# If cleave is ready, then cleave target
ready = hero.isReady(“cleave”)
This code is not part of the function.
enemy = hero.findNearestEnemy()
# Note that inside cleaveWhenClose, we refer to the enemy as target.