Freezes in the start


#1

Why does it freeze when every it starts?
This is very frustrating in the level of backwoods brawl

  • I used hushbaum and it always stopped when ever I cast a magic-missile
    Oh well, heres my code:
var enemies = this.findEnemies();
for(var i = 0; i < enemies.length; ++i) {
var enemy = enemies[i];
if(enemy) {
this.attack(enemy);
if(this.canCast("magic-missile")) {
this.cast("magic-missile", enemy);
}
if(this.health < 491 && this.canCast("regen")) {
this.cast("regen", this);
}
}
}

And if I delete the return;
on the top, that happens.
But if that happens: it says 'Unreachable 'while' after 'return''
HELP!!!


#2

I haven’t used the wizards much, but maybe you are missing the target?

this.cast("magic-missile", enemy);

And in the future, please please please indent. It doesn’t seem to be the problem here as far as I can tell, but it will save you time and frustration in the future and also save you from getting chided for not indenting…


#3