From a5af696806b87999eb2732f74dd39c9ecf6ca7df Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 6 Aug 2023 19:44:20 -0500 Subject: [PATCH] guard powers --- src/engine/mobileAI/MobAI.java | 13 +++++++++---- src/engine/mobileAI/Threads/MobAIThread.java | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 9f0c6d9e..5d938d7d 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -476,9 +476,9 @@ public class MobAI { return false; int powerToken = 0; int nukeRoll = ThreadLocalRandom.current().nextInt(1,100); - if( nukeRoll < 65){ + if( nukeRoll < 55){ //use direct damage spell - powerToken = powerTokens.get(3); + powerToken = powerTokens.get(0); } else{ //use random spell powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size())); @@ -502,8 +502,13 @@ public class MobAI { PerformActionMsg msg; if (!mobPower.isHarmful() || mobPower.targetSelf) { - PowersManager.useMobPower(mob, mob, mobPower, powerRank); - msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob); + if(mobPower.category.equals("DISPEL")){ + PowersManager.useMobPower(mob, target, mobPower, powerRank); + msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target); + }else { + PowersManager.useMobPower(mob, mob, mobPower, powerRank); + msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob); + } } else { PowersManager.useMobPower(mob, target, mobPower, powerRank); diff --git a/src/engine/mobileAI/Threads/MobAIThread.java b/src/engine/mobileAI/Threads/MobAIThread.java index 590a133b..3e92a1f9 100644 --- a/src/engine/mobileAI/Threads/MobAIThread.java +++ b/src/engine/mobileAI/Threads/MobAIThread.java @@ -11,7 +11,7 @@ public class MobAIThread implements Runnable{ public static int AI_DROP_AGGRO_RANGE = 60; public static int AI_PULSE_MOB_THRESHOLD = 200; public static int AI_PATROL_DIVISOR = 15; - public static int AI_POWER_DIVISOR = 10; + public static int AI_POWER_DIVISOR = 20; // Thread constructor public MobAIThread() {