Skip to content

Commit

Permalink
Add option to desync trinket procs (#3007)
Browse files Browse the repository at this point in the history
* add option to desync trinkets at pull

* fix ui element label

* add missing action IDs to proc auras

* update tests

* update test code to propagate complete player data

* apply desync as env setting instead of per-sim

* move trinket desync to initialize
  • Loading branch information
zku authored May 1, 2023
1 parent abf20e0 commit fc5cb75
Show file tree
Hide file tree
Showing 16 changed files with 2,309 additions and 4 deletions.
2 changes: 2 additions & 0 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,8 @@ message Cooldowns {

// % HP threshold, below which defensive cooldowns can be used.
double hp_percent_for_defensives = 2;
int32 desync_proc_trinket1_seconds = 3;
int32 desync_proc_trinket2_seconds = 4;
}

message HealingModel {
Expand Down
1 change: 1 addition & 0 deletions sim/common/tbc/melee_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func init() {

core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{
Name: "Blade of Unquenched Thirst Trigger",
ActionID: core.ActionID{ItemID: 31193},
Callback: core.CallbackOnSpellHitDealt,
ProcMask: procMask,
Outcome: core.OutcomeLanded,
Expand Down
6 changes: 6 additions & 0 deletions sim/common/wotlk/capacitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func init() {
ProcMask: core.ProcMaskSpellDamage,
Outcome: core.OutcomeCrit,
ICD: time.Millisecond * 2500,
ActionID: core.ActionID{ItemID: 38072},
},
School: core.SpellSchoolNature,
MinDmg: 1181,
Expand All @@ -104,6 +105,7 @@ func init() {
ProcMask: core.ProcMaskSpellDamage,
Outcome: core.OutcomeCrit,
ICD: time.Millisecond * 2000,
ActionID: core.ActionID{ItemID: 47182},
},
School: core.SpellSchoolFire,
MinDmg: 1741,
Expand All @@ -118,6 +120,7 @@ func init() {
ProcMask: core.ProcMaskSpellDamage,
Outcome: core.OutcomeCrit,
ICD: time.Millisecond * 2000,
ActionID: core.ActionID{ItemID: 47188},
},
School: core.SpellSchoolFire,
MinDmg: 1959,
Expand All @@ -135,6 +138,7 @@ func init() {
ProcMask: core.ProcMaskSpellDamage,
Outcome: core.OutcomeCrit,
ICD: time.Millisecond * 2000,
ActionID: core.ActionID{ItemID: 47316},
},
School: core.SpellSchoolFire,
MinDmg: 1741,
Expand All @@ -149,6 +153,7 @@ func init() {
ProcMask: core.ProcMaskSpellDamage,
Outcome: core.OutcomeCrit,
ICD: time.Millisecond * 2000,
ActionID: core.ActionID{ItemID: 47477},
},
School: core.SpellSchoolFire,
MinDmg: 1959,
Expand Down Expand Up @@ -232,6 +237,7 @@ func init() {
Callback: core.CallbackOnSpellHitDealt,
ProcMask: core.ProcMaskMelee,
Outcome: core.OutcomeLanded,
ActionID: core.ActionID{ItemID: itemID},
ProcChance: 0.5,
Handler: func(sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if spell == mhSpell || spell == ohSpell { // can't proc itself
Expand Down
6 changes: 6 additions & 0 deletions sim/common/wotlk/damage_procs.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func init() {
Outcome: core.OutcomeLanded,
ProcChance: 0.15,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 37064},
},
School: core.SpellSchoolFire,
MinDmg: 1024,
Expand All @@ -70,6 +71,7 @@ func init() {
Outcome: core.OutcomeLanded,
ProcChance: 0.15,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 37264},
},
School: core.SpellSchoolShadow,
MinDmg: 1168,
Expand All @@ -85,6 +87,7 @@ func init() {
Outcome: core.OutcomeLanded,
ProcChance: 0.15,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 39889},
},
School: core.SpellSchoolHoly,
MinDmg: 1024,
Expand All @@ -102,6 +105,7 @@ func init() {
Outcome: core.OutcomeLanded,
ProcChance: 0.15,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 40371},
},
School: core.SpellSchoolArcane,
MinDmg: 1504,
Expand All @@ -116,6 +120,7 @@ func init() {
Harmful: true,
ProcChance: 0.10,
ICD: time.Second * 15,
ActionID: core.ActionID{ItemID: 40373},
},
School: core.SpellSchoolShadow,
MinDmg: 788,
Expand All @@ -130,6 +135,7 @@ func init() {
Harmful: true,
ProcChance: 0.15,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 42990},
},
School: core.SpellSchoolShadow,
MinDmg: 1750,
Expand Down
2 changes: 2 additions & 0 deletions sim/common/wotlk/highest_stat_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func init() {
Harmful: true,
ProcChance: 0.35,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: itemID},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
hsa.Get(character).Activate(sim)
},
Expand Down Expand Up @@ -106,6 +107,7 @@ func init() {
Callback: core.CallbackOnSpellHitDealt | core.CallbackOnPeriodicDamageDealt,
Harmful: true,
ProcChance: 0.35,
ActionID: core.ActionID{ItemID: itemID},
ICD: time.Second * 45,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
hsa.Get(character).Activate(sim)
Expand Down
15 changes: 15 additions & 0 deletions sim/common/wotlk/other_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func init() {
Harmful: true,
ProcChance: 0.05,
ICD: time.Second * 50,
ActionID: actionID,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
procAura.Activate(sim)
},
Expand Down Expand Up @@ -61,6 +62,7 @@ func init() {
Harmful: true,
ProcChance: 0.05,
ICD: time.Second * 50,
ActionID: actionID,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
procAura.Activate(sim)
},
Expand Down Expand Up @@ -179,6 +181,7 @@ func init() {
ProcMask: core.ProcMaskMeleeOrRanged,
Outcome: core.OutcomeLanded,
ProcChance: 0.35,
ActionID: core.ActionID{ItemID: itemID},
ICD: time.Second * 105,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
rand := sim.RandomFloat("Deathbringer's Will")
Expand Down Expand Up @@ -228,6 +231,7 @@ func init() {
Outcome: core.OutcomeCrit,
ProcChance: 0.2,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 40258},
Handler: func(sim *core.Simulation, _ *core.Spell, result *core.SpellResult) {
healSpell.Hot(result.Target).Apply(sim)
},
Expand All @@ -246,6 +250,7 @@ func init() {
Outcome: core.OutcomeCrit,
ProcChance: 0.25,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 40382},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
character.AddMana(sim, 900, manaMetrics)
},
Expand Down Expand Up @@ -329,6 +334,7 @@ func init() {
Callback: core.CallbackOnHealDealt | core.CallbackOnPeriodicHealDealt,
Harmful: true, // Better name for this would be, 'nonzero'
ProcChance: 0.1,
ActionID: core.ActionID{ItemID: 46017},
ICD: time.Second * 45,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
activeAura.Activate(sim)
Expand Down Expand Up @@ -445,6 +451,7 @@ func init() {
Name: name + " Trigger",
Callback: core.CallbackOnSpellHitTaken,
ProcMask: core.ProcMaskMelee,
ActionID: core.ActionID{ItemID: itemID},
Harmful: true,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
if icd.IsReady(sim) && character.CurrentHealthPercent() < 0.35 {
Expand Down Expand Up @@ -486,6 +493,7 @@ func init() {
ProcMask: core.ProcMaskSpellDamage,
Harmful: true,
ProcChance: 0.10,
ActionID: core.ActionID{ItemID: itemID},
ICD: time.Second * 45,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
procAura.Activate(sim)
Expand Down Expand Up @@ -545,6 +553,7 @@ func init() {
SpellFlags: core.SpellFlagHelpful,
ProcChance: 0.25,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: 47215},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
character.AddMana(sim, 500, manaMetrics)
},
Expand Down Expand Up @@ -609,6 +618,7 @@ func init() {
Callback: core.CallbackOnSpellHitDealt,
ProcMask: core.ProcMaskMelee,
PPM: 1,
ActionID: core.ActionID{ItemID: itemID},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
// Deactivate first, to cancel old PA.
procAura.Deactivate(sim)
Expand All @@ -627,6 +637,7 @@ func init() {
Name: "Ephemeral Snowflake",
Callback: core.CallbackOnHealDealt | core.CallbackOnPeriodicHealDealt,
ICD: time.Millisecond * 250,
ActionID: actionID,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
character.AddMana(sim, 11, manaMetrics)
},
Expand Down Expand Up @@ -753,6 +764,7 @@ func init() {
Callback: core.CallbackOnHealDealt | core.CallbackOnPeriodicHealDealt,
ProcChance: 0.3,
ICD: time.Second * 45,
ActionID: core.ActionID{ItemID: itemID},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
randIndex := int(math.Floor(sim.RandomFloat("Althor's Abacus") * float64(len(eligibleUnits))))
healTarget := eligibleUnits[randIndex]
Expand Down Expand Up @@ -863,6 +875,7 @@ func init() {
Callback: core.CallbackOnSpellHitTaken,
ProcMask: core.ProcMaskMelee,
Harmful: true,
ActionID: core.ActionID{ItemID: itemID},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
if icd.IsReady(sim) && character.CurrentHealthPercent() < 0.35 {
icd.Use(sim)
Expand Down Expand Up @@ -972,6 +985,7 @@ func init() {
Callback: core.CallbackOnSpellHitDealt,
ProcMask: core.ProcMaskMelee,
ProcChance: 0.03,
ActionID: core.ActionID{ItemID: itemID},
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
procAura.Activate(sim)
},
Expand Down Expand Up @@ -1010,6 +1024,7 @@ func init() {
Callback: core.CallbackOnHealDealt,
ProcMask: core.ProcMaskSpellHealing,
ProcChance: 0.02,
ActionID: actionID,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
procAura.Activate(sim)
},
Expand Down
1 change: 1 addition & 0 deletions sim/common/wotlk/stat_bonus_procs.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func newProcStatBonusEffect(config ProcStatBonusEffect) {
}

core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{
ActionID: core.ActionID{ItemID: config.ID},
Name: config.Name,
Callback: config.Callback,
ProcMask: config.ProcMask,
Expand Down
2 changes: 2 additions & 0 deletions sim/common/wotlk/stat_bonus_stacking.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func newStackingStatBonusEffect(config StackingStatBonusEffect) {
})

core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{
ActionID: core.ActionID{ItemID: config.ID},
Name: config.Name,
Callback: config.Callback,
ProcMask: config.ProcMask,
Expand Down Expand Up @@ -153,6 +154,7 @@ func init() {
ProcMask: core.ProcMaskMeleeOrRanged,
Outcome: core.OutcomeLanded,
ProcChance: 0.1,
ActionID: core.ActionID{ItemID: 38212},
ICD: time.Second * 45,
Handler: func(sim *core.Simulation, _ *core.Spell, _ *core.SpellResult) {
procAura.Activate(sim)
Expand Down
1 change: 1 addition & 0 deletions sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ func (character *Character) AddPartyBuffs(partyBuffs *proto.PartyBuffs) {

func (character *Character) initialize(agent Agent) {
character.majorCooldownManager.initialize(character)
character.DesyncTrinketProcs()

character.gcdAction = &PendingAction{
Priority: ActionPriorityGCD,
Expand Down
Loading

0 comments on commit fc5cb75

Please sign in to comment.