Skip to content

Commit

Permalink
fix channel cancelling
Browse files Browse the repository at this point in the history
  • Loading branch information
kayla-glick committed Dec 29, 2024
1 parent 76cfcd0 commit 6e2991c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 5 additions & 1 deletion sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ func (apl *APLRotation) DoNextAction(sim *Simulation) {
return
}

if apl.unit.IsChanneling(sim) && !apl.allowCastWhileChanneling && !apl.shouldInterruptChannel(sim) {
if apl.shouldInterruptChannel(sim) {
apl.unit.ChanneledDot.Cancel(sim)
}

if apl.unit.IsChanneling(sim) && !apl.allowCastWhileChanneling {
return
}

Expand Down
10 changes: 2 additions & 8 deletions sim/core/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,8 @@ 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) {
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 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 effectiveTime := spell.CurCast.EffectiveTime(); effectiveTime != 0 {
Expand Down

0 comments on commit 6e2991c

Please sign in to comment.