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