Browse Source

patrol delay fine tuning

master
FatBoy-DOTC 1 year ago
parent
commit
eb9a1143e4
  1. 12
      src/engine/ai/MobileFSM.java
  2. 2
      src/engine/server/MBServerStatics.java

12
src/engine/ai/MobileFSM.java

@ -168,18 +168,16 @@ public class MobileFSM {
} }
private static void Patrol(Mob mob) { private static void Patrol(Mob mob) {
//make sure mob is out of combat stance //make sure mob is out of combat stance
if(mob.stopPatrolTime == 0) {
mob.stopPatrolTime = System.currentTimeMillis();
return;
}
if (mob.isCombat() && mob.getCombatTarget() == null) { if (mob.isCombat() && mob.getCombatTarget() == null) {
mob.setCombat(false); mob.setCombat(false);
UpdateStateMsg rwss = new UpdateStateMsg(); UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(mob); rwss.setPlayer(mob);
DispatchMessage.sendToAllInRange(mob, rwss); DispatchMessage.sendToAllInRange(mob, rwss);
} }
if (mob.isMoving() == true) {
//early exit for a mob who is already moving to a patrol point
//while mob moving, update lastPatrolTime so that when they stop moving the 10 second timer can begin
mob.stopPatrolTime = System.currentTimeMillis();
return;
}
if (mob.stopPatrolTime + (MBServerStatics.AI_PATROL_DIVISOR * 1000) > System.currentTimeMillis()) if (mob.stopPatrolTime + (MBServerStatics.AI_PATROL_DIVISOR * 1000) > System.currentTimeMillis())
//early exit while waiting to patrol again //early exit while waiting to patrol again
return; return;
@ -190,6 +188,7 @@ public class MobileFSM {
mob.patrolPoints = barracks.patrolPoints; mob.patrolPoints = barracks.patrolPoints;
} else{ } else{
randomGuardPatrolPoint(mob); randomGuardPatrolPoint(mob);
mob.stopPatrolTime = System.currentTimeMillis() + (MBServerStatics.AI_PATROL_DIVISOR * 1000);
return; return;
} }
} }
@ -199,6 +198,7 @@ public class MobileFSM {
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex); mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
mob.lastPatrolPointIndex += 1; mob.lastPatrolPointIndex += 1;
MovementUtilities.aiMove(mob, mob.destination, true); MovementUtilities.aiMove(mob, mob.destination, true);
mob.stopPatrolTime = System.currentTimeMillis() + (MBServerStatics.AI_PATROL_DIVISOR * 1000);
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()){ if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()){
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) { for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
//make sure mob is out of combat stance //make sure mob is out of combat stance

2
src/engine/server/MBServerStatics.java

@ -651,7 +651,7 @@ public class MBServerStatics {
public static int AI_RECALL_RANGE = 400; public static int AI_RECALL_RANGE = 400;
public static int AI_PULSE_MOB_THRESHOLD = 200; public static int AI_PULSE_MOB_THRESHOLD = 200;
public static int AI_THREAD_SLEEP = 1000; public static int AI_THREAD_SLEEP = 1000;
public static int AI_PATROL_DIVISOR = 10; public static int AI_PATROL_DIVISOR = 15;
public static int AI_POWER_DIVISOR = 20; public static int AI_POWER_DIVISOR = 20;
public static int AI_PET_HEEL_DISTANCE = 10; public static int AI_PET_HEEL_DISTANCE = 10;
public static int AI_PATROL_RADIUS = 60; public static int AI_PATROL_RADIUS = 60;

Loading…
Cancel
Save