mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-24 06:01:26 -05:00
Add clarifying comments for what targeted does
This commit is contained in:
+6
-1
@@ -8594,10 +8594,13 @@ function init_io() {
|
|||||||
// Only look at the first 16 targets in the array if more are provided
|
// Only look at the first 16 targets in the array if more are provided
|
||||||
for (const t of data.targets.slice(0, 16)) {
|
for (const t of data.targets.slice(0, 16)) {
|
||||||
const id = t[0];
|
const id = t[0];
|
||||||
|
|
||||||
|
// Prevent attacking the same entity twice
|
||||||
if (targeted[id]) {
|
if (targeted[id]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
targeted[id] = true;
|
targeted[id] = true;
|
||||||
|
|
||||||
const mp = max(0, parseInt(t[1]) || 0);
|
const mp = max(0, parseInt(t[1]) || 0);
|
||||||
if (mp <= 0) {
|
if (mp <= 0) {
|
||||||
continue;
|
continue;
|
||||||
@@ -8678,15 +8681,17 @@ function init_io() {
|
|||||||
if (is_array(data.ids)) {
|
if (is_array(data.ids)) {
|
||||||
// Only look at the first Xshot targets in the array if more are provided
|
// Only look at the first Xshot targets in the array if more are provided
|
||||||
for (const id of data.ids.slice(0, data.name === "5shot" ? 5 : 3)) {
|
for (const id of data.ids.slice(0, data.name === "5shot" ? 5 : 3)) {
|
||||||
|
// Prevent attacking the same entity twice
|
||||||
if (targeted[id]) {
|
if (targeted[id]) {
|
||||||
// Already targeted this monster
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
targeted[id] = true;
|
targeted[id] = true;
|
||||||
|
|
||||||
target = instances[player.in].monsters[id];
|
target = instances[player.in].monsters[id];
|
||||||
if (!target) {
|
if (!target) {
|
||||||
target = instances[player.in].players[id];
|
target = instances[player.in].players[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target || is_invinc(target) || target.name == player.name) {
|
if (!target || is_invinc(target) || target.name == player.name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user