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 { @@ -609,10 +609,10 @@ public class MobAI {
switch (mob.behaviourType) {
case GuardCaptain:
GuardCaptainLogic(mob);
GuardLogic(mob);
break;
case GuardMinion:
GuardMinionLogic(mob);
GuardLogic(mob);
break;
case GuardWallArcher:
GuardWallArcherLogic(mob);
@ -682,7 +682,6 @@ public class MobAI { @@ -682,7 +682,6 @@ public class MobAI {
aiAgent.setCombatTarget(loadedPlayer);
return;
}
}
if (aiAgent.getCombatTarget() == null) {
@ -721,16 +720,13 @@ public class MobAI { @@ -721,16 +720,13 @@ public class MobAI {
case Pet1:
if (mob.guardCaptain == null)
return;
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
//mob no longer has its owner loaded, translocate pet to owner
MovementManager.translocate(mob, mob.guardCaptain.getLoc(), null);
return;
}
@ -738,25 +734,14 @@ public class MobAI { @@ -738,25 +734,14 @@ public class MobAI {
//move back to owner
if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6))
return;
mob.destination = mob.guardCaptain.getLoc();
MovementUtilities.moveToLocation(mob, mob.destination, 5);
} else
chaseTarget(mob);
break;
case GuardMinion:
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned)
randomGuardPatrolPoint(mob);
else {
if (mob.getCombatTarget() != null) {
chaseTarget(mob);
}
}
break;
default:
if (mob.getCombatTarget() == null) {
if (!mob.isMoving())
@ -970,7 +955,7 @@ public class MobAI { @@ -970,7 +955,7 @@ public class MobAI {
}
}
public static void GuardCaptainLogic(Mob mob) {
public static void GuardLogic(Mob mob) {
try {
if (mob.getCombatTarget() == null)
@ -995,32 +980,6 @@ public class MobAI { @@ -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) {
try {
@ -1037,7 +996,6 @@ public class MobAI { @@ -1037,7 +996,6 @@ public class MobAI {
try {
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
mob.killCharacter("no owner");

Loading…
Cancel
Save