Should I use something else. Help me please.
// Don't worry about small and medium-sized ogres.
// Your targets are type "brawler".
// When a "brawler" is closer than 50m, fire artillery.
while (true) {
// Find the nearest enemy and the distance to it.
var enemy = hero.findNearestEnemy();
var distance = hero.distanceTo(enemy);
if (enemy.type == "brawler" && distance < 50)
{
hero.say("Fire!");
}
}
// If the enemy's type is "brawler"
// AND the distance to it is less than 50 meters,
// Then say "Fire!" to signal the artillery.