Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions spec/System/TestSkills_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
7 changes: 4 additions & 3 deletions src/Modules/CalcOffence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down