# Follow me on youtube channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q
# The function find the weakest enemy.
def findWeakestEnemy():
enemies = hero.findEnemies()
weakest = None
leastHealth = 99999
enemyIndex = 0
# Loop through enemies:
for enemy in enemies:
# If an enemy's health is less than leastHealth:
if enemy.health<leastHealth:
# Make it the weakest
weakest=enemy
# and set leastHealth to its health.
leastHealth=enemy.health
return weakest
while True:
# Find the weakest enemy with the function:
weakestShaman = findWeakestEnemy()
# If the weakest enemy here:
if weakestShaman:
# Attack it!
hero.attack(weakestShaman)