Browse Source

CanAggro check added to guard logic.

master
MagicBot 1 year ago
parent
commit
64ca876920
  1. 28
      src/engine/mobileAI/MobAI.java

28
src/engine/mobileAI/MobAI.java

@ -20,7 +20,6 @@ import engine.mobileAI.utilities.MovementUtilities;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.msg.PerformActionMsg; import engine.net.client.msg.PerformActionMsg;
import engine.net.client.msg.PowerProjectileMsg; import engine.net.client.msg.PowerProjectileMsg;
import engine.net.client.msg.UpdateStateMsg;
import engine.objects.*; import engine.objects.*;
import engine.powers.ActionsBase; import engine.powers.ActionsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
@ -1024,10 +1023,19 @@ public class MobAI {
try { try {
if (mob.getCombatTarget() == null) if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
if (newTarget != null) if (newTarget != null) {
mob.setCombatTarget(newTarget);
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
mob.setCombatTarget(newTarget);
} else
mob.setCombatTarget(newTarget);
}
CheckMobMovement(mob); CheckMobMovement(mob);
CheckForAttack(mob); CheckForAttack(mob);
} catch (Exception e) { } catch (Exception e) {
@ -1039,12 +1047,22 @@ public class MobAI {
try { try {
if (!mob.npcOwner.isAlive()) { if (!mob.npcOwner.isAlive()) {
if(mob.getCombatTarget() == null) { if(mob.getCombatTarget() == null) {
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
}else { }else {
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
if (newTarget != null)
mob.setCombatTarget(newTarget); if (newTarget != null) {
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
mob.setCombatTarget(newTarget);
} else
mob.setCombatTarget(newTarget);
}
} }
}else { }else {
if (mob.npcOwner.getCombatTarget() != null) if (mob.npcOwner.getCombatTarget() != null)

Loading…
Cancel
Save