Skip to content

Commit 8b4931f

Browse files
authored
Merge pull request #955 from wowsims/fix/balance-sf-mf-dot-extension
Fix broken ingame SF/MF tick period extension
2 parents 5509d4c + ac0505b commit 8b4931f

5 files changed

Lines changed: 591 additions & 570 deletions

File tree

sim/core/dot.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,18 +233,28 @@ func (dot *Dot) CopyDotAndApply(sim *Simulation, originaldot *Dot) {
233233
sim.AddPendingAction(dot.tickAction)
234234
}
235235

236-
// This is the incredibly cursed way fel flame uses to increase dot duration, don't use unless you know what you're
237-
// doing. It extends the duration, immediately recalculates the next tick and then fits as many ticks into the rest of
236+
// This is the incredibly cursed way of extending DoT durations (for Fel flame (Cata) / moonfire / sunfire)
237+
// Don't use unless you know what you're doing
238+
// It extends the duration, immediately recalculates the next tick and then fits as many ticks into the rest of
238239
// the aura duration as it can. This will cause aura duration and dot ticks to desync ingame, so the aura will fall off
239240
// prematurely to what is shown.
240241
//
241242
// Sometimes the game also decides to tick one last time anyway, even though the time since the last tick is absurdly
242243
// low, though this isn't implemented until someone figures out the conditions.
244+
func (dot *Dot) DurationExtend(sim *Simulation, extendBy time.Duration) {
245+
dot.durationExtendInternal(sim, extendBy, false)
246+
}
243247
func (dot *Dot) DurationExtendSnapshot(sim *Simulation, extendBy time.Duration) {
248+
dot.durationExtendInternal(sim, extendBy, true)
249+
}
250+
251+
func (dot *Dot) durationExtendInternal(sim *Simulation, extendBy time.Duration, useSnapshot bool) {
244252
if !dot.IsActive() {
245253
panic("Can't extend a non-active dot")
246254
}
247-
dot.TakeSnapshot(sim, false)
255+
if useSnapshot {
256+
dot.TakeSnapshot(sim, false)
257+
}
248258

249259
previousTick := dot.tickAction.NextActionAt - dot.tickPeriod
250260
dot.tickPeriod = dot.CalcTickPeriod()
@@ -262,7 +272,7 @@ func (dot *Dot) DurationExtendSnapshot(sim *Simulation, extendBy time.Duration)
262272
// cap the total duration to the amount of hasted ticks a new dot would have
263273
extendDuration := min(dot.RemainingDuration(sim)+extendBy,
264274
dot.tickPeriod*time.Duration(dot.HastedTickCount()-1)+(nextTick-sim.CurrentTime))
265-
dot.remainingTicks = int32((extendDuration-(nextTick-sim.CurrentTime))/dot.tickPeriod) + 1
275+
dot.remainingTicks = dot.calculateTickCount(extendDuration-(nextTick-sim.CurrentTime), dot.tickPeriod) + 1
266276

267277
dot.Duration = nextTick - sim.CurrentTime + time.Duration(dot.remainingTicks-1)*dot.tickPeriod
268278
sim.AddPendingAction(dot.tickAction)

0 commit comments

Comments
 (0)