Browse Source

pet AI logic

master
FatBoy-DOTC 2 years ago
parent
commit
6a03b58aa6
  1. 10
      src/engine/ai/MobileFSM.java

10
src/engine/ai/MobileFSM.java

@ -37,6 +37,9 @@ public class MobileFSM {
mob.setCombatTarget(null); mob.setCombatTarget(null);
return; return;
} }
if(CombatUtilities.inRangeToAttack(mob,target) == false){
return;
}
switch (target.getObjectType()) { switch (target.getObjectType()) {
case PlayerCharacter: case PlayerCharacter:
PlayerCharacter targetPlayer = (PlayerCharacter) target; PlayerCharacter targetPlayer = (PlayerCharacter) target;
@ -418,7 +421,7 @@ public class MobileFSM {
return; return;
} }
mob.updateLocation(); mob.updateLocation();
if (mob.isPet() == false && mob.isSummonedPet() == false && mob.isNecroPet() == false) { if (mob.BehaviourType != Enum.MobBehaviourType.Pet1) {
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
Patrol(mob); Patrol(mob);
} else { } else {
@ -429,14 +432,15 @@ public class MobileFSM {
if (mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID()) == false) { if (mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID()) == false) {
//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.getOwner().getLoc(), null); MovementManager.translocate(mob, mob.getOwner().getLoc(), null);
return;
} }
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
//move back to owner //move back to owner
if(CombatUtilities.inRange2D(mob,mob.getOwner(),11)) { if(CombatUtilities.inRange2D(mob,mob.getOwner(),6)) {
return; return;
} }
mob.destination = mob.getOwner().getLoc(); mob.destination = mob.getOwner().getLoc();
MovementUtilities.moveToLocation(mob, mob.destination, 10); MovementUtilities.moveToLocation(mob, mob.destination, 5);
} else{ } else{
chaseTarget(mob); chaseTarget(mob);
} }

Loading…
Cancel
Save