hello!
this is my code
while (true) {
var flag = hero.findFlag();
var enemy = hero.findNearestEnemy();
if (flag) {
// hero.say("Maybe I should do something with that flag?");
var greenFlag = hero.findFlag("green");
if (greenFlag) {
hero.pickUpFlag(greenFlag);
}
} else {
// hero.say("I'm bored.");
if (enemy) {
var distance = hero.distanceTo(enemy);
if (distance < 10) {
if (hero.isReady("cleave")) {
hero.cleave(enemy);
} else {
hero.attack(enemy);
if (hero.findFriends().length > 5) {
hero.shield();
}
}
}
}
}
}
but |I can't pass this level, I can't kill all ogres, they are too srong, please help me