Skip to content

Commit

Permalink
Merge pull request #3565 from wowsims/apl
Browse files Browse the repository at this point in the history
Implement icd on cooldown with reaction time for apl
  • Loading branch information
jimmyt857 authored Aug 27, 2023
2 parents ab20649 + 1f4c0a5 commit b86dddd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
7 changes: 6 additions & 1 deletion proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ message APLAction {
}
}

// NextIndex: 51
// NextIndex: 52
message APLValue {
oneof value {
// Operators
Expand Down Expand Up @@ -113,6 +113,7 @@ message APLValue {
APLValueAuraRemainingTime aura_remaining_time = 23;
APLValueAuraNumStacks aura_num_stacks = 24;
APLValueAuraInternalCooldown aura_internal_cooldown = 39;
APLValueAuraICDOnCooldownWithReactionTime aura_icd_on_cooldown_with_reaction_time = 51;
APLValueAuraShouldRefresh aura_should_refresh = 43;

// Dot values
Expand Down Expand Up @@ -363,6 +364,10 @@ message APLValueAuraInternalCooldown {
UnitReference source_unit = 2;
ActionID aura_id = 1;
}
message APLValueAuraICDOnCooldownWithReactionTime {
UnitReference source_unit = 2;
ActionID aura_id = 1;
}
message APLValueAuraShouldRefresh {
UnitReference source_unit = 2;
ActionID aura_id = 1;
Expand Down
2 changes: 2 additions & 0 deletions sim/core/apl_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ func (rot *APLRotation) newAPLValue(config *proto.APLValue) APLValue {
return rot.newValueAuraNumStacks(config.GetAuraNumStacks())
case *proto.APLValue_AuraInternalCooldown:
return rot.newValueAuraInternalCooldown(config.GetAuraInternalCooldown())
case *proto.APLValue_AuraIcdOnCooldownWithReactionTime:
return rot.newValueAuraICDOnCooldownWithReactionTime(config.GetAuraIcdOnCooldownWithReactionTime())
case *proto.APLValue_AuraShouldRefresh:
return rot.newValueAuraShouldRefresh(config.GetAuraShouldRefresh())

Expand Down
29 changes: 28 additions & 1 deletion sim/core/apl_values_aura.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,34 @@ func (value *APLValueAuraInternalCooldown) GetDuration(sim *Simulation) time.Dur
return value.aura.Get().Icd.TimeToReady(sim)
}
func (value *APLValueAuraInternalCooldown) String() string {
return fmt.Sprintf("Aura ICD(%s)", value.aura.String())
return fmt.Sprintf("Aura Remaining ICD(%s)", value.aura.String())
}

type APLValueAuraICDOnCooldownWithReactionTime struct {
DefaultAPLValueImpl
aura AuraReference
reactionTime time.Duration
}

func (rot *APLRotation) newValueAuraICDOnCooldownWithReactionTime(config *proto.APLValueAuraICDOnCooldownWithReactionTime) APLValue {
aura := rot.GetAPLICDAura(rot.GetSourceUnit(config.SourceUnit), config.AuraId)
if aura.Get() == nil {
return nil
}
return &APLValueAuraICDOnCooldownWithReactionTime{
aura: aura,
reactionTime: rot.unit.ReactionTime,
}
}
func (value *APLValueAuraICDOnCooldownWithReactionTime) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeBool
}
func (value *APLValueAuraICDOnCooldownWithReactionTime) GetBool(sim *Simulation) bool {
aura := value.aura.Get()
return !aura.Icd.IsReady(sim) && aura.TimeActive(sim) >= value.reactionTime
}
func (value *APLValueAuraICDOnCooldownWithReactionTime) String() string {
return fmt.Sprintf("Aura ICD on Cooldown with Reaction Time(%s)", value.aura.String())
}

type APLValueAuraShouldRefresh struct {
Expand Down
23 changes: 17 additions & 6 deletions ui/core/components/individual_sim_ui/apl_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
APLValueAuraRemainingTime,
APLValueAuraNumStacks,
APLValueAuraInternalCooldown,
APLValueAuraICDOnCooldownWithReactionTime,
APLValueAuraShouldRefresh,
APLValueDotIsActive,
APLValueDotRemainingTime,
Expand Down Expand Up @@ -748,7 +749,7 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
'auraIsActive': inputBuilder({
label: 'Aura Active',
submenu: ['Aura'],
shortDescription: '<b>True</b> if the aura is currently active on self, otherwise <b>False</b>.',
shortDescription: '<b>True</b> if the aura is currently active, otherwise <b>False</b>.',
newValue: APLValueAuraIsActive.create,
fields: [
AplHelpers.unitFieldConfig('sourceUnit', 'aura_sources'),
Expand All @@ -758,7 +759,7 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
'auraIsActiveWithReactionTime': inputBuilder({
label: 'Aura Active (with Reaction Time)',
submenu: ['Aura'],
shortDescription: '<b>True</b> if the aura is currently active on self AND it has been active for at least as long as the player reaction time (configured in Settings), otherwise <b>False</b>.',
shortDescription: '<b>True</b> if the aura is currently active AND it has been active for at least as long as the player reaction time (configured in Settings), otherwise <b>False</b>.',
newValue: APLValueAuraIsActiveWithReactionTime.create,
fields: [
AplHelpers.unitFieldConfig('sourceUnit', 'aura_sources'),
Expand All @@ -768,7 +769,7 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
'auraRemainingTime': inputBuilder({
label: 'Aura Remaining Time',
submenu: ['Aura'],
shortDescription: 'Time remaining before this aura will expire, or 0 if the aura is not currently active on self.',
shortDescription: 'Time remaining before this aura will expire, or 0 if the aura is not currently active.',
newValue: APLValueAuraRemainingTime.create,
fields: [
AplHelpers.unitFieldConfig('sourceUnit', 'aura_sources'),
Expand All @@ -778,23 +779,33 @@ const valueKindFactories: {[f in NonNullable<APLValueKind>]: ValueKindConfig<APL
'auraNumStacks': inputBuilder({
label: 'Aura Num Stacks',
submenu: ['Aura'],
shortDescription: 'Number of stacks of the aura on self.',
shortDescription: 'Number of stacks of the aura.',
newValue: APLValueAuraNumStacks.create,
fields: [
AplHelpers.unitFieldConfig('sourceUnit', 'aura_sources'),
AplHelpers.actionIdFieldConfig('auraId', 'stackable_auras', 'sourceUnit'),
],
}),
'auraInternalCooldown': inputBuilder({
label: 'Aura Internal Cooldown',
label: 'Aura ICD Remaining Time',
submenu: ['Aura'],
shortDescription: 'Time remaining before this aura can be applied again.',
shortDescription: 'Time remaining before this aura\'s internal cooldown will be ready, or <b>0</b> if the ICD is ready now.',
newValue: APLValueAuraInternalCooldown.create,
fields: [
AplHelpers.unitFieldConfig('sourceUnit', 'aura_sources'),
AplHelpers.actionIdFieldConfig('auraId', 'icd_auras', 'sourceUnit'),
],
}),
'auraIcdOnCooldownWithReactionTime': inputBuilder({
label: 'Aura ICD On Cooldown (with Reaction Time)',
submenu: ['Aura'],
shortDescription: '<b>True</b> if the aura\'s ICD is currently on cooldown AND it has been active for at least as long as the player reaction time (configured in Settings), otherwise <b>False</b>.',
newValue: APLValueAuraICDOnCooldownWithReactionTime.create,
fields: [
AplHelpers.unitFieldConfig('sourceUnit', 'aura_sources'),
AplHelpers.actionIdFieldConfig('auraId', 'icd_auras', 'sourceUnit'),
],
}),
'auraShouldRefresh': inputBuilder({
label: 'Should Refresh Aura',
submenu: ['Aura'],
Expand Down

0 comments on commit b86dddd

Please sign in to comment.