// 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.
var safe = false;
if (!safe) {
hero.moveXY(33, 10);
}
while (true) {
var paladin = hero.findNearestByType("palaidn")[0];
for (var i = 0; i < paladin.length; i++) {
var paladin = paladin[i];
var friend = hero.findFriends();
var enemy = paladin.findNearestEnemy();
if (enemy) {
hero.command(paladin, "cast", "heal", enemy);
}
var soldier = hero.findByType("soldier");
for (var i = 0; i < soldier.length; i++) {
var soldier = soldier[i];
var friend = hero.findFriends();
var enemy = soldier.findNearestEnemy();
if (enemy) {
hero.command(soldier, "attack", enemy);
}
}
var archer = hero.findNearestByType("archer");
for (var i = 0; i < archer.length; i++) {
var archer = archer[i];
var friend = hero.findFriends();
var enemy = archer.findNearestEnemy();
if (enemy) {
hero.command(archer, "attack", enemy);
}
}
}
}
This is what happens: