From 6135d2f32813c26fdd23b48ab7b2581a9635c2ac Mon Sep 17 00:00:00 2001 From: James Tanner Date: Sun, 20 Aug 2023 09:53:58 -0700 Subject: [PATCH] Proper GCD reset logic for call of the elements --- sim/shaman/fire_totems.go | 4 ++-- sim/shaman/totems.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sim/shaman/fire_totems.go b/sim/shaman/fire_totems.go index 8ef0c342a2..43f88bd94e 100644 --- a/sim/shaman/fire_totems.go +++ b/sim/shaman/fire_totems.go @@ -9,7 +9,7 @@ import ( func (shaman *Shaman) registerSearingTotemSpell() { var extraCastCondition core.CanCastCondition - if shaman.Totems.Fire == proto.FireTotem_SearingTotem && shaman.Totems.UseFireMcd { + if !shaman.IsUsingAPL && shaman.Totems.Fire == proto.FireTotem_SearingTotem && shaman.Totems.UseFireMcd { extraCastCondition = func(sim *core.Simulation, target *core.Unit) bool { if shaman.Totems.Fire != proto.FireTotem_SearingTotem { return false @@ -85,7 +85,7 @@ func (shaman *Shaman) registerSearingTotemSpell() { func (shaman *Shaman) registerMagmaTotemSpell() { var extraCastCondition core.CanCastCondition - if shaman.Totems.Fire == proto.FireTotem_MagmaTotem && shaman.Totems.UseFireMcd { + if !shaman.IsUsingAPL && shaman.Totems.Fire == proto.FireTotem_MagmaTotem && shaman.Totems.UseFireMcd { extraCastCondition = func(sim *core.Simulation, target *core.Unit) bool { if shaman.Totems.Fire != proto.FireTotem_MagmaTotem { return false diff --git a/sim/shaman/totems.go b/sim/shaman/totems.go index 9b591c44df..1ec26db0ba 100644 --- a/sim/shaman/totems.go +++ b/sim/shaman/totems.go @@ -152,23 +152,37 @@ func (shaman *Shaman) registerCallOfTheElements() { ActionID: core.ActionID{SpellID: 66842}, Flags: core.SpellFlagAPL, + Cast: core.CastConfig{ + DefaultCast: core.Cast{ + GCD: core.GCDDefault, + }, + }, ExtraCastCondition: func(sim *core.Simulation, target *core.Unit) bool { return shaman.CurrentMana() >= totalManaCost }, ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) { + // Save GCD timer value, so we can safely reset it between each totem cast. + nextGcdAt := shaman.GCD.ReadyAt() + if airTotem != nil { + shaman.GCD.Set(0) airTotem.Cast(sim, target) } if earthTotem != nil { + shaman.GCD.Set(0) earthTotem.Cast(sim, target) } if fireTotem != nil { + shaman.GCD.Set(0) fireTotem.Cast(sim, target) } if waterTotem != nil { + shaman.GCD.Set(0) waterTotem.Cast(sim, target) } + + shaman.GCD.Set(nextGcdAt) }, }) }