Browse Source

work on pet AI

master
FatBoy-DOTC 1 year ago
parent
commit
7dc6fece7d
  1. 17
      src/engine/ai/MobileFSM.java
  2. 2
      src/engine/powers/poweractions/CreateMobPowerAction.java

17
src/engine/ai/MobileFSM.java

@ -332,6 +332,11 @@ public class MobileFSM {
public static void DetermineAction(Mob mob) { public static void DetermineAction(Mob mob) {
if (mob == null) if (mob == null)
return; return;
//pet cleanup for errant pets
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.Pet1.ordinal() && mob.getOwner() == null && mob.isSiege() == false){
mob.despawn();
WorldGrid.removeObject(mob);
}
if (mob.despawned && mob.getMobBase().getLoadID() == 13171) { if (mob.despawned && mob.getMobBase().getLoadID() == 13171) {
//trebuchet spawn handler //trebuchet spawn handler
CheckForRespawn(mob); CheckForRespawn(mob);
@ -358,7 +363,7 @@ public class MobileFSM {
CheckForRespawn(mob); CheckForRespawn(mob);
return; return;
} }
if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false) if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
//no players loaded, no need to proceed //no players loaded, no need to proceed
return; return;
if (mob.isCombat() && mob.getCombatTarget() == null) { if (mob.isCombat() && mob.getCombatTarget() == null) {
@ -368,7 +373,9 @@ public class MobileFSM {
DispatchMessage.sendToAllInRange(mob, rwss); DispatchMessage.sendToAllInRange(mob, rwss);
} }
mob.updateLocation(); mob.updateLocation();
if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
}
if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) { if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
} }
@ -568,10 +575,10 @@ public class MobileFSM {
private static void chaseTarget(Mob mob) { private static void chaseTarget(Mob mob) {
mob.updateMovementState(); mob.updateMovementState();
if (mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) { //if (mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) {
mob.setCombatTarget(null); // mob.setCombatTarget(null);
return; // return;
} //}
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) { if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
if (mob.getRange() > 15) { if (mob.getRange() > 15) {
mob.destination = mob.getCombatTarget().getLoc(); mob.destination = mob.getCombatTarget().getLoc();

2
src/engine/powers/poweractions/CreateMobPowerAction.java

@ -155,7 +155,9 @@ public class CreateMobPowerAction extends AbstractPowerAction {
// if (mobID == 12021 || mobID == 12022) //Necro Pets // if (mobID == 12021 || mobID == 12022) //Necro Pets
// pet.setPet(owner, true); // pet.setPet(owner, true);
owner.setPet(pet); owner.setPet(pet);
if(pet.isSiege() == false) {
MovementManager.translocate(pet, owner.getLoc(), owner.region); MovementManager.translocate(pet, owner.getLoc(), owner.region);
}
PetMsg pm = new PetMsg(5, pet); PetMsg pm = new PetMsg(5, pet);
Dispatch dispatch = Dispatch.borrow(owner, pm); Dispatch dispatch = Dispatch.borrow(owner, pm);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);

Loading…
Cancel
Save