// Defeat as many ogres as you can.
// Use 'cast' and 'canCast' for spells.
hero.moveXY(4, 31);
var catapultsKilled = 0;
while(true) {
var enemy = hero.findNearestEnemy();
var catapult = hero.findNearest(hero.findByType("catapult"));
if (catapult) {
if (catapultsKilled === 0) {
hero.moveXY(10, 37);
}
else {
hero.cast("lightning-bolt", catapult);
}
}
else if (enemy) {
if (hero.canCast("chain-lightning")) {
hero.cast("chain-lightning", enemy);
}
else if (hero.canCast("root") && enemy.health == 75){
hero.cast("root", enemy);
}
else {
hero.attack(enemy);
}
}
else if (hero.health < hero.maxHealth) {
hero.moveXY(5, 45);
hero.cast("regen", hero);
}
else {
hero.moveXY(5, 45);
}
}
There you go. My code. @milton.jinich or @Deadpool198 help?