Skip to content

Commit 9a62cb9

Browse files
authored
Fix impale DPS with zero duration (#9862)
* Fix impale DPS with zero duration Adds a regression test for zero impale duration and prevents ImpaleDPS from contributing when ImpaleDuration is 0. * Add zero impale duration breakdown note Added explanation in breakdown for easier user understanding * Fix CalcOffence indentation Fix indentation on line 5878
1 parent 7956cc8 commit 9a62cb9

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

spec/System/TestImpale_spec.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ describe("TestAttacks", function()
5858
assert.are.equals(150*1.3, build.calcsTab.mainOutput.ImpaleDPS) -- 5 impales * 10% stored damage * 1.3 attacks per second
5959
end)
6060

61+
it("impale with zero duration has zero dps", function()
62+
build.configTab.input.customMods = "\z
63+
never deal critical strikes\n\z
64+
Impale Damage dealt to Enemies Impaled by you Overwhelms 100% Physical Damage Reduction\n\z
65+
Overwhelm 100% physical damage reduction\n\z
66+
100% less Impale Duration\n\z
67+
"
68+
build.configTab:BuildModList()
69+
runCallback("OnFrame")
70+
71+
assert.are.equals(0, build.calcsTab.mainOutput.ImpaleDuration)
72+
assert.are.equals(0, build.calcsTab.mainOutput.ImpaleDPS)
73+
end)
74+
6175
it("impale with inc damage taken", function()
6276
-- 0% crit
6377
build.configTab.input.customMods = "\z

src/Modules/CalcOffence.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5933,6 +5933,9 @@ function calcs.offence(env, actor, activeSkill)
59335933
else
59345934
output.ImpaleDPS = output.impaleStoredHitAvg * ((output.ImpaleModifier or 1) - 1) * output.HitChance / 100 * skillData.dpsMultiplier
59355935
end
5936+
if output.ImpaleDuration <= 0 then
5937+
output.ImpaleDPS = 0
5938+
end
59365939
if skillData.showAverage then
59375940
output.WithImpaleDPS = output.AverageDamage + output.ImpaleDPS
59385941
output.CombinedAvg = output.CombinedAvg + output.ImpaleDPS
@@ -5974,6 +5977,9 @@ function calcs.offence(env, actor, activeSkill)
59745977
if quantityMultiplier > 1 then
59755978
t_insert(breakdown.ImpaleDPS, s_format("x %g ^8(quantity multiplier for this skill)", quantityMultiplier))
59765979
end
5980+
if output.ImpaleDuration <= 0 then
5981+
t_insert(breakdown.ImpaleDPS, s_format("x 0 ^8(no Impale Duration)"))
5982+
end
59775983
t_insert(breakdown.ImpaleDPS, s_format("= %.1f", output.ImpaleDPS))
59785984
end
59795985
end

0 commit comments

Comments
 (0)