Skip to content

Commit

Permalink
Merge pull request #714 from vigo2/vigo/perfFix
Browse files Browse the repository at this point in the history
CreateWeaponProc{Spell,Aura} Perf Fix
  • Loading branch information
vigo2 authored Apr 21, 2024
2 parents 7c94ed5 + 1b017a2 commit 5a46455
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions sim/common/itemhelpers/weaponprocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ func CreateWeaponProcSpell(itemId int32, itemName string, ppm float64, procSpell

procMask := character.GetProcMaskForItem(itemId)
ppmm := character.AutoAttacks.NewPPMManager(ppm, procMask)
procLabel := itemName + " Proc"

core.MakePermanent(character.GetOrRegisterAura(core.Aura{
Label: fmt.Sprintf("%s Proc Aura", itemName),
Label: itemName + " Proc Aura",
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if result.Landed() && ppmm.Proc(sim, spell.ProcMask, fmt.Sprintf("%s Proc", itemName)) {
if result.Landed() && ppmm.Proc(sim, spell.ProcMask, procLabel) {
procSpell.Cast(sim, result.Target)
}
},
Expand All @@ -93,14 +94,16 @@ func CreateWeaponProcAura(itemId int32, itemName string, ppm float64, procAuraGe
character := agent.GetCharacter()

procAura := procAuraGenerator(character)

procMask := character.GetProcMaskForItem(itemId)
ppmm := character.AutoAttacks.NewPPMManager(ppm, procMask)
procLabel := itemName + " Proc"

core.MakePermanent(character.GetOrRegisterAura(core.Aura{
Label: fmt.Sprintf("%s Proc Aura", itemName),
Label: itemName + " Proc Aura",
Duration: core.NeverExpires,
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if result.Landed() && ppmm.Proc(sim, spell.ProcMask, fmt.Sprintf("%s Proc", itemName)) {
if result.Landed() && ppmm.Proc(sim, spell.ProcMask, procLabel) {
procAura.Activate(sim)
}
},
Expand Down

0 comments on commit 5a46455

Please sign in to comment.