From 75db0b3cfa9e319b97f100f625a953d432f64739 Mon Sep 17 00:00:00 2001 From: vigo Date: Mon, 22 Apr 2024 00:56:15 +0200 Subject: [PATCH 1/2] [shaman] use SpellFlagMaelstrom for Maelstrom Weapon handling --- sim/shaman/chain_heal.go | 2 +- sim/shaman/electric_spell.go | 2 +- sim/shaman/healing_wave.go | 2 +- sim/shaman/lava_burst.go | 2 +- sim/shaman/lesser_healing_wave.go | 2 +- sim/shaman/runes.go | 48 ++++++++++--------------------- sim/shaman/shaman.go | 1 + 7 files changed, 21 insertions(+), 38 deletions(-) diff --git a/sim/shaman/chain_heal.go b/sim/shaman/chain_heal.go index 7bc36a7dc7..3b1e004531 100644 --- a/sim/shaman/chain_heal.go +++ b/sim/shaman/chain_heal.go @@ -51,7 +51,7 @@ func (shaman *Shaman) newChainHealSpellConfig(rank int, isOverload bool) core.Sp manaCost := ChainHealManaCost[rank] level := ChainHealLevel[rank] - flags := core.SpellFlagHelpful + flags := core.SpellFlagHelpful | SpellFlagMaelstrom if !isOverload { flags |= core.SpellFlagAPL } diff --git a/sim/shaman/electric_spell.go b/sim/shaman/electric_spell.go index a1a1c800b7..e8c013168f 100644 --- a/sim/shaman/electric_spell.go +++ b/sim/shaman/electric_spell.go @@ -25,7 +25,7 @@ const ( // Shared precomputation logic for LB and CL. func (shaman *Shaman) newElectricSpellConfig(actionID core.ActionID, baseCost float64, baseCastTime time.Duration, isOverload bool) core.SpellConfig { - flags := SpellFlagElectric | SpellFlagFocusable + flags := SpellFlagElectric | SpellFlagFocusable | SpellFlagMaelstrom if !isOverload { flags |= core.SpellFlagAPL } diff --git a/sim/shaman/healing_wave.go b/sim/shaman/healing_wave.go index 7aecab08d9..0fb908cb9d 100644 --- a/sim/shaman/healing_wave.go +++ b/sim/shaman/healing_wave.go @@ -47,7 +47,7 @@ func (shaman *Shaman) newHealingWaveSpellConfig(rank int, isOverload bool) core. manaCost := HealingWaveManaCost[rank] level := HealingWaveLevel[rank] - flags := core.SpellFlagHelpful + flags := core.SpellFlagHelpful | SpellFlagMaelstrom if !isOverload { flags |= core.SpellFlagAPL } diff --git a/sim/shaman/lava_burst.go b/sim/shaman/lava_burst.go index c3c6b28cdb..cbafce6b0e 100644 --- a/sim/shaman/lava_burst.go +++ b/sim/shaman/lava_burst.go @@ -27,7 +27,7 @@ func (shaman *Shaman) newLavaBurstSpellConfig(isOverload bool) core.SpellConfig cooldown := time.Second * 8 manaCost := .10 - flags := SpellFlagFocusable + flags := SpellFlagFocusable | SpellFlagMaelstrom if !isOverload { flags |= core.SpellFlagAPL } diff --git a/sim/shaman/lesser_healing_wave.go b/sim/shaman/lesser_healing_wave.go index cde3f28d34..eda314020f 100644 --- a/sim/shaman/lesser_healing_wave.go +++ b/sim/shaman/lesser_healing_wave.go @@ -43,7 +43,7 @@ func (shaman *Shaman) newLesserHealingWaveSpellConfig(rank int) core.SpellConfig SpellSchool: core.SpellSchoolNature, DefenseType: core.DefenseTypeMagic, ProcMask: core.ProcMaskSpellHealing, - Flags: core.SpellFlagHelpful | core.SpellFlagAPL, + Flags: core.SpellFlagHelpful | SpellFlagMaelstrom | core.SpellFlagAPL, RequiredLevel: level, Rank: rank, diff --git a/sim/shaman/runes.go b/sim/shaman/runes.go index c2f2602af9..ccba4ec287 100644 --- a/sim/shaman/runes.go +++ b/sim/shaman/runes.go @@ -213,49 +213,31 @@ func (shaman *Shaman) applyMaelstromWeapon() { return } - buffSpellId := 408505 - buffDuration := time.Second * 30 - ppm := core.TernaryFloat64(shaman.GetCharacter().Consumes.MainHandImbue == proto.WeaponImbue_WindfuryWeapon, 15, 10) var affectedSpells []*core.Spell - var affectedSpellCodes = []int32{ - SpellCode_ShamanLightningBolt, - SpellCode_ShamanChainLightning, - SpellCode_ShamanLavaBurst, - SpellCode_ShamanHealingWave, - SpellCode_ShamanLesserHealingWave, - SpellCode_ShamanChainHeal, - } + shaman.OnSpellRegistered(func(spell *core.Spell) { + if spell.Flags.Matches(SpellFlagMaelstrom) { + affectedSpells = append(affectedSpells, spell) + } + }) shaman.MaelstromWeaponAura = shaman.RegisterAura(core.Aura{ Label: "MaelstromWeapon Proc", - ActionID: core.ActionID{SpellID: int32(buffSpellId)}, - Duration: buffDuration, + ActionID: core.ActionID{SpellID: 408505}, + Duration: time.Second * 30, MaxStacks: 5, - OnInit: func(aura *core.Aura, sim *core.Simulation) { - affectedSpells = core.FilterSlice( - core.Flatten([][]*core.Spell{ - shaman.LightningBolt, - shaman.ChainLightning, - {shaman.LavaBurst}, - shaman.HealingWave, - shaman.LesserHealingWave, - shaman.ChainHeal, - }), func(spell *core.Spell) bool { return spell != nil }, - ) - }, OnStacksChange: func(aura *core.Aura, sim *core.Simulation, oldStacks int32, newStacks int32) { multDiff := 0.2 * float64(newStacks-oldStacks) - core.Each(affectedSpells, func(spell *core.Spell) { spell.CastTimeMultiplier -= multDiff }) - core.Each(affectedSpells, func(spell *core.Spell) { spell.CostMultiplier -= multDiff }) + for _, spell := range affectedSpells { + spell.CastTimeMultiplier -= multDiff + spell.CostMultiplier -= multDiff + } }, OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) { - if !slices.Contains(affectedSpellCodes, spell.SpellCode) { - return + if spell.Flags.Matches(SpellFlagMaelstrom) { + shaman.MaelstromWeaponAura.Deactivate(sim) } - - shaman.MaelstromWeaponAura.Deactivate(sim) }, }) @@ -288,7 +270,7 @@ func (shaman *Shaman) applyPowerSurge() { return } - // TODO: Figure out how this actually works becaue the 2024-02-27 tuning notes make it sound like + // TODO: Figure out how this actually works because the 2024-02-27 tuning notes make it sound like // this is not just a fully passive stat boost shaman.AddStat(stats.MP5, shaman.GetStat(stats.Intellect)*.15) @@ -337,7 +319,7 @@ func (shaman *Shaman) applyWayOfEarth() { } // Way of Earth only activates if you have Rockbiter Weapon on your mainhand and a shield in your offhand - if shaman.Consumes.MainHandImbue != proto.WeaponImbue_RockbiterWeapon && (shaman.OffHand() == nil || shaman.OffHand().WeaponType != proto.WeaponType_WeaponTypeShield) { + if shaman.Consumes.MainHandImbue != proto.WeaponImbue_RockbiterWeapon && shaman.OffHand().WeaponType != proto.WeaponType_WeaponTypeShield { return } diff --git a/sim/shaman/shaman.go b/sim/shaman/shaman.go index c1ce146428..045f4c05b2 100644 --- a/sim/shaman/shaman.go +++ b/sim/shaman/shaman.go @@ -14,6 +14,7 @@ const ( SpellFlagElectric = core.SpellFlagAgentReserved1 SpellFlagTotem = core.SpellFlagAgentReserved2 SpellFlagFocusable = core.SpellFlagAgentReserved3 + SpellFlagMaelstrom = core.SpellFlagAgentReserved4 ) func NewShaman(character *core.Character, talents string, selfBuffs SelfBuffs) *Shaman { From cc0524c37b7458cd0e35e6e846e5e5ac20c768b9 Mon Sep 17 00:00:00 2001 From: vigo Date: Mon, 22 Apr 2024 09:21:55 +0200 Subject: [PATCH 2/2] [shaman] Fix Way of Earth precons --- sim/shaman/runes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/shaman/runes.go b/sim/shaman/runes.go index ccba4ec287..58bbc66f92 100644 --- a/sim/shaman/runes.go +++ b/sim/shaman/runes.go @@ -319,7 +319,7 @@ func (shaman *Shaman) applyWayOfEarth() { } // Way of Earth only activates if you have Rockbiter Weapon on your mainhand and a shield in your offhand - if shaman.Consumes.MainHandImbue != proto.WeaponImbue_RockbiterWeapon && shaman.OffHand().WeaponType != proto.WeaponType_WeaponTypeShield { + if shaman.Consumes.MainHandImbue != proto.WeaponImbue_RockbiterWeapon || shaman.OffHand().WeaponType != proto.WeaponType_WeaponTypeShield { return }