Skip to content

Commit

Permalink
Merge pull request #3516 from wowsims/apl
Browse files Browse the repository at this point in the history
Proper GCD reset logic for call of the elements
  • Loading branch information
jimmyt857 authored Aug 21, 2023
2 parents 675fb19 + 6135d2f commit cfda677
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sim/shaman/fire_totems.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions sim/shaman/totems.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
})
}
Expand Down

0 comments on commit cfda677

Please sign in to comment.