Browse Source

Start consolidation of guard logic

feature-workorder
MagicBot 1 year ago
parent
commit
e711095ecd
  1. 48
      src/engine/mobileAI/MobAI.java

48
src/engine/mobileAI/MobAI.java

@ -609,10 +609,10 @@ public class MobAI {
switch (mob.behaviourType) { switch (mob.behaviourType) {
case GuardCaptain: case GuardCaptain:
GuardCaptainLogic(mob); GuardLogic(mob);
break; break;
case GuardMinion: case GuardMinion:
GuardMinionLogic(mob); GuardLogic(mob);
break; break;
case GuardWallArcher: case GuardWallArcher:
GuardWallArcherLogic(mob); GuardWallArcherLogic(mob);
@ -682,7 +682,6 @@ public class MobAI {
aiAgent.setCombatTarget(loadedPlayer); aiAgent.setCombatTarget(loadedPlayer);
return; return;
} }
} }
if (aiAgent.getCombatTarget() == null) { if (aiAgent.getCombatTarget() == null) {
@ -721,16 +720,13 @@ public class MobAI {
case Pet1: case Pet1:
if (mob.guardCaptain == null) if (mob.guardCaptain == null)
return; return;
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) { if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
//mob no longer has its owner loaded, translocate pet to owner //mob no longer has its owner loaded, translocate pet to owner
MovementManager.translocate(mob, mob.guardCaptain.getLoc(), null); MovementManager.translocate(mob, mob.guardCaptain.getLoc(), null);
return; return;
} }
@ -738,25 +734,14 @@ public class MobAI {
//move back to owner //move back to owner
if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6)) if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6))
return; return;
mob.destination = mob.guardCaptain.getLoc(); mob.destination = mob.guardCaptain.getLoc();
MovementUtilities.moveToLocation(mob, mob.destination, 5); MovementUtilities.moveToLocation(mob, mob.destination, 5);
} else } else
chaseTarget(mob); chaseTarget(mob);
break; break;
case GuardMinion:
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned)
randomGuardPatrolPoint(mob);
else {
if (mob.getCombatTarget() != null) {
chaseTarget(mob);
}
}
break;
default: default:
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
if (!mob.isMoving()) if (!mob.isMoving())
@ -970,7 +955,7 @@ public class MobAI {
} }
} }
public static void GuardCaptainLogic(Mob mob) { public static void GuardLogic(Mob mob) {
try { try {
if (mob.getCombatTarget() == null) if (mob.getCombatTarget() == null)
@ -995,32 +980,6 @@ public class MobAI {
} }
} }
public static void GuardMinionLogic(Mob mob) {
try {
if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob);
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
if (newTarget != null) {
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
mob.setCombatTarget(newTarget);
} else
mob.setCombatTarget(newTarget);
}
CheckMobMovement(mob);
CheckForAttack(mob);
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
}
}
public static void GuardWallArcherLogic(Mob mob) { public static void GuardWallArcherLogic(Mob mob) {
try { try {
@ -1037,7 +996,6 @@ public class MobAI {
try { try {
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false) if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob)) if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
mob.killCharacter("no owner"); mob.killCharacter("no owner");

Loading…
Cancel
Save