From d261bc73913a9f8cb68f27b9f8d8317c3d99309e Mon Sep 17 00:00:00 2001 From: unrealdreamz <132005717+unrealdreamz@users.noreply.github.com> Date: Mon, 18 May 2026 18:28:35 -0400 Subject: [PATCH] Fix Inhibitor charge consumption benefits --- spec/System/TestChargeConsumption_spec.lua | 65 ++++++++++++++++++++++ src/Modules/CalcActiveSkill.lua | 20 ++++++- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 spec/System/TestChargeConsumption_spec.lua diff --git a/spec/System/TestChargeConsumption_spec.lua b/spec/System/TestChargeConsumption_spec.lua new file mode 100644 index 0000000000..f1e891a251 --- /dev/null +++ b/spec/System/TestChargeConsumption_spec.lua @@ -0,0 +1,65 @@ +describe("TestChargeConsumption", function() + before_each(function() + newBuild() + end) + + local function setupBarrage(inhibitor) + build.itemsTab:CreateDisplayItemFromRaw([[ + New Item + Hardwood Spear + Quality: 0 + ]]) + build.itemsTab:AddDisplayItem() + runCallback("OnFrame") + + local socketGroup = "Barrage 20/0 1" + if inhibitor then + socketGroup = socketGroup .. "\nInhibitor 1/0 1" + end + build.skillsTab:PasteSocketGroup(socketGroup) + runCallback("OnFrame") + end + + local function getBarrageRepeatCounts() + local baseRepeats = 0 + local chargeRepeats = 0 + for _, auxSkill in ipairs(build.calcsTab.mainEnv.auxSkillList) do + if auxSkill.activeEffect.grantedEffect.name == "Barrage" then + for _, buff in ipairs(auxSkill.buffList) do + if buff.name == "Barrage" then + for _, mod in ipairs(buff.modList) do + if mod.name == "BarrageRepeats" then + local usesRemovableFrenzyCharge = false + for _, tag in ipairs(mod) do + if tag.var == "RemovableFrenzyCharge" then + usesRemovableFrenzyCharge = true + break + end + end + if usesRemovableFrenzyCharge then + chargeRepeats = chargeRepeats + 1 + else + baseRepeats = baseRepeats + 1 + end + end + end + end + end + end + end + return baseRepeats, chargeRepeats + end + + it("Inhibitor removes Barrage charge-consumption repeat benefits", function() + setupBarrage(false) + local baseRepeats, chargeRepeats = getBarrageRepeatCounts() + assert.are.equals(1, baseRepeats) + assert.are.equals(1, chargeRepeats) + + newBuild() + setupBarrage(true) + baseRepeats, chargeRepeats = getBarrageRepeatCounts() + assert.are.equals(1, baseRepeats) + assert.are.equals(0, chargeRepeats) + end) +end) diff --git a/src/Modules/CalcActiveSkill.lua b/src/Modules/CalcActiveSkill.lua index d5b8ccee3f..b50506ea8d 100644 --- a/src/Modules/CalcActiveSkill.lua +++ b/src/Modules/CalcActiveSkill.lua @@ -16,6 +16,22 @@ local bor = OR64 -- bit.bor local band = AND64 -- bit.band local bnot = NOT64 -- bit.bnot +local removableChargeMultiplier = { + RemovableEnduranceCharge = true, + RemovableFrenzyCharge = true, + RemovablePowerCharge = true, + RemovableTotalCharge = true, +} + +local function usesRemovableChargeMultiplier(mod) + for _, tag in ipairs(mod) do + if removableChargeMultiplier[tag.var] and (tag.type == "Multiplier" or tag.type == "MultiplierThreshold") then + return true + end + end + return false +end + -- Merge level modifier with given mod list local mergeLevelCache = { } local function mergeLevelMod(modList, mod, value) @@ -901,7 +917,9 @@ function calcs.buildActiveSkillModList(env, activeSkill) break end end - if effectTag and effectTag.modCond and not skillModList:GetCondition(effectTag.modCond, activeSkill.skillCfg) then + if activeSkill.skillTypes[SkillType.CannotConsumeCharges] and usesRemovableChargeMultiplier(skillModList[i]) then + t_remove(skillModList, i) + elseif effectTag and effectTag.modCond and not skillModList:GetCondition(effectTag.modCond, activeSkill.skillCfg) then t_remove(skillModList, i) elseif effectType then local buff