Skip to content

Commit

Permalink
Merge pull request #1199 from wowsims/feature/apl-aura-sets
Browse files Browse the repository at this point in the history
ICD Filtering for Trinket Proc APL Wrapper Values
  • Loading branch information
NerdEgghead authored Nov 12, 2024
2 parents d354e2d + 05976d7 commit 538094a
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 83 deletions.
15 changes: 10 additions & 5 deletions proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -570,31 +570,36 @@ message APLValueAllTrinketStatProcsActive {
int32 stat_type1 = 1;
int32 stat_type2 = 2;
int32 stat_type3 = 3;
bool exclude_stacking_procs = 4;
bool exclude_stacking_procs = 4 [deprecated=true];
double min_icd_seconds = 5;
}
message APLValueAnyTrinketStatProcsActive {
int32 stat_type1 = 1;
int32 stat_type2 = 2;
int32 stat_type3 = 3;
bool exclude_stacking_procs = 4;
bool exclude_stacking_procs = 4 [deprecated=true];
double min_icd_seconds = 5;
}
message APLValueTrinketProcsMinRemainingTime {
int32 stat_type1 = 1;
int32 stat_type2 = 2;
int32 stat_type3 = 3;
bool exclude_stacking_procs = 4;
bool exclude_stacking_procs = 4 [deprecated=true];
double min_icd_seconds = 5;
}
message APLValueTrinketProcsMaxRemainingICD {
int32 stat_type1 = 1;
int32 stat_type2 = 2;
int32 stat_type3 = 3;
bool exclude_stacking_procs = 4;
bool exclude_stacking_procs = 4 [deprecated=true];
double min_icd_seconds = 5;
}
message APLValueNumEquippedStatProcTrinkets {
int32 stat_type1 = 1;
int32 stat_type2 = 2;
int32 stat_type3 = 3;
bool exclude_stacking_procs = 4;
bool exclude_stacking_procs = 4 [deprecated=true];
double min_icd_seconds = 5;
}

