Scripts/Spells: Implement paladin talent "Execution Sentence" (#30617)

This commit is contained in:
Aqua Deus
2025-02-11 23:29:03 +01:00
committed by GitHub
parent 1f62d3caaa
commit c54b37d59f
2 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_pal_execution_sentence';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(343527, 'spell_pal_execution_sentence');

View File

@@ -66,6 +66,10 @@ enum PaladinSpells
SPELL_PALADIN_DIVINE_STORM_DAMAGE = 224239,
SPELL_PALADIN_ENDURING_LIGHT = 40471,
SPELL_PALADIN_ENDURING_JUDGEMENT = 40472,
SPELL_PALADIN_EXECUTION_SENTENCE_DAMAGE = 387113,
SPELL_PALADIN_EXECUTION_SENTENCE_11_SECONDS = 406919,
SPELL_PALADIN_EXECUTION_SENTENCE_8_SECONDS = 386579,
SPELL_PALADIN_EXECUTIONERS_WILL = 406940,
SPELL_PALADIN_EYE_FOR_AN_EYE_TRIGGERED = 205202,
SPELL_PALADIN_FINAL_STAND = 204077,
SPELL_PALADIN_FINAL_STAND_EFFECT = 204079,
@@ -612,6 +616,73 @@ class spell_pal_divine_storm : public SpellScript
}
};
// 343527 - Execution Sentence
class spell_pal_execution_sentence : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo(
{
SPELL_PALADIN_EXECUTION_SENTENCE_DAMAGE,
SPELL_PALADIN_EXECUTIONERS_WILL,
SPELL_PALADIN_EXECUTION_SENTENCE_11_SECONDS,
SPELL_PALADIN_EXECUTION_SENTENCE_8_SECONDS
});
}
void HandleVisual(SpellEffIndex /*effIndex*/) const
{
uint32 visualSpellId = GetCaster()->HasAura(SPELL_PALADIN_EXECUTIONERS_WILL)
? SPELL_PALADIN_EXECUTION_SENTENCE_11_SECONDS
: SPELL_PALADIN_EXECUTION_SENTENCE_8_SECONDS;
GetCaster()->CastSpell(GetHitUnit(), visualSpellId,
CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.TriggeringSpell = GetSpell()
});
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pal_execution_sentence::HandleVisual, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
class spell_pal_execution_sentence_aura : public AuraScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } })
&& spellInfo->GetEffect(EFFECT_1).IsAura();
}
void HandleProc(AuraEffect* aurEff, ProcEventInfo const& eventInfo) const
{
if (DamageInfo const* damageInfo = eventInfo.GetDamageInfo())
aurEff->ChangeAmount(aurEff->GetAmount() + CalculatePct(damageInfo->GetDamage(), GetEffect(EFFECT_1)->GetAmount()));
}
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
{
int32 amount = aurEff->GetAmount();
if (!amount || GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), SPELL_PALADIN_EXECUTION_SENTENCE_DAMAGE, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.TriggeringAura = aurEff,
.SpellValueOverrides = { { SPELLVALUE_BASE_POINT0, amount } }
});
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_pal_execution_sentence_aura::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
AfterEffectRemove += AuraEffectRemoveFn(spell_pal_execution_sentence_aura::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
// 205191 - Eye for an Eye
class spell_pal_eye_for_an_eye : public AuraScript
{
@@ -1598,6 +1669,7 @@ void AddSC_paladin_spell_scripts()
RegisterSpellScript(spell_pal_divine_shield);
RegisterSpellScript(spell_pal_divine_steed);
RegisterSpellScript(spell_pal_divine_storm);
RegisterSpellAndAuraScriptPair(spell_pal_execution_sentence, spell_pal_execution_sentence_aura);
RegisterSpellScript(spell_pal_eye_for_an_eye);
RegisterSpellScript(spell_pal_fist_of_justice);
RegisterSpellScript(spell_pal_glyph_of_holy_light);