Hi, I’ve been trying lots of different things (without flag, i would like to find specifically a solution of passive win) and i feel like im starting to scrabmle lots of stuff and my brain is becoming mashed potato, pls help ^^
function killArcher() {
i = 0;
while (i < archers.length) {
archer = archers[i];
if (archer && archer.health > 0) {
hero.throw(archer);
hero.attack(archer);
}
i++;
}
}
var enemy = hero.findNearestEnemy();
var enemies = hero.findEnemies();
var archers = hero.findByType("archer", hero.findEnemies());
var self = hero.findByType("ninja");
hero.jumpTo({
x: 65,
y: 70
});
hero.moveXY(78, 70);
while (true) {
while (enemies[self] && enemies[self].health > 0) {
if (hero.isReady("chain-lightning")) {
hero.cast("chain-lightning", self);
} else {
if (hero.isReady("throw") && hero.distanceTo(self) < hero.throwRange) {
hero.throw(self);
} else {
hero.attack(self);
}
}
}
while (enemies[archers] && enemies[archers].health > 0) {
killArcher();
}
if (enemy && enemy.health > 0) {
if (hero.isReady("chain-lightning")) {
hero.cast("chain-lightning", enemy);
} else {
hero.throw(enemy);
hero.attack(enemy);
}
}
}
after passing the first enemy line for some reason hero chain lightenings the enemies behind and not focusing on self > archers> in the end only closest enemy
because gear is low & i get chop chopped fastu (I use low gear for my clone to be weak too)
hi i only now set to it again :c i think my function is not good because after the hero jumps to center and cast lightning it stops and does nothing until it dies
Javascript
function killArcher() {
i = 0;
while (i < archers.length) {
archer = archers[i];
if (archer && archer.health > 0) {
if (hero.isReady("chain-lightning")) {
hero.cast("chain-lightning", archers);
} else {
if (hero.isReady("throw") && hero.distanceTo(archer) < hero.throwRange) {
hero.throw(archer);
} else {
hero.attack(archer);
}
}
i++;
}
}}
var enemy = hero.findNearestEnemy();
var enemies = hero.findEnemies();
var archers = hero.findByType("archer", hero.findEnemies());
var self = hero.findByType("ninja");
hero.jumpTo({
x: 68,
y: 70
});
while (true) {
while (enemies[archers] && enemies[archers].health > 0) {
killArcher();
}
while (enemies[self] && enemies[self].health > 0) {
if (hero.isReady("chain-lightning")) {
hero.cast("chain-lightning", self);
} else {
if (hero.isReady("throw") && hero.distanceTo(self) < hero.throwRange) {
hero.throw(self);
} else {
hero.attack(self);
}
}
}
if (enemy && enemy.health > 0) {
if (hero.isReady("chain-lightning")) {
hero.cast("chain-lightning", enemy);
} else {
hero.throw(enemy);
hero.attack(enemy);
}
}
}
I made it, cant edit posts title for [solution] and cant edit my comments to remove code (well, dunno if needed since the final code that worked isnt here)
tyvm <3