Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix auto timer update ordering so that it works intuitively with Time… #3875

Merged
merged 3 commits into from
Oct 13, 2023
Merged
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
20 changes: 13 additions & 7 deletions sim/core/attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,10 @@ func (aa *AutoAttacks) TrySwingMH(sim *Simulation, target *Unit) {

attackSpell := aa.MaybeReplaceMHSwing(sim, aa.MHAuto)

attackSpell.Cast(sim, target)
// Update swing timer BEFORE the cast, so that APL checks for TimeToNextAuto behave correctly
// if the attack causes APL evaluations (e.g. from rage gain).
aa.MainhandSwingAt = sim.CurrentTime + aa.curMHSwingDuration
attackSpell.Cast(sim, target)

if !sim.Options.Interactive {
if aa.unit.IsUsingAPL {
Expand Down Expand Up @@ -537,8 +539,10 @@ func (aa *AutoAttacks) TrySwingOH(sim *Simulation, target *Unit) {
return
}

aa.OHAuto.Cast(sim, target)
// Update swing timer BEFORE the cast, so that APL checks for TimeToNextAuto behave correctly
// if the attack causes APL evaluations (e.g. from rage gain).
aa.OffhandSwingAt = sim.CurrentTime + aa.curOHSwingDuration
aa.OHAuto.Cast(sim, target)

if !sim.Options.Interactive {
if aa.unit.IsUsingAPL {
Expand All @@ -555,8 +559,10 @@ func (aa *AutoAttacks) TrySwingRanged(sim *Simulation, target *Unit) {
return
}

aa.RangedAuto.Cast(sim, target)
// Update swing timer BEFORE the cast, so that APL checks for TimeToNextAuto behave correctly
// if the attack causes APL evaluations.
aa.RangedSwingAt = sim.CurrentTime + aa.RangedSwingSpeed()
aa.RangedAuto.Cast(sim, target)

if !sim.Options.Interactive {
if aa.unit.IsUsingAPL {
Expand Down Expand Up @@ -680,11 +686,11 @@ func (aa *AutoAttacks) DelayRangedUntil(sim *Simulation, readyAt time.Duration)

// Returns the time at which the next attack will occur.
func (aa *AutoAttacks) NextAttackAt() time.Duration {
nextAttack := aa.MainhandSwingAt
if aa.IsDualWielding && aa.OffhandSwingAt < nextAttack {
nextAttack = aa.OffhandSwingAt
if aa.IsDualWielding && aa.OffhandSwingAt < aa.MainhandSwingAt {
return aa.OffhandSwingAt
} else {
return aa.MainhandSwingAt
}
return nextAttack
}

type PPMManager struct {
Expand Down
4 changes: 2 additions & 2 deletions sim/deathknight/dps/TestUnholy.results
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,8 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-TheTwinBladesofAzzinoth"
value: {
dps: 10596.60128
tps: 6872.43752
dps: 10596.77085
tps: 6872.60709
hps: 304.79181
}
}
Expand Down
6 changes: 3 additions & 3 deletions sim/druid/tank/TestFeralTank.results
Original file line number Diff line number Diff line change
Expand Up @@ -1074,9 +1074,9 @@ dps_results: {
dps_results: {
key: "TestFeralTank-Average-Default"
value: {
dps: 2664.56255
tps: 5648.23342
dtps: 59.71589
dps: 2664.65503
tps: 5648.53713
dtps: 59.70577
}
}
dps_results: {
Expand Down
Loading
Loading