Quote:
function getTarget() {
temp.bestTarget = null;
temp.bestValue = 0;
for (temp.pl: findnearestplayers(this.x, this.y)) {
temp.pIds = temp.pl.account;
}
//temp.pIds = getnearestplayers(this.x, this.y, player.hp > 0);
for (temp.pId: pIds) {
temp.pl = players[pId];
temp.dx = pl.x - this.x;
temp.dy = pl.y - this.y;
//temp.distance = abs(dx) + abs(dy); // manhattan distance
temp.distance = (dx * dx + dy * dy) ^ 0.5; // Euclidean distance
//pl.chat = distance @ " " @ dx @ " " @ dy;
// Ensure the following are true:
// within maximum distance, in front of us, and not behind a wall
if (distance > this.maxdist) {
continue;
}
|
Here is the part of the code im having issues with.