From 38317a4ee524bd9499c3df868f9620b9500f9a6d Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 15 Jul 2023 08:35:00 -0500 Subject: [PATCH] cast chance and cooldown modification for mobs --- src/engine/ai/MobileFSM.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 7e10ea4d..588b8bd4 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -234,8 +234,13 @@ public class MobileFSM { mob.setCombatTarget(null); return false; } + int castRoll = ThreadLocalRandom.current().nextInt(101); + if(castRoll <= MobileFSMManager.AI_POWER_DIVISOR){ + return false; + } if (mob.nextCastTime == 0) mob.nextCastTime = System.currentTimeMillis(); + return mob.nextCastTime <= System.currentTimeMillis(); } @@ -296,7 +301,8 @@ public class MobileFSM { msg.setUnknown04(2); PowersManager.finishUseMobPower(msg, mob, 0, 0); // Default minimum seconds between cast = 10 - mob.nextCastTime = System.currentTimeMillis() + mobPower.getCooldown() + (MobileFSMManager.AI_POWER_DIVISOR * 1000); + float randomCooldown = (ThreadLocalRandom.current().nextInt(150) + 100) * 0.01f; + mob.nextCastTime = System.currentTimeMillis() + (long)((mobPower.getCooldown() + (MobileFSMManager.AI_POWER_DIVISOR * 1000)) * randomCooldown); return true; } return false;