diff --git a/sim/deathknight/dps/dps_deathknight.go b/sim/deathknight/dps/dps_deathknight.go index c00b7b64f7..10001f1a96 100644 --- a/sim/deathknight/dps/dps_deathknight.go +++ b/sim/deathknight/dps/dps_deathknight.go @@ -37,6 +37,8 @@ type DpsDeathknight struct { CustomRotation *common.CustomRotation Rotation *proto.Deathknight_Rotation + + rotationSetup func() } func NewDpsDeathknight(character core.Character, player *proto.Player) *DpsDeathknight { @@ -154,41 +156,43 @@ func (dk *DpsDeathknight) SetupRotations() { if dk.CustomRotation == nil || dk.Rotation.FrostRotationType == proto.Deathknight_Rotation_SingleTarget { dk.Rotation.FrostRotationType = proto.Deathknight_Rotation_SingleTarget if fr > uh && fr > bl { - // AotD as major CD doesnt work well with frost + // AotD as major CD doesn't work well with frost if dk.Inputs.ArmyOfTheDeadType == proto.Deathknight_Rotation_AsMajorCd { dk.Inputs.ArmyOfTheDeadType = proto.Deathknight_Rotation_PreCast dk.Rotation.HoldErwArmy = false } if bl > uh { if dk.Rotation.DesyncRotation { - dk.setupFrostSubBloodDesyncOpener() + dk.rotationSetup = dk.setupFrostSubBloodDesyncOpener } else if dk.Rotation.UseEmpowerRuneWeapon { - dk.setupFrostSubBloodERWOpener() + dk.rotationSetup = dk.setupFrostSubBloodERWOpener } else { - dk.setupFrostSubBloodNoERWOpener() + dk.rotationSetup = dk.setupFrostSubBloodNoERWOpener } } else { dk.Rotation.FrostRotationType = proto.Deathknight_Rotation_SingleTarget if dk.Rotation.UseEmpowerRuneWeapon { - dk.setupFrostSubUnholyERWOpener() + dk.rotationSetup = dk.setupFrostSubUnholyERWOpener } else { // TODO you can't unh sub without ERW in the opener...yet dk.Rotation.UseEmpowerRuneWeapon = true - dk.setupFrostSubUnholyERWOpener() + dk.rotationSetup = dk.setupFrostSubUnholyERWOpener } } } else if uh > fr && uh > bl { - dk.setupUnholyRotations() + dk.rotationSetup = dk.setupUnholyRotations } else if bl > fr && bl > uh { if dk.Inputs.ArmyOfTheDeadType == proto.Deathknight_Rotation_AsMajorCd { dk.Inputs.ArmyOfTheDeadType = proto.Deathknight_Rotation_PreCast dk.Rotation.HoldErwArmy = false } - dk.setupBloodRotations() + dk.rotationSetup = dk.setupBloodRotations } } else { - dk.setupCustomRotations() + dk.rotationSetup = dk.setupCustomRotations } + + dk.rotationSetup() } func (dk *DpsDeathknight) GetDeathknight() *deathknight.Deathknight { @@ -202,6 +206,8 @@ func (dk *DpsDeathknight) Initialize() { dk.br.Initialize(dk) dk.fr.Initialize(dk) dk.ur.Initialize(dk) + + dk.SetupRotations() } func (dk *DpsDeathknight) setupGargProcTrackers() { @@ -517,7 +523,8 @@ func (dk *DpsDeathknight) Reset(sim *core.Simulation) { dk.fr.Reset(sim) dk.ur.Reset(sim) - dk.SetupRotations() + dk.RotationSequence.Clear() + dk.rotationSetup() dk.Presence = deathknight.UnsetPresence diff --git a/sim/deathknight/rotation.go b/sim/deathknight/rotation.go index 9b95c0f496..c1f3d2609f 100644 --- a/sim/deathknight/rotation.go +++ b/sim/deathknight/rotation.go @@ -6,7 +6,7 @@ import ( "github.com/wowsims/wotlk/sim/core" ) -func (dk *Deathknight) OnAutoAttack(sim *core.Simulation, spell *core.Spell) { +func (dk *Deathknight) OnAutoAttack(_ *core.Simulation, _ *core.Spell) { } func (dk *Deathknight) OnGCDReady(sim *core.Simulation) { @@ -218,12 +218,7 @@ func (dk *Deathknight) RotationActionCallback_RD(sim *core.Simulation, target *c return -1 } -func (dk *Deathknight) RotationActionCallback_Reset(sim *core.Simulation, target *core.Unit, s *Sequence) time.Duration { - s.Reset() - return -1 -} - -func (s *Sequence) DoAction(sim *core.Simulation, target *core.Unit, dk *Deathknight) time.Duration { +func (s *Sequence) DoAction(sim *core.Simulation, target *core.Unit, _ *Deathknight) time.Duration { action := s.actions[s.idx] return action(sim, target, s) } diff --git a/sim/deathknight/rotation_helper.go b/sim/deathknight/rotation_helper.go index cd2a5254b5..f65e5d1003 100644 --- a/sim/deathknight/rotation_helper.go +++ b/sim/deathknight/rotation_helper.go @@ -10,32 +10,15 @@ import ( // return duration is an optional wait time type RotationAction func(sim *core.Simulation, target *core.Unit, s *Sequence) time.Duration -func TernaryRotationAction(condition bool, t RotationAction, f RotationAction) RotationAction { - if condition { - return t - } else { - return f - } -} - // Add your UH rotation Actions here and then on the DoNext function type Sequence struct { - idx int - numActions int - actions []RotationAction + idx int + actions []RotationAction } func (s *Sequence) IsOngoing() bool { - return s.idx < s.numActions -} - -func (s *Sequence) RemainingActions() int { - return (s.numActions - 1) - s.idx -} - -func (s *Sequence) Reset() { - s.idx = 0 + return s.idx < len(s.actions) } func (s *Sequence) Advance() { @@ -48,23 +31,13 @@ func (s *Sequence) ConditionalAdvance(condition bool) { } } -func (s *Sequence) GetNextAction() RotationAction { - if s.idx+1 < s.numActions { - return s.actions[s.idx+1] - } else { - return nil - } -} - func (s *Sequence) NewAction(action RotationAction) *Sequence { s.actions = append(s.actions, action) - s.numActions += 1 return s } func (s *Sequence) Clear() *Sequence { s.actions = s.actions[:0] - s.numActions = 0 s.idx = 0 return s } @@ -72,8 +45,9 @@ func (s *Sequence) Clear() *Sequence { type RotationHelper struct { RotationSequence *Sequence - LastOutcome core.HitOutcome - LastCast *core.Spell - NextCast *core.Spell + LastOutcome core.HitOutcome + LastCast *core.Spell + NextCast *core.Spell + AoESpellNumTargetsHit int32 }