message APLValueDotIsActive {
Expand Down
6 changes: 4 additions & 2 deletions sim/core/apl_helpers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package core

import (
"time"

"github.com/wowsims/cata/sim/core/proto"
"github.com/wowsims/cata/sim/core/stats"
)
Expand Down Expand Up @@ -128,10 +130,10 @@ func (rot *APLRotation) GetAPLICDAura(sourceUnit UnitReference, auraId *proto.Ac
return aura
}

func (rot *APLRotation) GetAPLTrinketProcAuras(statTypesToMatch []stats.Stat, excludeStackingProcs bool, warnIfNoneFound bool) []*StatBuffAura {
func (rot *APLRotation) GetAPLTrinketProcAuras(statTypesToMatch []stats.Stat, minIcd time.Duration, warnIfNoneFound bool) []*StatBuffAura {
unit := rot.unit
character := unit.Env.Raid.GetPlayerFromUnit(unit).GetCharacter()
matchingAuras := character.GetMatchingTrinketProcAuras(statTypesToMatch, excludeStackingProcs)
matchingAuras := character.GetMatchingTrinketProcAuras(statTypesToMatch, minIcd)

if (len(matchingAuras) == 0) && warnIfNoneFound {
rot.ValidationWarning("No trinket proc buffs found for: %s", StringFromStatTypes(statTypesToMatch))
Expand Down
15 changes: 8 additions & 7 deletions sim/core/apl_values_aura_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ type APLValueTrinketStatProcCheck struct {
matchingAuras []*StatBuffAura
}

func (rot *APLRotation) newTrinketStatProcValue(valueName string, statType1 int32, statType2 int32, statType3 int32, excludeStackingProcs bool, requireMatch bool) *APLValueTrinketStatProcCheck {
func (rot *APLRotation) newTrinketStatProcValue(valueName string, statType1 int32, statType2 int32, statType3 int32, minIcdSeconds float64, requireMatch bool) *APLValueTrinketStatProcCheck {
statTypesToMatch := stats.IntTupleToStatsList(statType1, statType2, statType3)
matchingAuras := rot.GetAPLTrinketProcAuras(statTypesToMatch, excludeStackingProcs, requireMatch)
minIcd := DurationFromSeconds(minIcdSeconds)
matchingAuras := rot.GetAPLTrinketProcAuras(statTypesToMatch, minIcd, requireMatch)

if (len(matchingAuras) == 0) && requireMatch {
return nil
Expand Down Expand Up @@ -55,7 +56,7 @@ type APLValueAllTrinketStatProcsActive struct {
}

func (rot *APLRotation) newValueAllTrinketStatProcsActive(config *proto.APLValueAllTrinketStatProcsActive) APLValue {
parentImpl := rot.newTrinketStatProcValue("AllTrinketStatProcsActive", config.StatType1, config.StatType2, config.StatType3, config.ExcludeStackingProcs, true)
parentImpl := rot.newTrinketStatProcValue("AllTrinketStatProcsActive", config.StatType1, config.StatType2, config.StatType3, config.MinIcdSeconds, true)

if parentImpl == nil {
return nil
Expand Down Expand Up @@ -83,7 +84,7 @@ type APLValueAnyTrinketStatProcsActive struct {
}

func (rot *APLRotation) newValueAnyTrinketStatProcsActive(config *proto.APLValueAnyTrinketStatProcsActive) APLValue {
parentImpl := rot.newTrinketStatProcValue("AnyTrinketStatProcsActive", config.StatType1, config.StatType2, config.StatType3, config.ExcludeStackingProcs, true)
parentImpl := rot.newTrinketStatProcValue("AnyTrinketStatProcsActive", config.StatType1, config.StatType2, config.StatType3, config.MinIcdSeconds, true)

if parentImpl == nil {
return nil
Expand Down Expand Up @@ -111,7 +112,7 @@ type APLValueTrinketProcsMinRemainingTime struct {
}

func (rot *APLRotation) newValueTrinketProcsMinRemainingTime(config *proto.APLValueTrinketProcsMinRemainingTime) APLValue {
parentImpl := rot.newTrinketStatProcValue("TrinketProcsMinRemainingTime", config.StatType1, config.StatType2, config.StatType3, config.ExcludeStackingProcs, true)
parentImpl := rot.newTrinketStatProcValue("TrinketProcsMinRemainingTime", config.StatType1, config.StatType2, config.StatType3, config.MinIcdSeconds, true)

if parentImpl == nil {
return nil
Expand Down Expand Up @@ -141,7 +142,7 @@ type APLValueTrinketProcsMaxRemainingICD struct {
}

func (rot *APLRotation) newValueTrinketProcsMaxRemainingICD(config *proto.APLValueTrinketProcsMaxRemainingICD) APLValue {
parentImpl := rot.newTrinketStatProcValue("TrinketProcsMaxRemainingICD", config.StatType1, config.StatType2, config.StatType3, config.ExcludeStackingProcs, true)
parentImpl := rot.newTrinketStatProcValue("TrinketProcsMaxRemainingICD", config.StatType1, config.StatType2, config.StatType3, config.MinIcdSeconds, true)

if parentImpl == nil {
return nil
Expand Down Expand Up @@ -171,7 +172,7 @@ type APLValueNumEquippedStatProcTrinkets struct {
}

func (rot *APLRotation) newValueNumEquippedStatProcTrinkets(config *proto.APLValueNumEquippedStatProcTrinkets) APLValue {
parentImpl := rot.newTrinketStatProcValue("NumEquippedStatProcTrinkets", config.StatType1, config.StatType2, config.StatType3, config.ExcludeStackingProcs, false)
parentImpl := rot.newTrinketStatProcValue("NumEquippedStatProcTrinkets", config.StatType1, config.StatType2, config.StatType3, config.MinIcdSeconds, false)

return &APLValueNumEquippedStatProcTrinkets{
APLValueTrinketStatProcCheck: parentImpl,
Expand Down
6 changes: 4 additions & 2 deletions sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,9 +691,11 @@ func (character *Character) GetOffensiveTrinketCD() *Timer {
func (character *Character) GetConjuredCD() *Timer {
return character.GetOrInitTimer(&character.conjuredCD)
}
func (character *Character) GetMatchingTrinketProcAuras(statTypesToMatch []stats.Stat, excludeStackingProcs bool) []*StatBuffAura {
func (character *Character) GetMatchingTrinketProcAuras(statTypesToMatch []stats.Stat, minIcd time.Duration) []*StatBuffAura {
includeIcdFilter := (minIcd > 0)

return FilterSlice(character.TrinketProcBuffs, func(aura *StatBuffAura) bool {
return aura.BuffsMatchingStat(statTypesToMatch) && (!excludeStackingProcs || (aura.MaxStacks <= 1))
return aura.BuffsMatchingStat(statTypesToMatch) && (!includeIcdFilter || ((aura.Icd != nil) && (aura.Icd.Duration > minIcd)))
})
}

Expand Down
94 changes: 47 additions & 47 deletions sim/death_knight/unholy/TestUnholy.results
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-BloodthirstyGladiator'sInsigniaofVictory-64763"
value: {
dps: 40324.69834
tps: 29943.67256
hps: 644.94189
dps: 40755.92124
tps: 30184.10221
hps: 646.50919
}
}
dps_results: {
Expand Down Expand Up @@ -374,9 +374,9 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-CataclysmicGladiator'sInsigniaofVictory-73491"
value: {
dps: 41322.42915
tps: 30565.65175
hps: 648.07648
dps: 41514.88543
tps: 30714.51397
hps: 644.15825
}
}
dps_results: {
Expand Down Expand Up @@ -542,9 +542,9 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-Dwyer'sCaber-70141"
value: {
dps: 41530.5634
tps: 30823.24101
hps: 655.91296
dps: 41560.00675
tps: 30784.09025
hps: 663.74943
}
}
dps_results: {
Expand Down Expand Up @@ -598,17 +598,17 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-EssenceoftheCyclone-59473"
value: {
dps: 40399.34872
tps: 29948.19761
hps: 659.04755
dps: 40342.32298
tps: 29825.94724
hps: 659.8312
}
}
dps_results: {
key: "TestUnholy-AllItems-EssenceoftheCyclone-65140"
value: {
dps: 40500.66281
tps: 30029.92127
hps: 664.53308
dps: 40502.4154
tps: 29933.8926
hps: 655.12931
}
}
dps_results: {
Expand Down Expand Up @@ -814,17 +814,17 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-GraceoftheHerald-55266"
value: {
dps: 39724.78391
tps: 29483.82442
hps: 644.15825
dps: 39679.10211
tps: 29401.86291
hps: 644.94189
}
}
dps_results: {
key: "TestUnholy-AllItems-GraceoftheHerald-56295"
value: {
dps: 39847.60216
tps: 29472.00728
hps: 653.56202
dps: 39930.05783
tps: 29496.0413
hps: 650.42743
}
}
dps_results: {
Expand Down Expand Up @@ -926,9 +926,9 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-HeartoftheVile-66969"
value: {
dps: 39820.62916
tps: 29408.15639
hps: 643.3746
dps: 39858.38396
tps: 29494.95003
hps: 646.50919
}
}
dps_results: {
Expand Down Expand Up @@ -1502,25 +1502,25 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-RightEyeofRajh-56100"
value: {
dps: 40305.52913
tps: 29761.56238
dps: 40407.06129
tps: 29920.18661
hps: 644.15825
}
}
dps_results: {
key: "TestUnholy-AllItems-RightEyeofRajh-56431"
value: {
dps: 40356.67343
tps: 29856.13876
hps: 642.59095
dps: 40520.41451
tps: 29958.55506
hps: 643.3746
}
}
dps_results: {
key: "TestUnholy-AllItems-RosaryofLight-72901"
value: {
dps: 41502.10113
tps: 30806.08832
hps: 652.77837
dps: 41698.79052
tps: 30844.09873
hps: 654.34566
}
}
dps_results: {
Expand Down Expand Up @@ -1638,17 +1638,17 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-RuthlessGladiator'sInsigniaofVictory-70403"
value: {
dps: 40853.63222
tps: 30309.55209
hps: 645.72554
dps: 41062.73475
tps: 30378.20581
hps: 644.94189
}
}
dps_results: {
key: "TestUnholy-AllItems-RuthlessGladiator'sInsigniaofVictory-72455"
value: {
dps: 40971.66037
tps: 30299.58312
hps: 641.8073
dps: 41382.32577
tps: 30638.46144
hps: 649.64378
}
}
dps_results: {
Expand Down Expand Up @@ -1846,9 +1846,9 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-Stonemother'sKiss-61411"
value: {
dps: 39695.07885
tps: 29429.80542
hps: 652.77837
dps: 39743.70481
tps: 29391.52291
hps: 651.21107
}
}
dps_results: {
Expand Down Expand Up @@ -2262,17 +2262,17 @@ dps_results: {
dps_results: {
key: "TestUnholy-AllItems-ViciousGladiator'sInsigniaofVictory-61046"
value: {
dps: 40432.19347
tps: 30026.88625
hps: 644.15825
dps: 40673.14884
tps: 30152.16093
hps: 644.94189
}
}
dps_results: {
key: "TestUnholy-AllItems-ViciousGladiator'sInsigniaofVictory-70579"
value: {
dps: 40653.00979
tps: 30035.57728
hps: 642.59095
dps: 40874.0684
tps: 30237.77369
hps: 646.50919
}
}
dps_results: {
Expand Down
6 changes: 3 additions & 3 deletions ui/core/components/individual_sim_ui/apl_helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,9 @@ export function statTypeFieldConfig(field: string): APLPickerBuilderFieldConfig<
};
}

export const excludeStackingProcsInput = booleanFieldConfig('excludeStackingProcs', 'Exclude stacking procs', {
labelTooltip:
'Filter out any stacking stat buffs from the list of auras checked by this value. This can be useful for certain snapshotting checks, since stacking proc trinkets are often permanently active.',
export const minIcdInput = numberFieldConfig('minIcdSeconds', false, {
label: 'Min ICD',
labelTooltip: 'If non-zero, filter out any procs that either lack an ICD or for which the ICD is smaller than the specified value (in seconds). This can be useful for certain snapshotting checks, since procs with low ICDs are often too weak to snapshot.',
})

export function aplInputBuilder<T>(
Expand Down
10 changes: 5 additions & 5 deletions ui/core/components/individual_sim_ui/apl_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ const valueKindFactories: { [f in NonNullable<APLValueKind>]: ValueKindConfig<AP
statType2: -1,
statType3: -1,
}),
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.excludeStackingProcsInput],
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.minIcdInput],
}),
anyTrinketStatProcsActive: inputBuilder({
label: 'Any Trinket Proc Buffs Active',
Expand All @@ -992,7 +992,7 @@ const valueKindFactories: { [f in NonNullable<APLValueKind>]: ValueKindConfig<AP
statType2: -1,
statType3: -1,
}),
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.excludeStackingProcsInput],
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.minIcdInput],
}),
trinketProcsMinRemainingTime: inputBuilder({
label: 'Trinket Procs Min Remaining Time',
Expand All @@ -1005,7 +1005,7 @@ const valueKindFactories: { [f in NonNullable<APLValueKind>]: ValueKindConfig<AP
statType2: -1,
statType3: -1,
}),
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.excludeStackingProcsInput],
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.minIcdInput],
}),
trinketProcsMaxRemainingIcd: inputBuilder({
label: 'Trinket Procs Max Remaining ICD',
Expand All @@ -1018,7 +1018,7 @@ const valueKindFactories: { [f in NonNullable<APLValueKind>]: ValueKindConfig<AP
statType2: -1,
statType3: -1,
}),
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.excludeStackingProcsInput],
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.minIcdInput],
}),
numEquippedStatProcTrinkets: inputBuilder({
label: 'Num Equipped Stat Proc Trinkets',
Expand All @@ -1030,7 +1030,7 @@ const valueKindFactories: { [f in NonNullable<APLValueKind>]: ValueKindConfig<AP
statType2: -1,
statType3: -1,
}),
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.excludeStackingProcsInput],
fields: [AplHelpers.statTypeFieldConfig('statType1'), AplHelpers.statTypeFieldConfig('statType2'), AplHelpers.statTypeFieldConfig('statType3'), AplHelpers.minIcdInput],
}),

// DoT
Expand Down
Loading

0 comments on commit 538094a

Please sign in to comment.