From 232063ec40637ab426b23d0130232d3b08954f23 Mon Sep 17 00:00:00 2001 From: David Medgyesy Date: Mon, 30 Nov 2026 13:42:28 +0100 Subject: [PATCH] Stop generic cost efficiency from reducing soul cost --- spec/System/TestSkills_spec.lua | 15 +++++++++++++++ src/Modules/CalcOffence.lua | 7 ++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/spec/System/TestSkills_spec.lua b/spec/System/TestSkills_spec.lua index 9b4d0504db..5f1b715d28 100644 --- a/spec/System/TestSkills_spec.lua +++ b/spec/System/TestSkills_spec.lua @@ -681,6 +681,21 @@ describe("TestSkills", function() assert.are.equals(8, stackedCost) -- 12/(1 + 0.25 + 0.25) = 12/1.5 = 8 end) + it("Test generic cost efficiency does not affect soul cost", function() + -- Vaal Arc requires 25 souls per use + build.skillsTab:PasteSocketGroup("Vaal Arc 20/0 1\n") + build.configTab.input.customMods = "100% increased Cost Efficiency" + build.configTab:BuildModList() + runCallback("OnFrame") + assert.are.equals(25, build.calcsTab.mainOutput.SoulCost) + + -- Soul cost efficiency still applies, 25 / 1.5 = 16.67 + build.configTab.input.customMods = "100% increased Cost Efficiency\n50% increased Soul Cost Efficiency" + build.configTab:BuildModList() + runCallback("OnFrame") + assert.are.equals(17, build.calcsTab.mainOutput.SoulCost) + end) + it("Test cost efficiency with cost modifiers", function() -- Test interaction between cost efficiency and cost multipliers build.skillsTab:PasteSocketGroup("Hydrosphere 1/0 1\n") diff --git a/src/Modules/CalcOffence.lua b/src/Modules/CalcOffence.lua index fa2291f1e3..75889fb2c1 100644 --- a/src/Modules/CalcOffence.lua +++ b/src/Modules/CalcOffence.lua @@ -1814,7 +1814,8 @@ function calcs.offence(env, actor, activeSkill) local moreType = 1 local moreCost = 1 local inc = 0 - local costEfficiency = calcLib.mod(skillModList, skillCfg, val.type .. "CostEfficiency", "CostEfficiency") + -- Souls are not a cost in the general sense, so generic cost efficiency does not apply to them + local costEfficiency = val.unaffectedByGenericCostMults and calcLib.mod(skillModList, skillCfg, val.type .. "CostEfficiency") or calcLib.mod(skillModList, skillCfg, val.type .. "CostEfficiency", "CostEfficiency") if not val.unaffectedByGenericCostMults then output[costName] = val.finalBaseCost moreType = skillModList:More(skillCfg, val.type.."Cost") @@ -1853,7 +1854,7 @@ function calcs.offence(env, actor, activeSkill) output[costName] = m_floor(val.baseCost + val.baseCostNoMult) output[costName] = m_max(0, (1 + inc / 100) * output[costName]) output[costName] = m_max(0, moreType * output[costName]) - -- Apply cost efficiency for unaffected costs too + -- Only the resource specific cost efficiency applies here output[costName] = m_max(0, output[costName] / costEfficiency) if val.upfront and not val.percent then -- The game stores upfront resource costs as whole numbers after efficiency. @@ -1866,7 +1867,7 @@ function calcs.offence(env, actor, activeSkill) breakdown[costName] = { s_format("%.2f"..(val.percent and "%%" or "").." ^8(base "..val.text.." cost)", val.baseCost) } - if mult ~= 1 then + if mult ~= 1 and not val.unaffectedByGenericCostMults then t_insert(breakdown[costName], s_format("x %.4f ^8(cost multiplier)", mult)) end if val.baseCostNoMult ~= 0 then