From 65db64d3df539ca3e80636d02ace5aca5db5a5be Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 16 May 2024 19:41:06 -0500 Subject: [PATCH] null spam fix for hamlet guards --- src/engine/mobileAI/MobAI.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 9391ce6f..acb240a5 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -99,7 +99,10 @@ public class MobAI { public static void attackPlayer(Mob mob, PlayerCharacter target) { try { - + if(target == null || !target.isAlive() || !target.isActive() ) { + mob.setCombatTarget(null); + return; + } if (!mob.canSee(target)) { mob.setCombatTarget(null); return; @@ -121,7 +124,7 @@ public class MobAI { if (mob.isMoving() && mob.getRange() > 20) return; - CombatManager.combatCycle(mob, mob.combatTarget); + CombatManager.combatCycle(mob, target); } if (target.getPet() != null)