From 2aabafdab8f849b8d7402abbdc58e7e28e45b4be Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 5 Aug 2023 22:54:41 -0500 Subject: [PATCH] fixed mob cast effect --- src/engine/mobileAI/MobAI.java | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index e533c9e2..c323e6d3 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -324,10 +324,10 @@ public class MobAI { return false; } - int castRoll = ThreadLocalRandom.current().nextInt(101); + //int castRoll = ThreadLocalRandom.current().nextInt(1,101); - if (castRoll <= MobAIThread.AI_POWER_DIVISOR) - return false; + //if (castRoll < MobAIThread.AI_POWER_DIVISOR) + // return false; if (mob.nextCastTime == 0) mob.nextCastTime = System.currentTimeMillis(); @@ -349,7 +349,7 @@ public class MobAI { ArrayList powerTokens; ArrayList purgeTokens; - PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget(); + AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget(); if (mob.BehaviourType.callsForHelp) MobCallForHelp(mob); @@ -410,22 +410,23 @@ public class MobAI { if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) { - PowersManager.useMobPower(mob, (AbstractCharacter) mob.getCombatTarget(), mobPower, powerRank); + PerformActionMsg msg; - if (!mobPower.isHarmful() || mobPower.targetSelf) + if (!mobPower.isHarmful() || mobPower.targetSelf) { + PowersManager.useMobPower(mob, mob, mobPower, powerRank); msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob); - else + } + else { + PowersManager.useMobPower(mob, target, mobPower, powerRank); msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target); + } msg.setUnknown04(2); PowersManager.finishUseMobPower(msg, mob, 0, 0); - // Default minimum seconds between cast = 10 - - float randomCooldown = (ThreadLocalRandom.current().nextInt(150) + 100) * 0.01f; - mob.nextCastTime = System.currentTimeMillis() + (long) ((mobPower.getCooldown() + (MobAIThread.AI_POWER_DIVISOR * 1000)) * randomCooldown); + mob.nextCastTime = System.currentTimeMillis() + (long) ((mobPower.getCooldown() + (MobAIThread.AI_POWER_DIVISOR * 1000))); return true; } } catch (Exception e) {