Browse Source

work on pet AI

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

17
src/engine/ai/MobileFSM.java

@ -332,6 +332,11 @@ public class MobileFSM { @@ -332,6 +332,11 @@ public class MobileFSM {
public static void DetermineAction(Mob mob) {
if (mob == null)
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) {
//trebuchet spawn handler
CheckForRespawn(mob);
@ -358,7 +363,7 @@ public class MobileFSM { @@ -358,7 +363,7 @@ public class MobileFSM {
CheckForRespawn(mob);
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
return;
if (mob.isCombat() && mob.getCombatTarget() == null) {
@ -368,7 +373,9 @@ public class MobileFSM { @@ -368,7 +373,9 @@ public class MobileFSM {
DispatchMessage.sendToAllInRange(mob, rwss);
}
mob.updateLocation();
if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
CheckToSendMobHome(mob);
}
if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) {
mob.setCombatTarget(null);
}
@ -568,10 +575,10 @@ public class MobileFSM { @@ -568,10 +575,10 @@ public class MobileFSM {
private static void chaseTarget(Mob mob) {
mob.updateMovementState();
if (mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) {
mob.setCombatTarget(null);
return;
}
//if (mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) {
// mob.setCombatTarget(null);
// return;
//}
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
if (mob.getRange() > 15) {
mob.destination = mob.getCombatTarget().getLoc();

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

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

Loading…
Cancel
Save