Skip to content

Commit

Permalink
fix channel interrupting
Browse files Browse the repository at this point in the history
  • Loading branch information
kayla-glick committed Dec 28, 2024
1 parent 28c54ad commit 01639fe
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 205 deletions.
4 changes: 4 additions & 0 deletions sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ func (apl *APLRotation) DoNextAction(sim *Simulation) {
return
}

if apl.shouldInterruptChannel(sim) {
apl.unit.ChanneledDot.Cancel(sim)
}

if apl.unit.IsChanneling(sim) && !apl.allowCastWhileChanneling {
return
}
Expand Down
10 changes: 8 additions & 2 deletions sim/core/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,14 @@ func (spell *Spell) makeCastFunc(config CastConfig) CastSuccessFunc {
return spell.castFailureHelper(sim, "casting/channeling %v for %s, curTime = %s", hc.ActionID, hc.Expires-sim.CurrentTime, sim.CurrentTime)
}

if dot := spell.Unit.ChanneledDot; spell.Unit.IsChanneling(sim) && !spell.Flags.Matches(SpellFlagCastWhileChanneling) && (spell.Unit.Rotation.interruptChannelIf == nil || !spell.Unit.Rotation.interruptChannelIf.GetBool(sim)) {
return spell.castFailureHelper(sim, "channeling %v for %s, curTime = %s", dot.ActionID, dot.expires-sim.CurrentTime, sim.CurrentTime)
if dot := spell.Unit.ChanneledDot; spell.Unit.IsChanneling(sim) {
if spell.Unit.Rotation.shouldInterruptChannel(sim) {
dot.Cancel(sim)
}

if !spell.Flags.Matches(SpellFlagCastWhileChanneling) {
return spell.castFailureHelper(sim, "channeling %v for %s, curTime = %s", dot.ActionID, dot.expires-sim.CurrentTime, sim.CurrentTime)
}
}

if effectiveTime := spell.CurCast.EffectiveTime(); effectiveTime != 0 {
Expand Down
Loading

0 comments on commit 01639fe

Please sign in to comment.