This is my code so far. But it all stops when step is made 2. What am I doing wrong?
# The ogres are trapping you with their dark rituals!
# Your hero can't do anything besides command and move without angering the warlocks.
# Beware ice, robots, traps, antigravity fields, and other dark magic.
# Somehow, you'll need to defeat Nalfar and save your paladin.
# The great treasure of Kelvintaph awaits your victory.
def commandPaladin(paladin):
if hero.time >= 2:
if paladin.canCast("heal") and paladin.health < paladin.maxHealth * 0.7:
hero.command(paladin, "cast", "heal", paladin)
else:
hero.command(paladin, "shield")
def commandArcher(friend):
if step == 1:
enemy = friend.findNearestEnemy()
if enemy and enemy.type != "yeti":
hero.command(friend, "attack", enemy)
elif step == 2 and friend.id == "Mirana":
hero.command(friend, "move", {"x":9, "y":77})
elif step == 2:
hero.command(friend, "move", {"x":28, "y":49})
def commandSolider(friend):
if hero.time >= 3:
if hero.time <= 7:
hero.command(friend, "move", {"x":21, "y":73})
elif hero.time <= 9:
enemy = friend.findNearestEnemy()
if enemy and enemy.type != "yeti":
hero.command(friend, "attack", enemy)
elif hero.time == 10:
step = 2
elif step == 2:
hero.command(friend, "move", {"x":24, "y":66})
def commandAllies():
friends = hero.findFriends()
for friend in friends:
if friend.type == "paladin":
commandPaladin(friend)
elif friend.type == "archer":
commandArcher(friend)
else:
commandSolider(friend)
step = 0
hero.move({"x":32, "y":17})
#hero.cast("invisibility", hero)
while True:
if hero.time == 2.2:
step = 1
commandAllies()