From 972805b6531804e2c17168d5dfc3187d1f20d865 Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:14:02 -0400 Subject: [PATCH] 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. --- node/server.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/node/server.js b/node/server.js index 6d10f43..ae1ba51 100644 --- a/node/server.js +++ b/node/server.js @@ -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]); } }