# Follow me on youtube channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q
# Your pet can help you survive until you can escape.
def onHear(event):
# event.message contains the text that was heard.
# If somebody said "Fire"
if event.message == "Fire":
# Move to the bottom X mark with pet.moveXY()
pet.moveXY(64,16)
# Say something with pet.say()
pet.say("Take it")
pass
# If somebody said "Heal"
elif event.message == "Heal":
# Move to the top X mark with pet.moveXY()
pet.moveXY(63,53)
# Say something with pet.say()
pet.say(" You will be alive")
pass
pet.on("hear", onHear)
# You don't have to change the code below.
while True:
enemy = hero.findNearestEnemy()
if enemy:
# If an enemy is too strong.
if enemy.type == "brawler":
hero.say("Fire")
else:
hero.attack(enemy)
else:
# If your hero needs healing.
if hero.health < hero.maxHealth / 2:
hero.say("Heal")