Skip to content

Commit

Permalink
Merge pull request #3875 from wowsims/apl
Browse files Browse the repository at this point in the history
Fix auto timer update ordering so that it works intuitively with Time…
  • Loading branch information
jimmyt857 authored Oct 13, 2023
2 parents d22cfd9 + a181a9e commit 87b96cf
Show file tree
Hide file tree
Showing 12 changed files with 1,079 additions and 1,073 deletions.
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

0 comments on commit 87b96cf

Please sign in to comment.