From 20f14c5faa061d047b19e6478f6f1052de2e8125 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 8 Oct 2023 18:48:27 -0400 Subject: [PATCH] fix weird tricks + MCD interaction (#3851) --- sim/core/major_cooldown.go | 8 -------- sim/rogue/rogue.go | 1 + sim/rogue/tricks_of_the_trade.go | 5 +++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/sim/core/major_cooldown.go b/sim/core/major_cooldown.go index 03b13963ec..a316cb620b 100644 --- a/sim/core/major_cooldown.go +++ b/sim/core/major_cooldown.go @@ -183,8 +183,6 @@ type majorCooldownManager struct { // the course of the sim. majorCooldowns []*MajorCooldown minReady time.Duration - - tryUsing bool } func newMajorCooldownManager(cooldowns *proto.Cooldowns) majorCooldownManager { @@ -463,7 +461,6 @@ func (mcdm *majorCooldownManager) TryUseCooldowns(sim *Simulation) { return } - mcdm.tryUsing = true restart: for _, mcd := range mcdm.majorCooldowns { if !mcd.IsReady(sim) { @@ -486,17 +483,12 @@ restart: goto restart } } - mcdm.tryUsing = false - mcdm.minReady = mcdm.majorCooldowns[0].ReadyAt() } // This function should be called if the CD for a major cooldown changes outside // of the TryActivate() call. func (mcdm *majorCooldownManager) UpdateMajorCooldowns() { - if mcdm.tryUsing { - panic("Do not call UpdateMajorCooldowns while iterating cooldowns in TryUseCooldowns") - } if len(mcdm.majorCooldowns) == 0 { mcdm.minReady = NeverExpires return diff --git a/sim/rogue/rogue.go b/sim/rogue/rogue.go index 9f4693a888..892d8cc96b 100644 --- a/sim/rogue/rogue.go +++ b/sim/rogue/rogue.go @@ -189,6 +189,7 @@ func (rogue *Rogue) Initialize() { if !rogue.IsUsingAPL && rogue.Rotation.TricksOfTheTradeFrequency != proto.Rogue_Rotation_Never && !rogue.HasSetBonus(Tier10, 2) { rogue.RegisterPrepullAction(-10*time.Second, func(sim *core.Simulation) { rogue.TricksOfTheTrade.Cast(sim, nil) + rogue.UpdateMajorCooldowns() }) } } diff --git a/sim/rogue/tricks_of_the_trade.go b/sim/rogue/tricks_of_the_trade.go index 7df533a486..60c87bb983 100644 --- a/sim/rogue/tricks_of_the_trade.go +++ b/sim/rogue/tricks_of_the_trade.go @@ -40,9 +40,11 @@ func (rogue *Rogue) registerTricksOfTheTradeSpell() { }, OnGain: func(aura *core.Aura, sim *core.Simulation) { rogue.TricksOfTheTrade.CD.Set(core.NeverExpires) + rogue.UpdateMajorCooldowns() }, OnExpire: func(aura *core.Aura, sim *core.Simulation) { rogue.TricksOfTheTrade.CD.Set(sim.CurrentTime + time.Second*time.Duration(30-5*rogue.Talents.FilthyTricks)) + rogue.UpdateMajorCooldowns() }, }) @@ -73,9 +75,8 @@ func (rogue *Rogue) registerTricksOfTheTradeSpell() { if rogue.Rotation.TricksOfTheTradeFrequency != proto.Rogue_Rotation_Never { // TODO: Support Rogue_Rotation_Once - tricksSpell := rogue.TricksOfTheTrade rogue.AddMajorCooldown(core.MajorCooldown{ - Spell: tricksSpell, + Spell: rogue.TricksOfTheTrade, Priority: core.CooldownPriorityBloodlust, Type: core.CooldownTypeDPS, ShouldActivate: func(sim *core.Simulation, character *core.Character) bool {