I have the following code, but it says that there is an unmatched bracket somewhere. It also will not run.
// Help your friends beat the minions that Thoktar sends against you.
// You'll need great equipment and strategy to win.
// Flags might help, but it's up to you–be creative!
// There is a doctor behind the fence. Move to the X to get healed!
loop {
var enemy = this.findNearest(this.findEnemies());
var flag = this.findFlag();
var hp = this.health;
var distance = this.distanceTo(enemy);
if (flag){
this.pickUpFlag(flag);
} else if (enemy){
if (distance < 15){
this.attack(enemy);
if (this.isReady("cleave")){
this.cleave(enemy);
} else {
this.shield();
}
}
if (hp < 150){
this.moveXY(19, 69);
}
}
SOLVED BY:
loop {
var enemy = this.findNearest(this.findEnemies());
var flag = this.findFlag();
var hp = this.health;
if (flag){
this.pickUpFlag(flag);
} else if (enemy){
var distance = this.distanceTo(enemy);
if (distance < 15){
this.attack(enemy);
if (this.isReady("cleave")){
this.cleave(enemy);
} else {
this.shield();
}
}
if (hp < 150){
this.moveXY(19, 69);
}
}
}