fix(Scripts/Spells): Drain Soul generates Soul Shard only from targets that yields experience or honor on death. (#9417)

Fixes #9083
This commit is contained in:
UltraNix
2021-12-05 23:53:14 +01:00
committed by GitHub
parent 57a3b53b59
commit 16cac81e5a

View File

@@ -1123,6 +1123,16 @@ class spell_warl_drain_soul : public AuraScript
});
}
void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
Unit* target = GetTarget();
if (!(GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH && caster && target && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target)))
{
PreventDefaultAction();
}
}
bool CheckProc(ProcEventInfo& eventInfo)
{
// Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling.
@@ -1178,6 +1188,7 @@ class spell_warl_drain_soul : public AuraScript
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_warl_drain_soul::RemoveEffect, EFFECT_0, SPELL_AURA_CHANNEL_DEATH_ITEM, AURA_EFFECT_HANDLE_REAL);
DoCheckProc += AuraCheckProcFn(spell_warl_drain_soul::CheckProc);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_drain_soul::HandleTick, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE);
OnEffectProc += AuraEffectProcFn(spell_warl_drain_soul::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL);