From 912a49bfa9c1c4edf050935b7a7ef8823828a4de Mon Sep 17 00:00:00 2001 From: Adrian Klingen Date: Sat, 28 Sep 2024 00:05:40 +0200 Subject: [PATCH 1/4] Add Mage T13 bonus --- sim/mage/combustion.go | 6 ++++++ sim/mage/items.go | 41 ++++++++++++++++++++++++++++++++++++-- sim/mage/mage.go | 1 + sim/mage/talents_arcane.go | 8 +++++++- sim/mage/talents_frost.go | 9 +++++++-- 5 files changed, 60 insertions(+), 5 deletions(-) diff --git a/sim/mage/combustion.go b/sim/mage/combustion.go index 12fc1ec2b5..4d82ed2cc5 100644 --- a/sim/mage/combustion.go +++ b/sim/mage/combustion.go @@ -36,6 +36,9 @@ func (mage *Mage) registerCombustionSpell() { spell.DealDamage(sim, result) spell.RelatedDotSpell.Cast(sim, target) } + if mage.t13ProcAura != nil { + spell.CD.Reduce(time.Second * time.Duration(5*mage.t13ProcAura.GetStacks())) + } }, }) @@ -82,6 +85,9 @@ func (mage *Mage) registerCombustionSpell() { }, OnTick: func(sim *core.Simulation, target *core.Unit, dot *core.Dot) { dot.CalcAndDealPeriodicSnapshotDamage(sim, target, dot.OutcomeSnapshotCrit) + if mage.t13ProcAura != nil && !dot.IsActive() { + mage.t13ProcAura.SetStacks(sim, 0) + } }, }, diff --git a/sim/mage/items.go b/sim/mage/items.go index 2c016eb419..6263d15d4a 100644 --- a/sim/mage/items.go +++ b/sim/mage/items.go @@ -4,6 +4,7 @@ import ( "time" "github.com/wowsims/cata/sim/core" + "github.com/wowsims/cata/sim/core/stats" ) // T11 @@ -83,11 +84,47 @@ var ItemSetTimeLordsRegalia = core.NewItemSet(core.ItemSet{ // Your Arcane Blast has a 100% chance and your Fireball, Pyroblast, Frostfire Bolt, and Frostbolt spells have a 50% chance to grant Stolen Time, increasing your haste rating by 50 for 30 sec and stacking up to 10 times. // When Arcane Power, Combustion, or Icy Veins expires, all stacks of Stolen Time are lost. 2: func(agent core.Agent) { - // mage := agent.(MageAgent).GetMage() + character := agent.GetCharacter() + mage := agent.(MageAgent).GetMage() + + // Stack reset handlers can be found in: + // combustion.go + // talents_arcane.go + // talents_frost.go + mage.t13ProcAura = core.MakeStackingAura(character, core.StackingStatAura{ + Aura: core.Aura{ + Label: "Stolen Time", + ActionID: core.ActionID{SpellID: 105785}, + Duration: time.Second * 30, + MaxStacks: 10, + }, + BonusPerStack: stats.Stats{stats.HasteRating: 50}, + }) + + newStolenTimeTrigger := func(procChance float64, spellMask int64) { + core.MakePermanent(core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{ + Name: "Stolen Time Trigger", + ActionID: core.ActionID{ItemID: 105788}, + Callback: core.CallbackOnCastComplete, + ClassSpellMask: spellMask, + ProcChance: procChance, + Outcome: core.OutcomeLanded, + Handler: func(sim *core.Simulation, spell *core.Spell, result *core.SpellResult) { + mage.t13ProcAura.Activate(sim) + mage.t13ProcAura.AddStack(sim) + }, + })) + } + + newStolenTimeTrigger(1, MageSpellArcaneBlast) + newStolenTimeTrigger(0.5, MageSpellFireball|MageSpellPyroblast|MageSpellFrostfireBolt|MageSpellFrostbolt) }, // Each stack of Stolen Time also reduces the cooldown of Arcane Power by 7 sec, Combustion by 5 sec, and Icy Veins by 15 sec. 4: func(agent core.Agent) { - // mage := agent.(MageAgent).GetMage() + // Cooldown reduction handlers can be found in: + // combustion.go + // talents_arcane.go + // talents_frost.go }, }, }) diff --git a/sim/mage/mage.go b/sim/mage/mage.go index 749ec3c828..b72a32107a 100644 --- a/sim/mage/mage.go +++ b/sim/mage/mage.go @@ -24,6 +24,7 @@ type Mage struct { frostfireOrb *FrostfireOrb t12MirrorImage *T12MirrorImage + t13ProcAura *core.Aura arcaneMissilesTickSpell *core.Spell Combustion *core.Spell diff --git a/sim/mage/talents_arcane.go b/sim/mage/talents_arcane.go index 536618dba2..a5324caea5 100644 --- a/sim/mage/talents_arcane.go +++ b/sim/mage/talents_arcane.go @@ -311,6 +311,9 @@ func (mage *Mage) registerArcanePowerCD() { } mage.arcanePowerCostMod.Deactivate() arcanePowerDmgMod.Deactivate() + if mage.t13ProcAura != nil { + mage.t13ProcAura.SetStacks(sim, 0) + } }, }) @@ -323,8 +326,11 @@ func (mage *Mage) registerArcanePowerCD() { Duration: time.Second * 120, }, }, - ApplyEffects: func(sim *core.Simulation, _ *core.Unit, _ *core.Spell) { + ApplyEffects: func(sim *core.Simulation, _ *core.Unit, spell *core.Spell) { arcanePowerAura.Activate(sim) + if mage.t13ProcAura != nil { + spell.CD.Reduce(time.Second * time.Duration(7*mage.t13ProcAura.GetStacks())) + } }, }) mage.AddMajorCooldown(core.MajorCooldown{ diff --git a/sim/mage/talents_frost.go b/sim/mage/talents_frost.go index cc86acba19..66194f8644 100644 --- a/sim/mage/talents_frost.go +++ b/sim/mage/talents_frost.go @@ -93,6 +93,9 @@ func (mage *Mage) registerIcyVeinsCD() { }, OnExpire: func(aura *core.Aura, sim *core.Simulation) { icyVeinsMod.Deactivate() + if mage.t13ProcAura != nil { + mage.t13ProcAura.SetStacks(sim, 0) + } }, }) @@ -106,7 +109,6 @@ func (mage *Mage) registerIcyVeinsCD() { }, Cast: core.CastConfig{ - CD: core.Cooldown{ Timer: mage.NewTimer(), Duration: time.Second * time.Duration(180*[]float64{1, .93, .86, .80}[mage.Talents.IceFloes]), @@ -121,8 +123,11 @@ func (mage *Mage) registerIcyVeinsCD() { return !icyVeinsAura.IsActive() && !mage.frostfireOrb.IsEnabled() }, - ApplyEffects: func(sim *core.Simulation, _ *core.Unit, _ *core.Spell) { + ApplyEffects: func(sim *core.Simulation, _ *core.Unit, spell *core.Spell) { icyVeinsAura.Activate(sim) + if mage.t13ProcAura != nil { + spell.CD.Reduce(time.Second * time.Duration(15*mage.t13ProcAura.GetStacks())) + } }, }) From 7290fdda3e5728e56a2281c6baec662d9ec2505d Mon Sep 17 00:00:00 2001 From: Adrian Klingen Date: Sat, 28 Sep 2024 00:45:35 +0200 Subject: [PATCH 2/4] Update tests --- sim/mage/fire/TestFire.results | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sim/mage/fire/TestFire.results b/sim/mage/fire/TestFire.results index 06d19f087b..9c80f7267a 100644 --- a/sim/mage/fire/TestFire.results +++ b/sim/mage/fire/TestFire.results @@ -1259,8 +1259,8 @@ dps_results: { dps_results: { key: "TestFire-AllItems-TimeLord'sRegalia" value: { - dps: 25696.78104 - tps: 25273.4801 + dps: 26498.29508 + tps: 26030.59893 } } dps_results: { From 1fd77a48d34425f6c2ba5d28e282f33c2877ba5d Mon Sep 17 00:00:00 2001 From: Adrian Klingen Date: Sat, 28 Sep 2024 10:00:19 +0200 Subject: [PATCH 3/4] PR feedback --- sim/mage/combustion.go | 8 +++++--- sim/mage/items.go | 6 +++--- sim/mage/talents_arcane.go | 4 ++-- sim/mage/talents_frost.go | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sim/mage/combustion.go b/sim/mage/combustion.go index 4d82ed2cc5..bcc85d9d00 100644 --- a/sim/mage/combustion.go +++ b/sim/mage/combustion.go @@ -61,6 +61,11 @@ func (mage *Mage) registerCombustionSpell() { Dot: core.DotConfig{ Aura: core.Aura{ Label: "Combustion Dot", + OnExpire: func(aura *core.Aura, sim *core.Simulation) { + if mage.t13ProcAura != nil { + mage.t13ProcAura.Deactivate(sim) + } + }, }, NumberOfTicks: 10, TickLength: time.Second, @@ -85,9 +90,6 @@ func (mage *Mage) registerCombustionSpell() { }, OnTick: func(sim *core.Simulation, target *core.Unit, dot *core.Dot) { dot.CalcAndDealPeriodicSnapshotDamage(sim, target, dot.OutcomeSnapshotCrit) - if mage.t13ProcAura != nil && !dot.IsActive() { - mage.t13ProcAura.SetStacks(sim, 0) - } }, }, diff --git a/sim/mage/items.go b/sim/mage/items.go index 6263d15d4a..ed37fdc9c0 100644 --- a/sim/mage/items.go +++ b/sim/mage/items.go @@ -102,10 +102,10 @@ var ItemSetTimeLordsRegalia = core.NewItemSet(core.ItemSet{ }) newStolenTimeTrigger := func(procChance float64, spellMask int64) { - core.MakePermanent(core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{ + core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{ Name: "Stolen Time Trigger", ActionID: core.ActionID{ItemID: 105788}, - Callback: core.CallbackOnCastComplete, + Callback: core.CallbackOnSpellHitDealt, ClassSpellMask: spellMask, ProcChance: procChance, Outcome: core.OutcomeLanded, @@ -113,7 +113,7 @@ var ItemSetTimeLordsRegalia = core.NewItemSet(core.ItemSet{ mage.t13ProcAura.Activate(sim) mage.t13ProcAura.AddStack(sim) }, - })) + }) } newStolenTimeTrigger(1, MageSpellArcaneBlast) diff --git a/sim/mage/talents_arcane.go b/sim/mage/talents_arcane.go index a5324caea5..7f5ca4f814 100644 --- a/sim/mage/talents_arcane.go +++ b/sim/mage/talents_arcane.go @@ -305,14 +305,14 @@ func (mage *Mage) registerArcanePowerCD() { mage.arcanePowerCostMod.Activate() arcanePowerDmgMod.Activate() }, - OnExpire: func(aura *core.Aura, sim *core.Simulation) { + OnExpire: func(_ *core.Aura, sim *core.Simulation) { if mage.arcanePowerGCDmod != nil { mage.arcanePowerGCDmod.Deactivate() } mage.arcanePowerCostMod.Deactivate() arcanePowerDmgMod.Deactivate() if mage.t13ProcAura != nil { - mage.t13ProcAura.SetStacks(sim, 0) + mage.t13ProcAura.Deactivate(sim) } }, }) diff --git a/sim/mage/talents_frost.go b/sim/mage/talents_frost.go index 66194f8644..78d9fc7a2e 100644 --- a/sim/mage/talents_frost.go +++ b/sim/mage/talents_frost.go @@ -91,10 +91,10 @@ func (mage *Mage) registerIcyVeinsCD() { OnGain: func(aura *core.Aura, sim *core.Simulation) { icyVeinsMod.Activate() }, - OnExpire: func(aura *core.Aura, sim *core.Simulation) { + OnExpire: func(_ *core.Aura, sim *core.Simulation) { icyVeinsMod.Deactivate() if mage.t13ProcAura != nil { - mage.t13ProcAura.SetStacks(sim, 0) + mage.t13ProcAura.Deactivate(sim) } }, }) From aff43a7d3f6e4c9297ecdf0c16eb279f60851b3e Mon Sep 17 00:00:00 2001 From: Adrian Klingen Date: Sat, 28 Sep 2024 10:32:53 +0200 Subject: [PATCH 4/4] Update test --- sim/mage/fire/TestFire.results | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sim/mage/fire/TestFire.results b/sim/mage/fire/TestFire.results index 9c80f7267a..3d11378353 100644 --- a/sim/mage/fire/TestFire.results +++ b/sim/mage/fire/TestFire.results @@ -1259,8 +1259,8 @@ dps_results: { dps_results: { key: "TestFire-AllItems-TimeLord'sRegalia" value: { - dps: 26498.29508 - tps: 26030.59893 + dps: 26698.06292 + tps: 26232.03683 } } dps_results: {