Skip to content

Commit 49668f8

Browse files
committed
Change cost to be integer value
1 parent 31cb3eb commit 49668f8

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

spec/System/TestSkills_spec.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ describe("TestAttacks", function()
191191
runCallback("OnFrame")
192192

193193
local genericEfficiencyCost = build.calcsTab.mainOutput.ManaCost
194-
-- Test actual behavior: 12/1.25 = 9.6 (not rounded)
195-
assert.True(math.abs(genericEfficiencyCost - 9.6) < 0.001)
194+
-- 12/1.25 = 9.6
195+
assert.equals(10, genericEfficiencyCost)
196196

197197
-- Test multiple efficiency sources stacking additively
198198
build.configTab.input.customMods = "25% increased Cost Efficiency\n25% increased Mana Cost Efficiency"
@@ -213,7 +213,7 @@ describe("TestAttacks", function()
213213
runCallback("OnFrame")
214214

215215
local finalCost = build.calcsTab.mainOutput.ManaCost
216-
assert.True(math.abs(finalCost - 12) < 0.1) -- floor(12 * 1.5) / 1.5
216+
assert.equals(12, finalCost)
217217
end)
218218

219219
it("Test flat cost is added before cost efficiency", function()
@@ -227,7 +227,7 @@ describe("TestAttacks", function()
227227

228228
local finalCost = build.calcsTab.mainOutput.ManaCost
229229
-- (12 + 10) / 1.5 = 14.667
230-
assert.True(math.abs(finalCost - 22 / 1.5) < 0.001)
230+
assert.equals(15, finalCost)
231231
end)
232232
it("Test flat cost is added before cost efficiency for life costs", function()
233233
build.skillsTab:PasteSocketGroup("Hydrosphere 1/0 1\n")
@@ -238,7 +238,7 @@ describe("TestAttacks", function()
238238
runCallback("OnFrame")
239239

240240
-- (12 + 10) / 1.5 = 14.667
241-
assert.True(math.abs(build.calcsTab.mainOutput.LifeCost - 22 / 1.5) < 0.001)
241+
assert.equals(15, build.calcsTab.mainOutput.LifeCost)
242242
end)
243243

244244
it("Test flat cost is added before cost efficiency for energy shield costs (#10003)", function()
@@ -250,7 +250,7 @@ describe("TestAttacks", function()
250250
runCallback("OnFrame")
251251

252252
-- (12 + 10) / 1.5 = 14.667
253-
assert.True(math.abs(build.calcsTab.mainOutput.ESCost - 22 / 1.5) < 0.001)
253+
assert.equals(15, build.calcsTab.mainOutput.ESCost)
254254
end)
255255
it("Test mana cost efficiency with support gems", function()
256256
-- Test interaction between cost efficiency and cost multipliers

src/Modules/CalcOffence.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ function calcs.offence(env, actor, activeSkill)
17741774
end
17751775
output[costName] = m_max(0, output[costName] + val.totalCost)
17761776
-- Apply cost efficiency (similar to reservation efficiency)
1777-
output[costName] = m_max(0, output[costName] / costEfficiency)
1777+
output[costName] = m_max(0, m_ceil(output[costName] / costEfficiency))
17781778
if val.type == "Mana" and hybridLifeCost > 0 then -- Life/Mana Mastery
17791779
output[costName] = m_max(0, m_floor((1 - hybridLifeCost) * output[costName]))
17801780
output[costNameRaw] = output[costNameRaw] and m_max(0, (1 - hybridLifeCost) * output[costNameRaw])
@@ -1824,7 +1824,7 @@ function calcs.offence(env, actor, activeSkill)
18241824
if val.type == "Mana" and hybridLifeCost > 0 then
18251825
t_insert(breakdown[costName], s_format("x %.2f ^8(%d%% paid for with life)", (1-hybridLifeCost), hybridLifeCost*100))
18261826
end
1827-
t_insert(breakdown[costName], s_format("= %" .. (val.upfront and "d" or ".2f") .. (val.percent and "%%" or ""), m_ceil(output[costName])))
1827+
t_insert(breakdown[costName], s_format("= %" .. (val.upfront and "d" or ".2f") .. (val.percent and "%%" or ""), output[costName]))
18281828
end
18291829
end
18301830
end

0 commit comments

Comments
 (0)