Core/Auras: Prevent assertion fail due code in AuraEffect::HandleAuraLinked, also improve the sync between auras linked by this aura type.
This commit is contained in:
@@ -6554,25 +6554,38 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const * aurApp, uint8 mod
|
||||
|
||||
void AuraEffect::HandleAuraLinked(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & (AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY)))
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
Unit * caster = GetTriggeredSpellCaster(m_spellProto, GetCaster(), target);
|
||||
uint32 triggeredSpellId = m_spellProto->EffectTriggerSpell[m_effIndex];
|
||||
|
||||
if (!caster)
|
||||
return;
|
||||
// If amount avalible cast with basepoints (Crypt Fever for example)
|
||||
if (GetAmount())
|
||||
caster->CastCustomSpell(target, m_spellProto->EffectTriggerSpell[m_effIndex], &m_amount, NULL, NULL, true, NULL, this);
|
||||
if (mode & AURA_EFFECT_HANDLE_REAL)
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
Unit * caster = GetTriggeredSpellCaster(m_spellProto, GetCaster(), target);
|
||||
|
||||
if (!caster)
|
||||
return;
|
||||
// If amount avalible cast with basepoints (Crypt Fever for example)
|
||||
if (GetAmount())
|
||||
caster->CastCustomSpell(target, triggeredSpellId, &m_amount, NULL, NULL, true, NULL, this);
|
||||
else
|
||||
caster->CastSpell(target, triggeredSpellId, true, NULL, this);
|
||||
}
|
||||
else
|
||||
caster->CastSpell(target, m_spellProto->EffectTriggerSpell[m_effIndex], true, NULL, this);
|
||||
{
|
||||
uint64 casterGUID = IsSpellRequiringFocusedTarget(GetSpellProto()) ? GetCasterGUID() : target->GetGUID();
|
||||
target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
|
||||
}
|
||||
}
|
||||
else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
|
||||
{
|
||||
uint64 casterGUID = IsSpellRequiringFocusedTarget(GetSpellProto()) ? GetCasterGUID() : target->GetGUID();
|
||||
|
||||
// change the stack amount to be equal to stack amount of our aura
|
||||
if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
|
||||
triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
|
||||
}
|
||||
else
|
||||
target->RemoveAura(m_spellProto->EffectTriggerSpell[m_effIndex], GetCasterGUID(), 0, AuraRemoveMode(aurApp->GetRemoveMode()));
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraOpenStable(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
|
||||
Reference in New Issue
Block a user