diff options
| author | Cristian Vintila <127750549+cristianvnt@users.noreply.github.com> | 2025-12-22 01:41:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-22 00:41:39 +0100 |
| commit | a4bbb6197002d76d084ced8a0f6fa79ff7bcc922 (patch) | |
| tree | c0832d1531d10b47ae9626ddd933bbde1435b69a | |
| parent | d22dae08aafaeb8021438dd283fdee110f18d9b2 (diff) | |
Scripts/Spells: Implement priest talent Expiation (#31448)
| -rw-r--r-- | sql/updates/world/master/2025_12_21_01_world.sql | 4 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 61 |
2 files changed, 65 insertions, 0 deletions
diff --git a/sql/updates/world/master/2025_12_21_01_world.sql b/sql/updates/world/master/2025_12_21_01_world.sql new file mode 100644 index 00000000000..820158770a0 --- /dev/null +++ b/sql/updates/world/master/2025_12_21_01_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_pri_expiation'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(8092, 'spell_pri_expiation'), +(32379, 'spell_pri_expiation'); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 5e42eec1432..aae97c70501 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -94,6 +94,8 @@ enum PriestSpells SPELL_PRIEST_ESSENCE_DEVOURER = 415479, SPELL_PRIEST_ESSENCE_DEVOURER_SHADOWFIEND_HEAL = 415673, SPELL_PRIEST_ESSENCE_DEVOURER_MINDBENDER_HEAL = 415676, + SPELL_PRIEST_EXPIATION = 390832, + SPELL_PRIEST_EXPIATION_DAMAGE = 390844, SPELL_PRIEST_FLASH_HEAL = 2061, SPELL_PRIEST_FROM_DARKNESS_COMES_LIGHT_AURA = 390617, SPELL_PRIEST_GREATER_HEAL = 289666, @@ -1338,6 +1340,64 @@ class spell_pri_evangelism : public SpellScript } }; +// 390832 - Expiation +// Triggered by 8092 - Mind Blast and 32379 - Shadow Word: Death +class spell_pri_expiation : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PRIEST_EXPIATION_DAMAGE }) + && ValidateSpellEffect({ { SPELL_PRIEST_EXPIATION, EFFECT_1 }, { SPELL_PRIEST_SHADOW_WORD_PAIN, EFFECT_1 } }); + } + + bool Load() override + { + return GetCaster()->HasAura(SPELL_PRIEST_EXPIATION); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + Aura const* expiation = caster->GetAura(SPELL_PRIEST_EXPIATION); + if (!expiation) + return; + + AuraEffect const* expiationConsume = expiation->GetEffect(EFFECT_0); + AuraEffect const* expiationDmgMul = expiation->GetEffect(EFFECT_1); + if (!expiationConsume || !expiationDmgMul) + return; + + AuraEffect const* swPainAuraEffect = target->GetAuraEffect(SPELL_PRIEST_SHADOW_WORD_PAIN, EFFECT_1, caster->GetGUID()); + if (!swPainAuraEffect) + return; + + Aura* swPainAura = swPainAuraEffect->GetBase(); + int32 debuffDuration = swPainAura->GetDuration(); + int32 consumeDuration = std::min(debuffDuration, expiationConsume->GetAmount() * IN_MILLISECONDS); + if (consumeDuration == 0) + return; + + float ticksConsumed = static_cast<float>(consumeDuration) / swPainAuraEffect->GetPeriod(); + float damagePerTick = swPainAuraEffect->CalculateEstimatedAmount(caster, swPainAuraEffect->GetAmount()).value_or(swPainAuraEffect->GetAmount()); + int32 totalDamage = static_cast<int32>(damagePerTick * ticksConsumed); + + swPainAura->SetDuration(debuffDuration - consumeDuration); + + caster->CastSpell(target, SPELL_PRIEST_EXPIATION_DAMAGE, CastSpellExtraArgsInit + { + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .SpellValueOverrides = { { SPELLVALUE_BASE_POINT0, CalculatePct(totalDamage, expiationDmgMul->GetAmount()) } } + }); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pri_expiation::HandleHitTarget, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } +}; + // 33110 - Prayer of Mending (Heal) class spell_pri_focused_mending : public SpellScript { @@ -3929,6 +3989,7 @@ void AddSC_priest_spell_scripts() RegisterSpellScript(spell_pri_epiphany); RegisterSpellScript(spell_pri_essence_devourer_heal); RegisterSpellScript(spell_pri_evangelism); + RegisterSpellScript(spell_pri_expiation); RegisterSpellScript(spell_pri_focused_mending); RegisterSpellScript(spell_pri_from_darkness_comes_light); RegisterSpellScript(spell_pri_guardian_spirit); |
