aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua Deus <95978183+aquadeus@users.noreply.github.com>2024-09-07 12:36:20 +0200
committerGitHub <noreply@github.com>2024-09-07 12:36:20 +0200
commite48cdc6c068520bed17df98f0dfd7612dc903a79 (patch)
tree4e33bd50de4aa018932150a31e75e1c9539c5f20
parent010550da224c446461b26bc4f38ee5cc35d4aa3d (diff)
Scripts/Spells: Update Drain Soul script (#30160)
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp12
1 files changed, 10 insertions, 2 deletions
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);
}
};