Skip to content

Commit

Permalink
Merge pull request #4068 from Horatio27/fix_black_bruise
Browse files Browse the repository at this point in the history
Added Registration of ItemSwapCallback to Black Bruise
  • Loading branch information
Horatio27 authored Nov 29, 2023
2 parents c45eb51 + c83e344 commit dac6877
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sim/common/wotlk/enchant_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func init() {
},
})

character.ItemSwap.RegisterOnSwapItemForEffect(3748, aura)
character.ItemSwap.RegisterOnSwapItemForEnchantEffect(3748, aura)
})

core.NewEnchantEffect(3247, func(agent core.Agent) {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion sim/common/wotlk/other_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -998,6 +998,8 @@ func init() {
procAura.Activate(sim)
},
})

character.ItemSwap.RegisterOnSwapItemForItemEffect(itemID, aura)
})
})

Expand Down
16 changes: 15 additions & 1 deletion sim/core/item_swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dac6877

Please sign in to comment.