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 { @@ -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

Loading…
Cancel
Save