From d999d60e9ad234cb798553130c0d65c2d68f570f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 24 May 2023 19:05:35 -0500 Subject: [PATCH] Patrol wait determined by MBServerStatics.AI_PATROL_DIVISOR mob cast chance now determined by MBStatics.AI_POWER_CHANCE mob cast cooldown now determined by MBServerStatics.AI_POWER_DIVISOR --- src/engine/ai/MobileFSM.java | 13 +++++-------- src/engine/server/MBServerStatics.java | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 7b9ad4e9..b0a1c1c3 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -180,9 +180,7 @@ public class MobileFSM { mob.stopPatrolTime = System.currentTimeMillis(); return; } - //wait between 10 and 15 seconds after reaching patrol point before moving - int patrolDelay = ThreadLocalRandom.current().nextInt(10000) + 5000; - if (mob.stopPatrolTime + patrolDelay > System.currentTimeMillis()) + if (mob.stopPatrolTime + (MBServerStatics.AI_PATROL_DIVISOR * 1000) > System.currentTimeMillis()) //early exit while waiting to patrol again return; //guard captains inherit barracks patrol points dynamically @@ -228,6 +226,9 @@ public class MobileFSM { return false; if (mob.mobPowers.isEmpty()) return false; + //added in cast chance for mobs, editable by MBServerStatics.AI_POWER_CHANCE + if(ThreadLocalRandom.current().nextInt(100) > MBServerStatics.AI_POWER_CHANCE) + return false; if (mob.nextCastTime == 0) mob.nextCastTime = System.currentTimeMillis(); return mob.nextCastTime <= System.currentTimeMillis(); @@ -273,11 +274,7 @@ public class MobileFSM { msg.setUnknown04(2); PowersManager.finishUseMobPower(msg, mob, 0, 0); // Default minimum seconds between cast = 10 - long coolDown = mobPower.getCooldown(); - if (coolDown < 10000) - mob.nextCastTime = System.currentTimeMillis() + 10000 + coolDown; - else - mob.nextCastTime = System.currentTimeMillis() + coolDown; + mob.nextCastTime = System.currentTimeMillis() + (MBServerStatics.AI_POWER_DIVISOR * 1000); return true; } return false; diff --git a/src/engine/server/MBServerStatics.java b/src/engine/server/MBServerStatics.java index d46038e7..659ad5c7 100644 --- a/src/engine/server/MBServerStatics.java +++ b/src/engine/server/MBServerStatics.java @@ -655,6 +655,7 @@ public class MBServerStatics { public static int AI_POWER_DIVISOR = 20; public static int AI_PET_HEEL_DISTANCE = 10; public static int AI_PATROL_RADIUS = 60; + public static int AI_POWER_CHANCE = 25; // set 1-100 for chance a mob will cast public static float AI_MAX_ANGLE = 10f;