# Follow me on youtube channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q
# Wait for alchemist's commands to fetch potions.
# The event handler for the pet's event "hear".
def onHear(event):
def waitingDelivery(event):
potion = pet.findNearestByType("potion")
if event.message == 'Fetch':
pet.fetch(potion)
else:
pet.moveXY(55, 35)
pet.on("hear", waitingDelivery)
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
else:
hero.moveXY(40, 35)