Move avoidance check so that blast doesn't trigger it regardless of range (#144)

Prior to this fix, mobs with Avoidance would trigger their avoid even if they were outside of the range of the blast.
This commit is contained in:
FreezePhoenix
2024-08-13 17:14:02 +02:00
committed by GitHub
parent 28bba1ce52
commit 972805b653
+9 -9
View File
@@ -3308,16 +3308,16 @@ function complete_attack(attacker, target, info) {
if (attacker.is_player) {
for (var id in instances[target.in].monsters) {
var target = instances[target.in].monsters[id];
if (target.avoidance && Math.random() * 100 < target.avoidance) {
xy_emit(
info.action,
"hit",
{ pid: def.pid, hid: attacker.id, id: target.id, damage: 0, miss: true, source: def.source },
attacker.id,
);
continue;
}
if (target.id != otarget.id && distance(target, otarget) < radius) {
if (target.avoidance && Math.random() * 100 < target.avoidance) {
xy_emit(
info.action,
"hit",
{ pid: def.pid, hid: attacker.id, id: target.id, damage: 0, miss: true, source: def.source },
attacker.id,
);
continue;
}
targets.push([target, "splash", (damage_multiplier(target[defense] || 0) * intensity) / 100.0]);
}
}