Skip to content

Commit

Permalink
Merge pull request #3750 from wowsims/apl
Browse files Browse the repository at this point in the history
Add apl value for clip delay, and channel interrupt doesn't check for…
  • Loading branch information
jimmyt857 authored Sep 24, 2023
2 parents bf9ee17 + f082608 commit 38e98cc
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 10 deletions.
7 changes: 6 additions & 1 deletion proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ message APLAction {
}
}

// NextIndex: 58
// NextIndex: 59
message APLValue {
oneof value {
// Operators
Expand Down Expand Up @@ -154,6 +154,9 @@ message APLValue {
APLValueSequenceIsReady sequence_is_ready = 45;
APLValueSequenceTimeToReady sequence_time_to_ready = 46;

// Properties
APLValueChannelClipDelay channel_clip_delay = 58;

// Class or Spec-specific values
APLValueTotemRemainingTime totem_remaining_time = 49;
APLValueCatExcessEnergy cat_excess_energy = 52;
Expand Down Expand Up @@ -394,6 +397,8 @@ message APLValueSpellCastTime {
message APLValueSpellChannelTime {
ActionID spell_id = 1;
}
message APLValueChannelClipDelay {
}
message APLValueSpellTravelTime {
ActionID spell_id = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (apl *APLRotation) shouldInterruptChannel(sim *Simulation) bool {
// Don't allow interupts between ticks, just continue channeling until next tick.
return false
}
if !apl.unit.GCD.IsReady(sim) || apl.interruptChannelIf == nil || !apl.interruptChannelIf.GetBool(sim) {
if apl.interruptChannelIf == nil || !apl.interruptChannelIf.GetBool(sim) {
// Continue the channel.
return false
}
Expand Down
2 changes: 1 addition & 1 deletion sim/core/apl_actions_timing.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (action *APLActionWait) GetAPLValues() []APLValue {
return []APLValue{action.duration}
}
func (action *APLActionWait) IsReady(sim *Simulation) bool {
return true
return action.duration.GetDuration(sim) > 0
}

func (action *APLActionWait) Execute(sim *Simulation) {
Expand Down
4 changes: 4 additions & 0 deletions sim/core/apl_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ func (rot *APLRotation) newAPLValue(config *proto.APLValue) APLValue {
case *proto.APLValue_SequenceTimeToReady:
return rot.newValueSequenceTimeToReady(config.GetSequenceTimeToReady())

// Properties
case *proto.APLValue_ChannelClipDelay:
return rot.newValueChannelClipDelay(config.GetChannelClipDelay())

default:
return nil
}
Expand Down
27 changes: 27 additions & 0 deletions sim/core/apl_values_properties.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package core

import (
"time"

"github.com/wowsims/wotlk/sim/core/proto"
)

type APLValueChannelClipDelay struct {
DefaultAPLValueImpl
unit *Unit
}

func (rot *APLRotation) newValueChannelClipDelay(config *proto.APLValueChannelClipDelay) APLValue {
return &APLValueChannelClipDelay{
unit: rot.unit,
}
}
func (value *APLValueChannelClipDelay) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeDuration
}
func (value *APLValueChannelClipDelay) GetDuration(sim *Simulation) time.Duration {
return value.unit.ChannelClipDelay
}
func (value *APLValueChannelClipDelay) String() string {
return "Channel Clip Delay()"
}
4 changes: 3 additions & 1 deletion sim/core/dot.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ func (dot *Dot) TickOnce(sim *Simulation) {
}
} else if dot.Spell.Unit.Rotation.shouldInterruptChannel(sim) {
dot.Cancel(sim)
dot.Spell.Unit.WaitUntil(sim, sim.CurrentTime+dot.Spell.Unit.ChannelClipDelay)
if dot.Spell.Unit.GCD.IsReady(sim) {
dot.Spell.Unit.WaitUntil(sim, sim.CurrentTime+dot.Spell.Unit.ChannelClipDelay)
}
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions ui/core/components/individual_sim_ui/apl_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ const actionKindFactories: {[f in NonNullable<APLActionKind>]: ActionKindConfig<
<p>The channel will be interrupted only if all of the following are true:</p>
<ul>
<li>Immediately following a tick of the channel</li>
<li>The GCD is ready</li>
<li>The <b>Interrupt If</b> condition is <b>True</b></li>
<li>A higher-priority action in the APL list is available</li>
</ul>
Expand All @@ -375,10 +374,8 @@ const actionKindFactories: {[f in NonNullable<APLActionKind>]: ActionKindConfig<
newValue: () => APLActionChannelSpell.create({
interruptIf: {
value: {
oneofKind: 'const',
const: {
val: 'true',
}
oneofKind: 'gcdIsReady',
gcdIsReady: {},
}
},
}),
Expand Down
9 changes: 9 additions & 0 deletions ui/core/components/individual_sim_ui/apl_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
APLValueSpellCPM,
APLValueSpellIsChanneling,
APLValueSpellChanneledTicks,
APLValueChannelClipDelay,
APLValueAuraIsActive,
APLValueAuraIsActiveWithReactionTime,
APLValueAuraRemainingTime,
Expand Down Expand Up @@ -806,6 +807,14 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
AplHelpers.actionIdFieldConfig('spellId', 'channel_spells', ''),
],
}),
'channelClipDelay': inputBuilder({
label: 'Channel Clip Delay',
submenu: ['Spell'],
shortDescription: 'The amount of time specified by the <b>Channel Clip Delay</b> setting.',
newValue: APLValueChannelClipDelay.create,
fields: [
],
}),

// Auras
'auraIsActive': inputBuilder({
Expand Down
4 changes: 3 additions & 1 deletion ui/shadow_priest/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ export const ROTATION_PRESET_DEFAULT = {
{"hide":true,"action":{"condition":{"and":{"vals":[{"cmp":{"op":"OpGe","lhs":{"spellCastTime":{"spellId":{"spellId":48127}}},"rhs":{"const":{"val":"750ms"}}}},{"cmp":{"op":"OpLe","lhs":{"auraRemainingTime":{"auraId":{"spellId":57669}}},"rhs":{"const":{"val":"5s"}}}}]}},"castSpell":{"spellId":{"spellId":48127}}}},
{"hide":true,"action":{"condition":{"cmp":{"op":"OpGe","lhs":{"spellCastTime":{"spellId":{"spellId":48127}}},"rhs":{"const":{"val":"750ms"}}}},"castSpell":{"spellId":{"spellId":48127}}}},
{"action":{"condition":{"cmp":{"op":"OpEq","lhs":{"auraNumStacks":{"auraId":{"spellId":15258}}},"rhs":{"const":{"val":"5"}}}},"strictSequence":{"actions":[{"castSpell":{"spellId":{"spellId":14751}}},{"castSpell":{"spellId":{"spellId":48156}}}]}}},
{"action":{"channelSpell":{"spellId":{"spellId":48156},"interruptIf":{"const":{"val":"true"}}}}},
{"action":{"condition":{"and":{"vals":[{"cmp":{"op":"OpLe","lhs":{"dotRemainingTime":{"spellId":{"spellId":48300}}},"rhs":{"const":{"val":"200ms"}}}}]}},"wait":{"duration":{"dotRemainingTime":{"spellId":{"spellId":48300}}}}}},
{"action":{"condition":{"and":{"vals":[{"cmp":{"op":"OpLe","lhs":{"dotRemainingTime":{"spellId":{"spellId":48160}}},"rhs":{"math":{"op":"OpAdd","lhs":{"spellCastTime":{"spellId":{"spellId":48160}}},"rhs":{"channelClipDelay":{}}}}}},{"dotIsActive":{"spellId":{"spellId":48160}}},{"spellIsChanneling":{"spellId":{"spellId":48156}}}]}},"wait":{"duration":{"math":{"op":"OpSub","lhs":{"dotRemainingTime":{"spellId":{"spellId":48160}}},"rhs":{"spellCastTime":{"spellId":{"spellId":48160}}}}}}}},
{"action":{"channelSpell":{"spellId":{"spellId":48156},"interruptIf":{"cmp":{"op":"OpLe","lhs":{"gcdTimeToReady":{}},"rhs":{"channelClipDelay":{}}}}}}},
{"action":{"castSpell":{"spellId":{"spellId":47585}}}}
]
}`),
Expand Down

0 comments on commit 38e98cc

Please sign in to comment.