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
19 changes: 19 additions & 0 deletions spec/System/TestOffence_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,23 @@ describe("TestOffence", function()
assert.are.equals(2, build.calcsTab.mainOutput.PhysicalMinBase)
assert.are.equals(0.5, build.calcsTab.mainOutput.ColdSummedMinBase)
end)

it("caps the hit rate of a hit interval skill at its effect's uptime when it is used less often than it lasts", function()
build.skillsTab:PasteSocketGroup("Firestorm 20/0 1\nHourglass 1/0 1")
runCallback("OnFrame")

local output = build.calcsTab.mainOutput
-- The cooldown makes the skill slower than its storm lasts: the storm is up Speed x Duration of the time.
assert.is_true(output.Speed * output.Duration < 1)
assert.is_true(math.abs(output.HitSpeed - output.Speed * output.Duration / output.HitTime) < 0.000001)
end)

it("keeps one hit per interval for a hit interval skill used at least once per duration", function()
build.skillsTab:PasteSocketGroup("Firestorm 20/0 1")
runCallback("OnFrame")

local output = build.calcsTab.mainOutput
assert.is_true(output.Speed * output.Duration >= 1)
assert.is_true(math.abs(output.HitSpeed - 1 / output.HitTime) < 0.000001)
end)
end)
12 changes: 12 additions & 0 deletions src/Modules/CalcOffence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3139,6 +3139,12 @@ function calcs.offence(env, actor, activeSkill)
end
output.HitTime = skillData.hitTimeOverride
output.HitSpeed = 1 / output.HitTime
-- An effect lasting Duration that is used Speed times a second is up at most Speed x Duration of the time
-- (e.g. a cooldown makes the skill slower than its effect lasts). Seals use hitTimeOverride for the time to gather seals.
local effectDuration = globalOutput and globalOutput.Duration
if effectDuration and effectDuration > 0 and (output.Speed or 0) > 0 and not skillModList:Flag(nil, "HasSeals") then
output.HitSpeed = m_min(output.HitSpeed, output.Speed * effectDuration / output.HitTime)
end
--Brands always have hitTimeOverride
if skillFlags.brand and not skillModList:Flag(nil, "UnlimitedBrandDuration") then
output.BrandTicks = m_floor(output.Duration * output.HitSpeed)
Expand Down Expand Up @@ -3247,6 +3253,12 @@ function calcs.offence(env, actor, activeSkill)
if skillData.hitTimeOverride and not skillData.triggeredOnDeath then
output.HitTime = skillData.hitTimeOverride
output.HitSpeed = 1 / output.HitTime
-- An effect lasting Duration that is used Speed times a second is up at most Speed x Duration of the time
-- (e.g. a cooldown makes the skill slower than its effect lasts). Seals use hitTimeOverride for the time to gather seals.
local effectDuration = globalOutput and globalOutput.Duration
if effectDuration and effectDuration > 0 and (output.Speed or 0) > 0 and not skillModList:Flag(nil, "HasSeals") then
output.HitSpeed = m_min(output.HitSpeed, output.Speed * effectDuration / output.HitTime)
end
elseif skillData.timeOverride and not skillData.triggeredOnDeath then
output.Time = skillData.timeOverride
elseif skillData.hitTimeMultiplier and output.Time and not skillData.triggeredOnDeath then
Expand Down