Blockquote #That’s a big’un! With some clever thinking, Ivy should be able to take care of this situation single-handedly.
while True:
# Find Ivy.
Ivy = hero.findNearest(hero.findFriends())
enemy = hero.findNearest(hero.findEnemies())
# Tell Ivy to attack the enemy!
if Ivy and enemy:
hero.command(Ivy, “attack”, enemy)
# Wait, no, that doesn’t work that well. Maybe try something else?
# The munchkin is awfully slow…
if enemy.health <= 200:
hero.command(Ivy, “move”, {‘x’:19, ‘y’:13})
while True:
hero.command(Ivy, “attack”, enemy)
# That's a big'un! With some clever thinking, Ivy should be able to take care of this situation single-handedly.
while True:
# Find Ivy.
Ivy = hero.findNearest(hero.findFriends())
enemy = hero.findNearest(hero.findEnemies())
# Tell Ivy to attack the enemy!
if Ivy and enemy:
hero.command(Ivy, "attack", enemy)
# Wait, no, that doesn't work that well. Maybe try something else?
# The munchkin is awfully slow...
if enemy.health <= 200:
hero.command(Ivy, "move", {'x':78, 'y':40})
while True:
hero.command(Ivy, "attack", enemy)
The power of the archer over the munchkin in the ranged attack and the speed, so try to keep her in a safe distance so the munchkin will not reach to her. And when she is in a safe distance, then attack. Do you need any help with how to write this in code?
Well, you can check the distance from the archer to the munchkin and if it is smaller than 5 command her to move to a flag (place it so she will be safe on the way and on its position) and if it is 5 or bigger, just attack the munchkin. Do you need any more assistance at this level?