From d6a35a577be4dd71878647101fc175633b743af5 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 7 May 2023 12:15:38 -0500 Subject: [PATCH] mobs use hate value to hot swap targets --- src/engine/ai/MobileFSM.java | 6 ++++++ 1 file changed, 6 insertions(+) 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;