From d673c329b65ee2b069f1fde327c16a4f0b650c2c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 28 May 2023 10:55:11 -0500 Subject: [PATCH] hamlet guards + mobs aggro before going home --- src/engine/ai/MobileFSM.java | 3 ++- src/engine/ai/utilities/MovementUtilities.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index a76f6c7a..548af950 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -466,7 +466,7 @@ public class MobileFSM { //checks if mob can attack based on attack timer and range if (mob.isAlive() == false) return; - if (MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false) { + if (MovementUtilities.inRangeDropAggro(mob, (AbstractCharacter)mob.getCombatTarget()) == false) { mob.setCombatTarget(null); if (mob.isCombat()) { mob.setCombat(false); @@ -486,6 +486,7 @@ public class MobileFSM { AttackTarget(mob, mob.getCombatTarget()); } private static void CheckToSendMobHome(Mob mob) { + CheckForAggro(mob); if(mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob,mob.getCombatTarget(),MBServerStatics.AI_BASE_AGGRO_RANGE * 0.5f)){ return; } diff --git a/src/engine/ai/utilities/MovementUtilities.java b/src/engine/ai/utilities/MovementUtilities.java index 77a6858e..b244d355 100644 --- a/src/engine/ai/utilities/MovementUtilities.java +++ b/src/engine/ai/utilities/MovementUtilities.java @@ -98,7 +98,7 @@ public class MovementUtilities { } - public static boolean inRangeDropAggro(Mob agent, PlayerCharacter target) { + public static boolean inRangeDropAggro(Mob agent, AbstractCharacter target) { Vector3fImmutable sl = agent.getLoc(); Vector3fImmutable tl = target.getLoc();