diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 3376e99d..3424fc35 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -23,6 +23,9 @@ import engine.net.client.msg.PerformActionMsg; import engine.net.client.msg.PowerProjectileMsg; import engine.net.client.msg.UpdateStateMsg; import engine.objects.*; +import engine.powers.ActionsBase; +import engine.powers.EffectsBase; +import engine.powers.PowerPrereq; import engine.powers.PowersBase; import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; @@ -1647,10 +1650,22 @@ public class MobileFSM { MobCallForHelp(mob); } PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget(); - int random = ThreadLocalRandom.current().nextInt(mob.mobPowers.size() * 2); + HashMap eligiblePowers = mob.mobPowers; + for(Map.Entry power : mob.mobPowers.entrySet()) { + ConcurrentHashMap effects = target.getEffects(); + PowersBase pwr= PowersManager.getPowerByToken(power.getKey()); + for(ActionsBase act : pwr.getActions()){ + String des = act.stackType; + if(target.getEffects().containsKey(des)){ + eligiblePowers.remove(power.getKey()); + } + } + + } + int random = ThreadLocalRandom.current().nextInt(eligiblePowers.size() + 1); int powerToken = 0; int powerRank = 0; - Map entries = mob.mobPowers; + Map entries = eligiblePowers; int count = -1; for (Map.Entry entry : entries.entrySet()) { count += 1; @@ -1669,10 +1684,11 @@ public class MobileFSM { msg.setUnknown04(2); PowersManager.finishUseMobPower(msg, mob, 0, 0); //default minimum seconds between cast = 10 - if(mobPower.getCooldown() < 10000){ - mob.nextCastTime = System.currentTimeMillis() + 10000; + long cooldown = mobPower.getCooldown(); + if(cooldown < 10000){ + mob.nextCastTime = System.currentTimeMillis() + 10000 + cooldown; } else { - mob.nextCastTime = System.currentTimeMillis() + (mobPower.getCooldown()); + mob.nextCastTime = System.currentTimeMillis() + cooldown; } return true; } diff --git a/src/engine/ai/utilities/CombatUtilities.java b/src/engine/ai/utilities/CombatUtilities.java index b3330ebf..5fe30006 100644 --- a/src/engine/ai/utilities/CombatUtilities.java +++ b/src/engine/ai/utilities/CombatUtilities.java @@ -398,6 +398,10 @@ public class CombatUtilities { min = agent.getEquip().get(1).getItemBase().getMinDamage() + agent.getEquip().get(2).getItemBase().getMinDamage(); max = agent.getEquip().get(1).getItemBase().getMaxDamage() + agent.getEquip().get(2).getItemBase().getMaxDamage(); } + if(agent.getLevel() > 80){ + min = agent.getMobBase().getMinDmg(); + max = agent.getMobBase().getDamageMax(); + } range = max - min; damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2; if (AbstractWorldObject.IsAbstractCharacter(target))