I get a success but that is not my problem my problem is that if I comment this out: this.say(oasisGuardianDefeated);
Its at the bottom of the code. The code stops working, the champ just stands still and does nothing after defeating the first guardian. I have no idea why, I dont know if its my code or a bug.
This is my code:
// This level is intended to be for advanced players. The solution should be pretty complex with a lot of moving parts. It might also be a bit of a gear check unless you use "creative" methods.
// You need to make your way to the first trial (Oasis of Marr) killing enemies along the way. When you reach it, pick all the mushrooms to trigger the trial to begin. If you survive the onslaught, make your way to the next Oasis for the second trial, then the Temple. When all trials are complete you will have to face the final boss. Good luck!
// HINT: Glasses with a high visual range help tremendously on this level so buy the best you can get
self = this;
function oasisBossCheck ()
{
if (enemy.type == 'ogre')
{
if (enemy.health <= 0)
{
oasisGuardianDefeated++;
}
}
}
function oracleOfThaCheck ()
{
if (enemy)
{
if (enemy == 'Oracle-of-Zha')
{
if (enemy.health <= 0)
{
oracleOfThaDefeated++;
this.say("oracleOfThaDefeated");
}
}
}
}
var oasisGuardianDefeated = 0;
var oracleOfThaDefeated = 0;
loop
{
var enemiesAry = this.findEnemies();
var enemiesAryPos = 0;
var moreThan5Enemies = 0;
enemy = this.findNearest(this.findEnemies());
/* enable for cleave
for(i = 0; i <= enemiesAry.length; i++)
{
if (enemy) {
var distanceToEnemy = this.distanceTo(enemy);
if (distanceToEnemy < 3)
{
moreThan5Enemies++;
}
}
} */
// attack all enemys that are close
for(i = 0; i <= enemiesAry.length; i++)
{
if (enemy)
{
if (enemy.health === 550) {
this.say(enemy.id);
}
distanceToEnemy = this.distanceTo(enemy);
if (distanceToEnemy < 20)
{
/* if (moreThan5Enemies >= 2 && this.isReady("cleave")) {
this.cleave(enemy);
cleave//moreThan5Enemies = 0;
} */
while (enemy.health > 0) {
this.attack(enemy);
}
oasisBossCheck ();
if (enemy.health === 0) {
delete enemiesAry[enemiesAryPos];
//cleave// moreThan5Enemies = 0;
}
enemiesAryPos++;
} else
{
enemiesAryPos++;
}
}
enemy = enemiesAry[enemiesAryPos];
}
// attack one enemy far away once
if (distanceToEnemy > 20)
{
enemy = this.findNearest(this.findEnemies());
if (enemy) {
this.attack(enemy);
oasisBossCheck ();
}
}
if (enemiesAryPos === 0) {
item = this.findNearest(this.findItems());
if (item)
{
this.moveXY(item.pos.x, item.pos.y);
}
}
//All enemies defeated, all items picked up, boss defeated move to next part
if (this.findEnemies().length === 0 && this.findItems().length === 0 && oasisGuardianDefeated === 1)
{
this.moveXY(10, 45);
this.moveXY(8, 98);
this.moveXY(13, 95);
oasisGuardianDefeated++;
}
//All enemies defeated, all items picked up, boss defeated move to next part
if (this.findEnemies().length === 0 && this.findItems().length === 0 && oasisGuardianDefeated === 3)
{
this.moveXY(134, 129);
oasisGuardianDefeated++;
}
//All enemies defeated, all items picked up, boss defeated move to next part
if (this.findEnemies().length === 0 && this.findItems().length === 0 && oasisGuardianDefeated === 5)
{
this.moveXY(60, 120);
this.moveXY(41, 96);
this.moveXY(95, 91);
oasisGuardianDefeated++;
}
if (this.findEnemies().length === 0 && this.findItems().length === 0 && oasisGuardianDefeated === 6)
{
oracleOfThaCheck();
}
if (this.findEnemies().length === 0 && this.findItems().length === 0 && oracleOfThaDefeated === 1)
{
this.say("I AM VICTORIOUS!!!");
break;
}
this.say(oasisGuardianDefeated);
}