Scripts/Spells: Implement priest talent Expiation (#31448)

This commit is contained in:
Cristian Vintila
2025-12-22 01:41:39 +02:00
committed by GitHub
parent d22dae08aa
commit a4bbb61970
2 changed files with 65 additions and 0 deletions

View File

@@ -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');

View File

@@ -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);