From e48cdc6c068520bed17df98f0dfd7612dc903a79 Mon Sep 17 00:00:00 2001 From: Aqua Deus <95978183+aquadeus@users.noreply.github.com> Date: Sat, 7 Sep 2024 12:36:20 +0200 Subject: Scripts/Spells: Update Drain Soul script (#30160) --- src/server/scripts/Spells/spell_warlock.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 78be4204ee0..c844001eda5 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -406,9 +406,10 @@ class spell_warl_doom : public AuraScript // 198590 - Drain Soul class spell_warl_drain_soul : public AuraScript { - bool Validate(SpellInfo const* /*spellInfo*/) override + bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo ({ SPELL_WARLOCK_DRAIN_SOUL_ENERGIZE }); + return ValidateSpellInfo ({ SPELL_WARLOCK_DRAIN_SOUL_ENERGIZE }) + && ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } }); } void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -420,9 +421,16 @@ class spell_warl_drain_soul : public AuraScript caster->CastSpell(caster, SPELL_WARLOCK_DRAIN_SOUL_ENERGIZE, true); } + void CalculateDamage(AuraEffect const* /*aurEff*/, Unit const* victim, int32& /*damage*/, int32& /*flatMod*/, float& pctMod) const + { + if (victim->HealthBelowPct(GetEffectInfo(EFFECT_2).CalcValue(GetCaster()))) + AddPct(pctMod, GetEffectInfo(EFFECT_1).CalcValue(GetCaster())); + } + void Register() override { AfterEffectRemove += AuraEffectApplyFn(spell_warl_drain_soul::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcDamageAndHealing += AuraEffectCalcDamageFn(spell_warl_drain_soul::CalculateDamage, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); } }; -- cgit v1.2.3