Skip to content

Commit

Permalink
Merge pull request wowsims#3799 from vigo2/vigo/after-cast-removal
Browse files Browse the repository at this point in the history
vigo/after-cast-removal
  • Loading branch information
vigo2 authored Oct 4, 2023
2 parents ec3bf25 + 05509c7 commit 51fda77
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 329 deletions.
6 changes: 1 addition & 5 deletions sim/core/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ type Cast struct {

// Additional GCD delay after the cast completes.
ChannelTime time.Duration

// Additional GCD delay after the cast ends. Never affected by cast speed.
// This is typically used for latency.
AfterCastDelay time.Duration
}

func (cast *Cast) EffectiveTime() time.Duration {
Expand All @@ -60,7 +56,7 @@ func (cast *Cast) EffectiveTime() time.Duration {
// TODO: isn't this wrong for spells like shadowfury, that have a reduced GCD?
gcd = MaxDuration(GCDMin, gcd)
}
fullCastTime := cast.CastTime + cast.ChannelTime + cast.AfterCastDelay
fullCastTime := cast.CastTime + cast.ChannelTime
return MaxDuration(gcd, fullCastTime)
}

Expand Down
1 change: 0 additions & 1 deletion sim/core/spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ func (unit *Unit) RegisterSpell(config SpellConfig) *Spell {

if unit.IsUsingAPL {
config.Cast.DefaultCast.ChannelTime = 0
config.Cast.DefaultCast.AfterCastDelay = 0
}

if (config.DamageMultiplier != 0 || config.ThreatMultiplier != 0) && config.ProcMask == ProcMaskUnknown {
Expand Down
15 changes: 6 additions & 9 deletions sim/priest/mind_flay.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,15 @@ func (priest *Priest) newMindFlaySpell(numTicksIdx int32) *core.Spell {
ChannelTime: channelTime,
},
ModifyCast: func(sim *core.Simulation, spell *core.Spell, cast *core.Cast) {
if spell.Unit.IsUsingAPL {
if spell.Unit.IsUsingAPL || priest.Latency == 0 {
return
}
// if our channel is longer than GCD it will have human latency to end it beause you can't queue the next spell.
wait := priest.ApplyCastSpeed(channelTime)
gcd := core.MaxDuration(core.GCDMin, priest.ApplyCastSpeed(core.GCDDefault))
if wait > gcd && priest.Latency > 0 {
base := priest.Latency * 0.67
variation := base + sim.RandomFloat("spriest latency")*base // should vary from 0.66 - 1.33 of given latency
cast.AfterCastDelay += time.Duration(variation) * time.Millisecond
// if our channel is longer than GCD it will have human latency to end it because you can't queue the next spell.
if float64(channelTime)*priest.CastSpeed > float64(core.GCDMin) {
variation := priest.Latency * (0.66 + sim.RandomFloat("spriest latency")*(1.33-0.66)) // should vary from 0.66 - 1.33 of given latency
cast.ChannelTime += time.Duration(variation / priest.CastSpeed * float64(time.Millisecond))
if sim.Log != nil {
priest.Log(sim, "Latency: %0.02f, AfterCastDelay: %s", priest.Latency, cast.AfterCastDelay)
priest.Log(sim, "Latency: %.3f, Applied Latency: %.3f", priest.Latency, variation)
}
}
},
Expand Down
Loading

0 comments on commit 51fda77

Please sign in to comment.