pls help me I have been trying to beat this level for days here is my code:
hero.moveXY(65, 66)
while True:
enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)
if enemy.type=="soldier" or enemy.type=="knight" or enemy=="scout":
if enemy:
if hero.isReady("bash"):
heor.bash(enemy)
hero.wait(1);
else:
hero.attack(enemy)
else:
if hero.health>hero.maxHealth/4:
hero.shield()
else:
hero.moveXY(42, 77)
hero.moveXY(65, 66)
while True:
enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)
if enemy.type=="soldier" or enemy.type=="knight" or enemy=="scout":
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
else:
hero.attack(enemy)
else:
if hero.health>hero.maxHealth/4:
hero.shield()
else:
hero.moveXY(42, 77)
hero.moveXY(64, 70)
while True:
enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)
if enemy.type=="soldier" or enemy.type=="knight" or enemy=="scout":
if enemy:
if hero.isReady("bash"):
hero.attack(enemy)
else:
hero.cast("chain-lightning", enemy)
else:
if hero.health>hero.maxHealth/4:
hero.shield()
else:
hero.moveXY(42, 77)
In your if statement checking if you are able to bash, instead of attacking, bash your enemy with hero.bash(enemy). Next, check if your hero can cast chain-lightning, if he can then make him use chain lightning. Then add an else statement after chain-lightning and attack in the else statement, so if your cannot bash or cast chain-lightning, then he would attack. Another thing is that you should attack all enemies except if they are types sand-yaks or ogres.