Skip to content

Commit

Permalink
Merge pull request #813 from wowsims/p4/priest
Browse files Browse the repository at this point in the history
Priest rune updates
  • Loading branch information
kayla-glick authored Jun 22, 2024
2 parents c6f433b + 4c20b16 commit 47ddecf
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 122 deletions.
9 changes: 5 additions & 4 deletions sim/core/aura.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ func (aura *Aura) Refresh(sim *Simulation) {
sim.rescheduleTracker(aura.expires)
}
}

if sim.Log != nil && aura.IsActive() && !aura.ActionID.IsEmptyAction() {
aura.Unit.Log(sim, "Aura refreshed: %s", aura.ActionID)
}
}

func (aura *Aura) GetStacks() int32 {
Expand Down Expand Up @@ -549,9 +553,6 @@ restart:
func (aura *Aura) Activate(sim *Simulation) {
aura.metrics.Procs++
if aura.IsActive() {
if sim.Log != nil && !aura.ActionID.IsEmptyAction() {
aura.Unit.Log(sim, "Aura refreshed: %s", aura.ActionID)
}
aura.Refresh(sim)
return
}
Expand All @@ -575,9 +576,9 @@ func (aura *Aura) Activate(sim *Simulation) {
}
}

aura.active = true
aura.startTime = sim.CurrentTime
aura.Refresh(sim)
aura.active = true

if aura.Duration != NeverExpires {
aura.activeIndex = int32(len(aura.Unit.activeAuras))
Expand Down
20 changes: 6 additions & 14 deletions sim/priest/mind_blast.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func (priest *Priest) getMindBlastBaseConfig(rank int, cdTimer *core.Timer) core
manaCost := MindBlastManaCost[rank]
level := MindBlastLevel[rank]

hasPainAndSuffering := priest.HasRune(proto.PriestRune_RuneHelmPainAndSuffering)
hasMindSpike := priest.HasRune(proto.PriestRune_RuneWaistMindSpike)

return core.SpellConfig{
SpellCode: SpellCode_PriestMindBlast,
ActionID: core.ActionID{SpellID: spellId},
SpellSchool: core.SpellSchoolShadow,
DefenseType: core.DefenseTypeMagic,
Expand Down Expand Up @@ -72,14 +72,14 @@ func (priest *Priest) getMindBlastBaseConfig(rank int, cdTimer *core.Timer) core
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
baseDamage := sim.Roll(baseDamageLow, baseDamageHigh)

var mindSpike *core.Aura
var mindSpikeAura *core.Aura
if hasMindSpike {
mindSpike = priest.MindSpikeAuras.Get(target)
mindSpikeAura = priest.MindSpikeAuras.Get(target)
}

oldBonusCrit := spell.BonusCritRating
oldMultiplier := spell.DamageMultiplier
spell.BonusCritRating += float64(mindSpike.GetStacks()) * 30 * core.CritRatingPerCritChance
spell.BonusCritRating += float64(mindSpikeAura.GetStacks()) * 30 * core.CritRatingPerCritChance
spell.DamageMultiplier *= priest.MindBlastModifier

result := spell.CalcDamage(sim, target, baseDamage, spell.OutcomeMagicHitAndCrit)
Expand All @@ -89,16 +89,8 @@ func (priest *Priest) getMindBlastBaseConfig(rank int, cdTimer *core.Timer) core

if result.Landed() {
priest.AddShadowWeavingStack(sim, target)
if mindSpike != nil {
mindSpike.Deactivate(sim)
}

if hasPainAndSuffering {
for _, spell := range priest.ShadowWordPain {
if spell != nil && spell.Dot(target).IsActive() {
spell.Dot(target).Rollover(sim)
}
}
if mindSpikeAura != nil {
mindSpikeAura.Deactivate(sim)
}
}

Expand Down
1 change: 1 addition & 0 deletions sim/priest/mind_flay.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (priest *Priest) newMindFlaySpellConfig(rank int, tickIdx int32) core.Spell
hasDespairRune := priest.HasRune(proto.PriestRune_RuneBracersDespair)

return core.SpellConfig{
SpellCode: SpellCode_PriestMindFlay,
ActionID: core.ActionID{SpellID: spellId}.WithTag(tickIdx),
SpellSchool: core.SpellSchoolShadow,
DefenseType: core.DefenseTypeMagic,
Expand Down
6 changes: 2 additions & 4 deletions sim/priest/mind_sear.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ func (priest *Priest) newMindSearSpellConfig(tickIdx int32) core.SpellConfig {
TickLength: tickLength,
OnTick: func(sim *core.Simulation, target *core.Unit, dot *core.Dot) {
for _, aoeTarget := range sim.Encounter.TargetUnits {
if aoeTarget != target {
mindSearTickSpell.Cast(sim, aoeTarget)
mindSearTickSpell.SpellMetrics[target.UnitIndex].Casts -= 1
}
mindSearTickSpell.Cast(sim, aoeTarget)
mindSearTickSpell.SpellMetrics[target.UnitIndex].Casts -= 1
}
},
},
Expand Down
1 change: 1 addition & 0 deletions sim/priest/mind_spike.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (priest *Priest) newMindSpikeSpellConfig() core.SpellConfig {
})

return core.SpellConfig{
SpellCode: SpellCode_PriestMindSpike,
ActionID: core.ActionID{SpellID: int32(proto.PriestRune_RuneWaistMindSpike)},
SpellSchool: core.SpellSchoolShadow | core.SpellSchoolFrost,
DefenseType: core.DefenseTypeMagic,
Expand Down
11 changes: 8 additions & 3 deletions sim/priest/priest.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const (
SpellCode_PriestFlashHeal
SpellCode_PriestGreaterHeal
SpellCode_PriestHeal
SpellCode_PriestMindBlast
SpellCode_PriestMindFlay
SpellCode_PriestMindSpike
SpellCode_PriestHolyFire
SpellCode_PriestSmite
)
Expand Down Expand Up @@ -56,6 +59,7 @@ type Priest struct {
ShadowWordDeath *core.Spell
ShadowWordPain []*core.Spell
Smite []*core.Spell
VampiricEmbrace *core.Spell
VampiricTouch *core.Spell
VoidPlague *core.Spell

Expand All @@ -67,9 +71,10 @@ type Priest struct {
ShadowformAura *core.Aura
SurgeOfLightAura *core.Aura

MindSpikeAuras core.AuraArray
ShadowWeavingAuras core.AuraArray
WeakenedSouls core.AuraArray
MindSpikeAuras core.AuraArray
ShadowWeavingAuras core.AuraArray
VampiricEmbraceAuras core.AuraArray
WeakenedSouls core.AuraArray

EyeOfTheVoidPet *EyeOfTheVoid
HomunculiPets []*Homunculus
Expand Down
43 changes: 43 additions & 0 deletions sim/priest/runes.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package priest

import (
"slices"
"time"

"github.com/wowsims/sod/sim/core"
Expand All @@ -10,6 +11,7 @@ import (
func (priest *Priest) ApplyRunes() {
// Head
priest.registerEyeOfTheVoidCD()
priest.applyPainAndSuffering()

// Cloak
priest.registerVampiricTouchSpell()
Expand Down Expand Up @@ -39,6 +41,47 @@ func (priest *Priest) ApplyRunes() {
priest.registerShadowfiendSpell()
}

func (priest *Priest) applyPainAndSuffering() {
if !priest.HasRune(proto.PriestRune_RuneHelmPainAndSuffering) {
return
}

affectedSpellcodes := []int32{SpellCode_PriestMindBlast, SpellCode_PriestMindFlay, SpellCode_PriestMindSpike}
priest.RegisterAura(core.Aura{
Label: "Pain and Suffering Trigger",
Duration: core.NeverExpires,
OnReset: func(aura *core.Aura, sim *core.Simulation) {
aura.Activate(sim)
},
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if slices.Contains(affectedSpellcodes, spell.SpellCode) && result.Landed() {
target := result.Target

var dotToRollover *core.Dot
dotSpells := core.FilterSlice(
core.Flatten([][]*core.Spell{priest.ShadowWordPain, {priest.VoidPlague, priest.VampiricTouch}}),
func(spell *core.Spell) bool {
return spell != nil && spell.Dot(target).IsActive()
},
)

if len(dotSpells) > 0 {
dotToRollover = dotSpells[0].Dot(target)
for _, spell := range dotSpells {
dot := spell.Dot(target)
if dot.RemainingDuration(sim) < dotToRollover.RemainingDuration(sim) {
dotToRollover = dot
}
}

dotToRollover.NumberOfTicks = dotToRollover.OriginalNumberOfTicks
dotToRollover.Rollover(sim)
}
}
},
})
}

func (priest *Priest) applySurgeOfLight() {
if !priest.HasRune(proto.PriestRune_RuneBracersSurgeOfLight) {
return
Expand Down
Loading

0 comments on commit 47ddecf

Please sign in to comment.