Skip to content

Commit

Permalink
Merge pull request #125 from wowsims/shaman
Browse files Browse the repository at this point in the history
Fix Shaman Maelstrom Weapon
  • Loading branch information
kayla-glick authored Feb 7, 2024
2 parents 478849a + 14f6033 commit f9d0b0f
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 29 deletions.
2 changes: 1 addition & 1 deletion sim/shaman/chain_heal.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (shaman *Shaman) newChainHealSpellConfig(rank int, isOverload bool) core.Sp

spell := core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellCode: int32(SpellCode_ChainHeal),
SpellCode: SpellCode_ShamanChainHeal,
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellHealing,
Flags: flags,
Expand Down
2 changes: 1 addition & 1 deletion sim/shaman/chain_lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (shaman *Shaman) newChainLightningSpellConfig(rank int, isOverload bool) co
isOverload,
)

spell.SpellCode = int32(SpellCode_ShamanChainLightning)
spell.SpellCode = SpellCode_ShamanChainLightning
spell.RequiredLevel = level
spell.Rank = rank

Expand Down
18 changes: 9 additions & 9 deletions sim/shaman/fire_totems.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (shaman *Shaman) newSearingTotemSpellConfig(rank int) core.SpellConfig {

spell := core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellCode: int32(SpellCode_SearingTotem),
SpellCode: SpellCode_SearingTotem,
SpellSchool: core.SpellSchoolFire,
ProcMask: core.ProcMaskEmpty,
Flags: SpellFlagTotem | core.SpellFlagAPL,
Expand Down Expand Up @@ -83,10 +83,10 @@ func (shaman *Shaman) newSearingTotemSpellConfig(rank int) core.SpellConfig {
},

ApplyEffects: func(sim *core.Simulation, _ *core.Unit, spell *core.Spell) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == int32(SpellCode_MagmaTotem) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == SpellCode_MagmaTotem {
shaman.ActiveTotems[FireTotem].AOEDot().Cancel(sim)
}
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == int32(SpellCode_FireNovaTotem) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == SpellCode_FireNovaTotem {
shaman.ActiveTotems[FireTotem].AOEDot().Cancel(sim)
}
spell.Dot(sim.GetTargetUnit(0)).Apply(sim)
Expand Down Expand Up @@ -131,7 +131,7 @@ func (shaman *Shaman) newMagmaTotemSpellConfig(rank int) core.SpellConfig {

spell := core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellCode: int32(SpellCode_MagmaTotem),
SpellCode: SpellCode_MagmaTotem,
SpellSchool: core.SpellSchoolFire,
ProcMask: core.ProcMaskEmpty,
Flags: SpellFlagTotem | core.SpellFlagAPL,
Expand Down Expand Up @@ -172,10 +172,10 @@ func (shaman *Shaman) newMagmaTotemSpellConfig(rank int) core.SpellConfig {
},

ApplyEffects: func(sim *core.Simulation, _ *core.Unit, spell *core.Spell) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == int32(SpellCode_SearingTotem) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == SpellCode_SearingTotem {
shaman.ActiveTotems[FireTotem].Dot(shaman.CurrentTarget).Cancel(sim)
}
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == int32(SpellCode_FireNovaTotem) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == SpellCode_FireNovaTotem {
shaman.ActiveTotems[FireTotem].AOEDot().Cancel(sim)
}
spell.AOEDot().Apply(sim)
Expand Down Expand Up @@ -227,7 +227,7 @@ func (shaman *Shaman) newFireNovaTotemSpellConfig(rank int) core.SpellConfig {
spell := core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellSchool: core.SpellSchoolFire,
SpellCode: int32(SpellCode_FireNovaTotem),
SpellCode: SpellCode_FireNovaTotem,
ProcMask: core.ProcMaskEmpty,
Flags: SpellFlagTotem | core.SpellFlagAPL,

Expand Down Expand Up @@ -271,10 +271,10 @@ func (shaman *Shaman) newFireNovaTotemSpellConfig(rank int) core.SpellConfig {
},

ApplyEffects: func(sim *core.Simulation, _ *core.Unit, spell *core.Spell) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == int32(SpellCode_SearingTotem) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == SpellCode_SearingTotem {
shaman.ActiveTotems[FireTotem].Dot(shaman.CurrentTarget).Cancel(sim)
}
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == int32(SpellCode_MagmaTotem) {
if shaman.ActiveTotems[FireTotem] != nil && shaman.ActiveTotems[FireTotem].SpellCode == SpellCode_MagmaTotem {
shaman.ActiveTotems[FireTotem].AOEDot().Cancel(sim)
}
spell.AOEDot().Apply(sim)
Expand Down
2 changes: 1 addition & 1 deletion sim/shaman/healing_wave.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (shaman *Shaman) newHealingWaveSpellConfig(rank int, isOverload bool) core.

spell := core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellCode: int32(SpellCode_HealingWave),
SpellCode: SpellCode_ShamanHealingWave,
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellHealing,
Flags: flags,
Expand Down
1 change: 1 addition & 0 deletions sim/shaman/lava_burst.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (shaman *Shaman) newLavaBurstSpellConfig(isOverload bool) core.SpellConfig

spell := core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellCode: SpellCode_ShamanLavaBurst,
SpellSchool: core.SpellSchoolFire,
ProcMask: core.ProcMaskSpellDamage,
Flags: flags,
Expand Down
2 changes: 1 addition & 1 deletion sim/shaman/lesser_healing_wave.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (shaman *Shaman) newLesserHealingWaveSpellConfig(rank int) core.SpellConfig

spell := core.SpellConfig{
ActionID: core.ActionID{SpellID: spellId},
SpellCode: int32(SpellCode_LesserHealingWave),
SpellCode: SpellCode_ShamanLesserHealingWave,
SpellSchool: core.SpellSchoolNature,
ProcMask: core.ProcMaskSpellHealing,
Flags: core.SpellFlagHelpful | core.SpellFlagAPL,
Expand Down
2 changes: 1 addition & 1 deletion sim/shaman/lightning_bolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (shaman *Shaman) newLightningBoltSpellConfig(rank int, isOverload bool) cor
time.Millisecond*time.Duration(castTime),
isOverload,
)
spell.SpellCode = int32(SpellCode_ShamanLightningBolt)
spell.SpellCode = SpellCode_ShamanLightningBolt
spell.RequiredLevel = level
spell.Rank = rank

Expand Down
19 changes: 16 additions & 3 deletions sim/shaman/runes.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package shaman

import (
"slices"
"time"

"github.com/wowsims/sod/sim/core"
Expand Down Expand Up @@ -148,6 +149,7 @@ func (shaman *Shaman) applyMaelstromWeapon() {
ppm := 10.0

var affectedSpells []*core.Spell
var affectedSpellCodes []int32
// TODO: Don't forget to make it so that AA don't reset when casting when MW is active
// for LB / CL / LvB
// They can't actually hit while casting, but the AA timer doesnt reset if you cast during the AA timer.
Expand All @@ -163,21 +165,32 @@ func (shaman *Shaman) applyMaelstromWeapon() {
core.Flatten([][]*core.Spell{
shaman.LightningBolt,
shaman.ChainLightning,
{shaman.LavaBurst},
shaman.HealingWave,
shaman.LesserHealingWave,
shaman.ChainHeal,
{shaman.LavaBurst},
}), func(spell *core.Spell) bool { return spell != nil },
)

affectedSpellCodes = []int32{
SpellCode_ShamanLightningBolt,
SpellCode_ShamanChainLightning,
SpellCode_ShamanLavaBurst,
SpellCode_ShamanHealingWave,
SpellCode_ShamanLesserHealingWave,
SpellCode_ShamanChainHeal,
}
},
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 })
},
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if !spell.Flags.Matches(SpellFlagElectric) {
if !slices.Contains(affectedSpellCodes, spell.SpellCode) {
return
}

shaman.MaelstromWeaponAura.Deactivate(sim)
},
})
Expand Down Expand Up @@ -250,7 +263,7 @@ func (shaman *Shaman) applyPowerSurge() {
core.Each(spellsAffectedByInstantCast, func(spell *core.Spell) { spell.CastTimeMultiplier += 1 })
},
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if spell.SpellCode != int32(SpellCode_ShamanChainLightning) && spell.SpellCode != int32(SpellCode_ChainHeal) && spell != shaman.LavaBurst {
if spell.SpellCode != SpellCode_ShamanChainLightning && spell.SpellCode != SpellCode_ShamanChainHeal && spell != shaman.LavaBurst {
return
}
aura.Deactivate(sim)
Expand Down
12 changes: 6 additions & 6 deletions sim/shaman/shaman.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ const (
WaterTotem
)

type ShamanSpellCode int

const (
SpellCode_ShamanLightningBolt ShamanSpellCode = iota
SpellCode_ShamanNone int32 = iota
SpellCode_ShamanLightningBolt
SpellCode_ShamanChainLightning
SpellCode_ShamanLavaBurst

SpellCode_HealingWave
SpellCode_LesserHealingWave
SpellCode_ChainHeal
SpellCode_ShamanHealingWave
SpellCode_ShamanLesserHealingWave
SpellCode_ShamanChainHeal

SpellCode_SearingTotem
SpellCode_MagmaTotem
Expand Down
12 changes: 6 additions & 6 deletions sim/shaman/talents.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (shaman *Shaman) registerElementalMasteryCD() {
})
},
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if spell.SpellCode != int32(SpellCode_ShamanLightningBolt) && spell.SpellCode != int32(SpellCode_ShamanChainLightning) && spell != shaman.LavaBurst {
if spell.SpellCode != SpellCode_ShamanLightningBolt && spell.SpellCode != SpellCode_ShamanChainLightning && spell != shaman.LavaBurst {
return
}
// Remove the buff and put skill on CD
Expand Down Expand Up @@ -230,11 +230,11 @@ func (shaman *Shaman) registerNaturesSwiftnessCD() {
core.Each(affectedSpells, func(spell *core.Spell) { spell.CastTimeMultiplier += 1 })
},
OnCastComplete: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell) {
spellTriggersNS := spell.SpellCode != int32(SpellCode_ShamanLightningBolt) &&
spell.SpellCode != int32(SpellCode_ShamanChainLightning) &&
spell.SpellCode != int32(SpellCode_HealingWave) &&
spell.SpellCode != int32(SpellCode_LesserHealingWave) &&
spell.SpellCode != int32(SpellCode_ChainHeal)
spellTriggersNS := spell.SpellCode != SpellCode_ShamanLightningBolt &&
spell.SpellCode != SpellCode_ShamanChainLightning &&
spell.SpellCode != SpellCode_ShamanHealingWave &&
spell.SpellCode != SpellCode_ShamanLesserHealingWave &&
spell.SpellCode != SpellCode_ShamanChainHeal

if spellTriggersNS {
return
Expand Down

0 comments on commit f9d0b0f

Please sign in to comment.