Browse Source

null target check for mobs

master
FatBoy-DOTC 2 years ago
parent
commit
fc3ca3b814
  1. 7
      src/engine/ai/MobileFSM.java

7
src/engine/ai/MobileFSM.java

@ -467,6 +467,9 @@ public class MobileFSM {
//checks if mob can attack based on attack timer and range //checks if mob can attack based on attack timer and range
if (mob.isAlive() == false) if (mob.isAlive() == false)
return; return;
if(mob.getCombatTarget() == null){
return;
}
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter)mob.getCombatTarget()) == false) { if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter)mob.getCombatTarget()) == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
if (mob.isCombat()) { if (mob.isCombat()) {
@ -560,7 +563,6 @@ public class MobileFSM {
if (mob.getCombatTarget() == null) if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
CheckMobMovement(mob); CheckMobMovement(mob);
if (mob.getCombatTarget() != null)
CheckForAttack(mob); CheckForAttack(mob);
} }
public static void GuardMinionLogic(Mob mob) { public static void GuardMinionLogic(Mob mob) {
@ -572,7 +574,6 @@ public class MobileFSM {
else else
mob.setCombatTarget(null); mob.setCombatTarget(null);
CheckMobMovement(mob); CheckMobMovement(mob);
if (mob.getCombatTarget() != null)
CheckForAttack(mob); CheckForAttack(mob);
} }
public static void GuardWallArcherLogic(Mob mob) { public static void GuardWallArcherLogic(Mob mob) {
@ -586,7 +587,6 @@ public class MobileFSM {
mob.setCombatTarget(null); mob.setCombatTarget(null);
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam) if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
CheckMobMovement(mob); CheckMobMovement(mob);
if (mob.getCombatTarget() != null)
CheckForAttack(mob); CheckForAttack(mob);
} }
private static void HamletGuardLogic(Mob mob) { private static void HamletGuardLogic(Mob mob) {
@ -598,7 +598,6 @@ public class MobileFSM {
SafeGuardAggro(mob); SafeGuardAggro(mob);
} }
} }
if (mob.getCombatTarget() != null)
CheckForAttack(mob); CheckForAttack(mob);
} }
private static void DefaultLogic(Mob mob) { private static void DefaultLogic(Mob mob) {

Loading…
Cancel
Save