Browse Source

mob aggro issue

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
283ae37919
  1. 28
      src/engine/mobileAI/MobAI.java

28
src/engine/mobileAI/MobAI.java

@ -1193,26 +1193,32 @@ public class MobAI {
try { try {
//check for players that can be aggroed if mob is agressive and has no target if(mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
PlayerCharacter tar = (PlayerCharacter)mob.combatTarget;
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) if (mob.canSee(tar) == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
}
}
if (mob.behaviourType.isAgressive) { 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.getCombatTarget() == null) {
if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard) if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard) {
SafeGuardAggro(mob); //safehold guard SafeGuardAggro(mob); //safehold guard
else }else {
CheckForAggro(mob); //normal aggro 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 //check if mob can move for patrol or moving to target

Loading…
Cancel
Save