From 283ae37919ec704e14fd6aa19c15000d6071647d Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 11 May 2024 18:18:28 -0500 Subject: [PATCH] mob aggro issue --- src/engine/mobileAI/MobAI.java | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index a0426213..314f564a 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -1193,26 +1193,32 @@ public class MobAI { try { - //check for players that can be aggroed if mob is agressive and has no target - - if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) - mob.setCombatTarget(null); + if(mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ + PlayerCharacter tar = (PlayerCharacter)mob.combatTarget; + if (mob.canSee(tar) == false) { + mob.setCombatTarget(null); + } + } if (mob.behaviourType.isAgressive) { - AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); + //AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); + + //if (newTarget != null) + // mob.setCombatTarget(newTarget); + //else { - if (newTarget != null) - mob.setCombatTarget(newTarget); - else { if (mob.getCombatTarget() == null) { - if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard) + if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard) { SafeGuardAggro(mob); //safehold guard - else + }else { CheckForAggro(mob); //normal aggro + if(mob.combatTarget == null) + SafeGuardAggro(mob); // look for pets if no players to aggro + } } } - } + //} //check if mob can move for patrol or moving to target