while True:
enemy = hero.findNearestEnemy()
if enemy:
if enemy.type != “peon”:
if not hero.isReady(“cleave”):
hero.attack(enemy)
else:
hero.cleave(enemy)
item = hero.findNearestItem()
if item:
    # Gather the item only if the type is NOT equal to "poison".
    if item.type != "poison":
        pos = item.pos
        x=pos.x
        y=pos.y
        hero.moveXY(x, y)
    pass
