diff --git a/sim/core/cast.go b/sim/core/cast.go index b43de562ca..4d40630ad9 100644 --- a/sim/core/cast.go +++ b/sim/core/cast.go @@ -33,6 +33,8 @@ type CastConfig struct { CD Cooldown SharedCD Cooldown + + GetCastTime func(spell *Spell) time.Duration } type Cast struct { @@ -101,6 +103,10 @@ func (spell *Spell) makeCastFunc(config CastConfig) CastSuccessFunc { spell.CurCast.ChannelTime = spell.Unit.ApplyCastSpeedForSpell(spell.CurCast.ChannelTime, spell) } + if spell.GetCastTime != nil { + spell.CurCast.CastTime = spell.GetCastTime(spell) + } + if config.CD.Timer != nil { // By panicking if spell is on CD, we force each sim to properly check for their own CDs. if !spell.CD.IsReady(sim) { diff --git a/sim/core/spell.go b/sim/core/spell.go index a65e162208..8fba55ca69 100644 --- a/sim/core/spell.go +++ b/sim/core/spell.go @@ -141,6 +141,8 @@ type Spell struct { // Per-target auras that are related to this spell, usually buffs or debuffs applied by the spell. RelatedAuras []AuraArray + + GetCastTime func(spell *Spell) time.Duration } func (unit *Unit) OnSpellRegistered(handler SpellRegisteredHandler) { @@ -218,6 +220,7 @@ func (unit *Unit) RegisterSpell(config SpellConfig) *Spell { splitSpellMetrics: make([][]SpellMetrics, max(1, config.MetricSplits)), RelatedAuras: config.RelatedAuras, + GetCastTime: config.Cast.GetCastTime, } switch { diff --git a/sim/core/unit.go b/sim/core/unit.go index c83081f5a8..1020c1553e 100644 --- a/sim/core/unit.go +++ b/sim/core/unit.go @@ -335,6 +335,9 @@ func (unit *Unit) ApplyCastSpeed(dur time.Duration) time.Duration { return time.Duration(float64(dur) * unit.CastSpeed) } func (unit *Unit) ApplyCastSpeedForSpell(dur time.Duration, spell *Spell) time.Duration { + if spell.GetCastTime != nil { + return spell.GetCastTime(spell) + } return time.Duration(float64(dur) * unit.CastSpeed * spell.CastTimeMultiplier) } diff --git a/sim/hunter/steady_shot.go b/sim/hunter/steady_shot.go index 5c407c1ddc..93ed0bde2f 100644 --- a/sim/hunter/steady_shot.go +++ b/sim/hunter/steady_shot.go @@ -62,10 +62,10 @@ func (hunter *Hunter) registerSteadyShotSpell() { GCD: core.GCDDefault, CastTime: time.Millisecond * 2000, }, - ModifyCast: func(_ *core.Simulation, _ *core.Spell, cast *core.Cast) { - cast.CastTime = hunter.SteadyShotCastTime() - }, IgnoreHaste: true, // Hunter GCD is locked at 1.5s + GetCastTime: func(spell *core.Spell) time.Duration { + return time.Duration(float64(spell.DefaultCast.CastTime) / hunter.RangedSwingSpeed()) + }, }, BonusCritRating: 0 + @@ -92,7 +92,3 @@ func (hunter *Hunter) registerSteadyShotSpell() { }, }) } - -func (hunter *Hunter) SteadyShotCastTime() time.Duration { - return time.Duration(float64(time.Millisecond*2000) / hunter.RangedSwingSpeed()) -}