From 64ca876920e18bc7ca3d93a6c6957f1ae7658185 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 8 Aug 2023 19:08:51 -0400 Subject: [PATCH] CanAggro check added to guard logic. --- src/engine/mobileAI/MobAI.java | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 0cb34cca..a54ea968 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -20,7 +20,6 @@ import engine.mobileAI.utilities.MovementUtilities; import engine.net.DispatchMessage; import engine.net.client.msg.PerformActionMsg; import engine.net.client.msg.PowerProjectileMsg; -import engine.net.client.msg.UpdateStateMsg; import engine.objects.*; import engine.powers.ActionsBase; import engine.powers.PowersBase; @@ -1024,10 +1023,19 @@ public class MobAI { try { if (mob.getCombatTarget() == null) CheckForPlayerGuardAggro(mob); + AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); - if (newTarget != null) - mob.setCombatTarget(newTarget); + if (newTarget != null) { + + if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { + if (GuardCanAggro(mob, (PlayerCharacter) newTarget)) + mob.setCombatTarget(newTarget); + } else + mob.setCombatTarget(newTarget); + + } + CheckMobMovement(mob); CheckForAttack(mob); } catch (Exception e) { @@ -1039,12 +1047,22 @@ public class MobAI { try { if (!mob.npcOwner.isAlive()) { + if(mob.getCombatTarget() == null) { CheckForPlayerGuardAggro(mob); }else { + AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); - if (newTarget != null) - mob.setCombatTarget(newTarget); + + if (newTarget != null) { + + if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { + if (GuardCanAggro(mob, (PlayerCharacter) newTarget)) + mob.setCombatTarget(newTarget); + } else + mob.setCombatTarget(newTarget); + + } } }else { if (mob.npcOwner.getCombatTarget() != null)