From fc3ca3b814e51c6a14ef6560b3002585683e23ce Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 25 Jun 2023 19:44:27 -0500 Subject: [PATCH] null target check for mobs --- src/engine/ai/MobileFSM.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index fb8bc63c..3925948c 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -467,6 +467,9 @@ public class MobileFSM { //checks if mob can attack based on attack timer and range if (mob.isAlive() == false) return; + if(mob.getCombatTarget() == null){ + return; + } if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter)mob.getCombatTarget()) == false) { mob.setCombatTarget(null); if (mob.isCombat()) { @@ -560,8 +563,7 @@ public class MobileFSM { if (mob.getCombatTarget() == null) CheckForPlayerGuardAggro(mob); CheckMobMovement(mob); - if (mob.getCombatTarget() != null) - CheckForAttack(mob); + CheckForAttack(mob); } public static void GuardMinionLogic(Mob mob) { if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) { @@ -572,8 +574,7 @@ public class MobileFSM { else mob.setCombatTarget(null); CheckMobMovement(mob); - if (mob.getCombatTarget() != null) - CheckForAttack(mob); + CheckForAttack(mob); } public static void GuardWallArcherLogic(Mob mob) { if (mob.getCombatTarget() == null) @@ -586,7 +587,6 @@ public class MobileFSM { mob.setCombatTarget(null); if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam) CheckMobMovement(mob); - if (mob.getCombatTarget() != null) CheckForAttack(mob); } private static void HamletGuardLogic(Mob mob) { @@ -598,7 +598,6 @@ public class MobileFSM { SafeGuardAggro(mob); } } - if (mob.getCombatTarget() != null) CheckForAttack(mob); } private static void DefaultLogic(Mob mob) {