From 6e255d9c75071d3636cefd7a5fe0586b49f4f719 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 8 Aug 2023 11:51:04 -0500 Subject: [PATCH] guards hate value change target --- src/engine/devcmd/cmds/aiInfoCmd.java | 2 +- src/engine/mobileAI/MobAI.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/engine/devcmd/cmds/aiInfoCmd.java b/src/engine/devcmd/cmds/aiInfoCmd.java index 1caf90c9..e31060bb 100644 --- a/src/engine/devcmd/cmds/aiInfoCmd.java +++ b/src/engine/devcmd/cmds/aiInfoCmd.java @@ -77,7 +77,7 @@ public class aiInfoCmd extends AbstractDevCmd { output += "Players Loaded:" + newline; } for (Map.Entry entry : mob.playerAgroMap.entrySet()) { - output += "Player ID: " + entry.getKey() + " Hate Value: " + ((PlayerCharacter) mob.getCombatTarget()).getHateValue() + newline; + output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline; } if (mob.getCombatTarget() != null) output += "Current Target: " + mob.getCombatTarget().getName() + newline; diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 76c143d1..6be7f853 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -1073,7 +1073,13 @@ public class MobAI { try { if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) { - CheckForPlayerGuardAggro(mob); + if(mob.getCombatTarget() == null) { + CheckForPlayerGuardAggro(mob); + }else { + AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); + if (newTarget != null) + mob.setCombatTarget(newTarget); + } }else { if (mob.npcOwner.getCombatTarget() != null) mob.setCombatTarget(mob.npcOwner.getCombatTarget());