From c83e34418cbb4c65a79ed601a20dd44b743fe926 Mon Sep 17 00:00:00 2001 From: Horatio Date: Tue, 28 Nov 2023 20:01:24 -0400 Subject: [PATCH] Added Registration of ItemSwapCallback to Black Bruise --- sim/common/wotlk/enchant_effects.go | 4 ++-- sim/common/wotlk/other_effects.go | 4 +++- sim/core/item_swaps.go | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/sim/common/wotlk/enchant_effects.go b/sim/common/wotlk/enchant_effects.go index ba349525be..84dd4fe82e 100644 --- a/sim/common/wotlk/enchant_effects.go +++ b/sim/common/wotlk/enchant_effects.go @@ -144,7 +144,7 @@ func init() { }, }) - character.ItemSwap.RegisterOnSwapItemForEffect(3748, aura) + character.ItemSwap.RegisterOnSwapItemForEnchantEffect(3748, aura) }) core.NewEnchantEffect(3247, func(agent core.Agent) { @@ -259,7 +259,7 @@ func init() { }, }) - character.ItemSwap.RegisterOnSwapItemForEffect(3790, aura) + character.ItemSwap.RegisterOnSwapItemForEnchantEffect(3790, aura) }) core.AddWeaponEffect(3843, func(agent core.Agent, _ proto.ItemSlot) { diff --git a/sim/common/wotlk/other_effects.go b/sim/common/wotlk/other_effects.go index b2bbbaaaa4..c4fb16e840 100644 --- a/sim/common/wotlk/other_effects.go +++ b/sim/common/wotlk/other_effects.go @@ -988,7 +988,7 @@ func init() { }, }) - core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{ + aura := core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{ Name: name + " Trigger", Callback: core.CallbackOnSpellHitDealt, ProcMask: core.ProcMaskMelee, @@ -998,6 +998,8 @@ func init() { procAura.Activate(sim) }, }) + + character.ItemSwap.RegisterOnSwapItemForItemEffect(itemID, aura) }) }) diff --git a/sim/core/item_swaps.go b/sim/core/item_swaps.go index 550c0d3193..7358fd2699 100644 --- a/sim/core/item_swaps.go +++ b/sim/core/item_swaps.go @@ -70,8 +70,22 @@ func (swap *ItemSwap) RegisterOnSwapItemForEffectWithPPMManager(effectID int32, } +// Helper for handling Effects that use the itemID to toggle the aura on and off +func (swap *ItemSwap) RegisterOnSwapItemForItemEffect(itemID int32, aura *Aura) { + character := swap.character + character.RegisterOnItemSwap(func(sim *Simulation) { + procMask := character.GetProcMaskForItem(itemID) + + if procMask == ProcMaskUnknown { + aura.Deactivate(sim) + } else { + aura.Activate(sim) + } + }) +} + // Helper for handling Effects that use the effectID to toggle the aura on and off -func (swap *ItemSwap) RegisterOnSwapItemForEffect(effectID int32, aura *Aura) { +func (swap *ItemSwap) RegisterOnSwapItemForEnchantEffect(effectID int32, aura *Aura) { character := swap.character character.RegisterOnItemSwap(func(sim *Simulation) { procMask := character.GetProcMaskForEnchant(effectID)