aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua Deus <95978183+aquadeus@users.noreply.github.com>2024-09-08 21:28:13 +0200
committerGitHub <noreply@github.com>2024-09-08 21:28:13 +0200
commit10b50d752b548aac9ccd3ec6b1b1367c37b8f9f0 (patch)
treecbc823df583720927c82059dc56f60cc2e0b1618 /src
parent7f6afa67f3fea03c85277f7d536d5779a77bc824 (diff)
Scripts/Spells: Implement warlock talent Death's Embrace (#30164)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 3c7fdd54339..8728b622e4b 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -44,6 +44,7 @@ enum WarlockSpells
SPELL_WARLOCK_CORRUPTION_DAMAGE = 146739,
SPELL_WARLOCK_CREATE_HEALTHSTONE = 23517,
SPELL_WARLOCK_CURSE_OF_EXHAUSTION = 334275,
+ SPELL_WARLOCK_DEATHS_EMBRACE = 453189,
SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388,
SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018,
SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020,
@@ -297,6 +298,86 @@ class spell_warl_dark_pact : public AuraScript
}
};
+struct spell_warl_deaths_embrace_impl
+{
+ static void HandleDamageOrHealingCalculation(Unit const* caster, Unit const* target, float& pctMod, SpellEffIndex inreaseEffect, SpellEffIndex healthLimitEffect)
+ {
+ Aura const* deathsEmbrace = caster->GetAura(SPELL_WARLOCK_DEATHS_EMBRACE, ObjectGuid::Empty, ObjectGuid::Empty, 1 << inreaseEffect | 1 << healthLimitEffect);
+ if (!deathsEmbrace)
+ return;
+
+ if (!target->HealthBelowPct(deathsEmbrace->GetEffect(healthLimitEffect)->GetAmount()))
+ return;
+
+ AddPct(pctMod, deathsEmbrace->GetEffect(inreaseEffect)->GetAmount());
+ }
+};
+
+// Called by 324540 - Malefic Rapture
+class spell_warl_deaths_embrace : public SpellScript
+{
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellEffect({ { SPELL_WARLOCK_DEATHS_EMBRACE, EFFECT_3 } });
+ }
+
+ void HandleDamageCalculation(Unit const* victim, int32 const& /*damage*/, int32 const& /*flatMod*/, float& pctMod) const
+ {
+ spell_warl_deaths_embrace_impl::HandleDamageOrHealingCalculation(GetCaster(), victim, pctMod, EFFECT_2, EFFECT_3);
+ }
+
+ void Register() override
+ {
+ CalcDamage += SpellCalcDamageFn(spell_warl_deaths_embrace::HandleDamageCalculation);
+ }
+};
+
+// Called by 980 - Agony, 146739 - Corruption and 316099 - Unstable Affliction
+class spell_warl_deaths_embrace_dots : public AuraScript
+{
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellEffect({ { SPELL_WARLOCK_DEATHS_EMBRACE, EFFECT_3 } });
+ }
+
+ void CalculateDamage(AuraEffect const* /*aurEff*/, Unit const* victim, int32& /*damage*/, int32& /*flatMod*/, float& pctMod) const
+ {
+ if (Unit const* caster = GetCaster())
+ spell_warl_deaths_embrace_impl::HandleDamageOrHealingCalculation(caster, victim, pctMod, EFFECT_2, EFFECT_3);
+ }
+
+ void Register() override
+ {
+ DoEffectCalcDamageAndHealing += AuraEffectCalcDamageFn(spell_warl_deaths_embrace_dots::CalculateDamage, EFFECT_ALL, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+};
+
+// 234153 - Drain Life
+class spell_warl_deaths_embrace_drain_life : public AuraScript
+{
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellEffect({ { SPELL_WARLOCK_DEATHS_EMBRACE, EFFECT_1 } });
+ }
+
+ void CalculateHeal(AuraEffect const* /*aurEff*/, Unit const* victim, int32& /*damage*/, int32& /*flatMod*/, float& pctMod) const
+ {
+ Unit const* caster = GetCaster();
+ if (!caster)
+ return;
+
+ if (caster != victim) // check who is being targeted, this hook is called for both damage and healing of PERIODIC_LEECH
+ return;
+
+ spell_warl_deaths_embrace_impl::HandleDamageOrHealingCalculation(caster, caster, pctMod, EFFECT_0, EFFECT_1);
+ }
+
+ void Register() override
+ {
+ DoEffectCalcDamageAndHealing += AuraEffectCalcHealingFn(spell_warl_deaths_embrace_drain_life::CalculateHeal, EFFECT_0, SPELL_AURA_PERIODIC_LEECH);
+ }
+};
+
// 48018 - Demonic Circle: Summon
class spell_warl_demonic_circle_summon : public AuraScript
{
@@ -1267,6 +1348,9 @@ void AddSC_warlock_spell_scripts()
RegisterSpellScript(spell_warl_absolute_corruption);
RegisterSpellScript(spell_warl_create_healthstone);
RegisterSpellScript(spell_warl_dark_pact);
+ RegisterSpellScript(spell_warl_deaths_embrace);
+ RegisterSpellScript(spell_warl_deaths_embrace_dots);
+ RegisterSpellScript(spell_warl_deaths_embrace_drain_life);
RegisterSpellScript(spell_warl_demonic_circle_summon);
RegisterSpellScript(spell_warl_demonic_circle_teleport);
RegisterSpellScript(spell_warl_devour_magic);