From a7ee8f553b061958352f8252f3c77ce02263a8f1 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 24 Jan 2025 06:29:35 -0600 Subject: [PATCH] PlayerCombatStats proc chances --- src/engine/gameManager/CombatManager.java | 31 ++++++++--------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 804dab88..e9b26dda 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -902,27 +902,18 @@ public enum CombatManager { if (weapon != null && tarAc != null && tarAc.isAlive()) { - ConcurrentHashMap effects = weapon.getEffects(); - - for (Effect eff : effects.values()) { - if (eff == null) - continue; - - HashSet aems = eff.getEffectModifiers(); - - if (aems != null) { - for (AbstractEffectModifier aem : aems) { - - if (!tarAc.isAlive()) - break; - - if (aem instanceof WeaponProcEffectModifier) { - + if(weapon.effects != null){ + for (Effect eff : weapon.effects.values()){ + for(AbstractEffectModifier mod : eff.getEffectModifiers()){ + if(mod.modType.equals(ModType.WeaponProc)){ int procChance = ThreadLocalRandom.current().nextInt(100); - - if (procChance < MBServerStatics.PROC_CHANCE) - ((WeaponProcEffectModifier) aem).applyProc(ac, target); - + if (procChance < MBServerStatics.PROC_CHANCE) { + try { + ((WeaponProcEffectModifier) mod).applyProc(ac, target); + }catch(Exception e){ + Logger.error(eff.getName() + " Failed To Cast Proc"); + } + } } } }