// Attack munchkins, call brawlers and ignore burls.
// This function defines the hero's behaviour about enemies.
function dealEnemy(enemy) {
// If enemy.type is "munchkin":
if (enemy.type == "munchkins") {
hero.attack(enemy);
} // Then attack it:
// If the enemy's type is "brawler":
else if (enemy.type == "brawler") {
hero.say("hello");
} // Then say something to call the brawler:
}
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
dealEnemy(enemy);
} else {
hero.moveXY(30, 34);
}
}
I seemed to do what the comments say and get no errors but the hero does nothing!
Thanks