mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Implement warlock talent Death's Embrace (#30164)
This commit is contained in:
9
sql/updates/world/master/2024_09_08_01_world.sql
Normal file
9
sql/updates/world/master/2024_09_08_01_world.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warl_deaths_embrace';
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warl_deaths_embrace_dots';
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warl_deaths_embrace_drain_life';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(324540, 'spell_warl_deaths_embrace'),
|
||||
(980, 'spell_warl_deaths_embrace_dots'),
|
||||
(146739, 'spell_warl_deaths_embrace_dots'),
|
||||
(316099, 'spell_warl_deaths_embrace_dots'),
|
||||
(234153, 'spell_warl_deaths_embrace_drain_life');
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user