diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 4be1cf98..9d8e2923 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -715,9 +715,15 @@ public class MobileFSM { } public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob){ float CurrentHateValue = 0; + if(mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ + CurrentHateValue = ((PlayerCharacter)mob.getCombatTarget()).getHateValue(); + } AbstractWorldObject mostHatedTarget = null; for (Entry playerEntry : mob.playerAgroMap.entrySet()) { PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int)playerEntry.getKey()); + if(potentialTarget.equals(mob.getCombatTarget())){ + continue; + } if(potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue){ CurrentHateValue = potentialTarget.getHateValue(); mostHatedTarget = potentialTarget;