diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 107 |
1 files changed, 95 insertions, 12 deletions
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 28e23a8ddcb..6100943eb12 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -85,7 +85,7 @@ enum PriestSpells SPELL_PRIEST_DIVINE_STAR_SHADOW_DAMAGE = 390845, SPELL_PRIEST_DIVINE_STAR_SHADOW_HEAL = 390981, SPELL_PRIEST_DIVINE_WRATH = 40441, - SPELL_PRIEST_EMPOWERED_RENEW_HEAL = 391359, + SPELL_PRIEST_EMPOWERED_RENEW = 391339, SPELL_PRIEST_EPIPHANY = 414553, SPELL_PRIEST_EPIPHANY_HIGHLIGHT = 414556, SPELL_PRIEST_ESSENCE_DEVOURER = 415479, @@ -1147,32 +1147,54 @@ private: std::vector<ObjectGuid> _affectedUnits; }; +struct spell_pri_holy_words_base +{ + static void ModifyCooldown(Unit* priest, SpellInfo const* spellInfo, Milliseconds cooldownMod) + { + priest->GetSpellHistory()->ModifyCooldown(spellInfo, cooldownMod, true); + } +}; + // 391339 - Empowered Renew class spell_pri_empowered_renew : public AuraScript { bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo({ SPELL_PRIEST_RENEW, SPELL_PRIEST_EMPOWERED_RENEW_HEAL }) + return ValidateSpellInfo({ SPELL_PRIEST_RENEW, SPELL_PRIEST_HOLY_WORD_SANCTIFY }) && ValidateSpellEffect({ { SPELL_PRIEST_RENEW, EFFECT_0 } }) && sSpellMgr->AssertSpellInfo(SPELL_PRIEST_RENEW, DIFFICULTY_NONE)->GetEffect(EFFECT_0).IsAura(SPELL_AURA_PERIODIC_HEAL); } - void HandleProc(AuraEffect* aurEff, ProcEventInfo const& eventInfo) const + void HandleProc(AuraEffect const* aurEff, ProcEventInfo const& eventInfo) const { - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + spell_pri_holy_words_base::ModifyCooldown(eventInfo.GetActor(), sSpellMgr->AssertSpellInfo(SPELL_PRIEST_HOLY_WORD_SANCTIFY, GetCastDifficulty()), + Milliseconds(-aurEff->GetAmount())); + } - SpellInfo const* renewSpellInfo = sSpellMgr->AssertSpellInfo(SPELL_PRIEST_RENEW, GetCastDifficulty()); - SpellEffectInfo const& renewEffect = renewSpellInfo->GetEffect(EFFECT_0); - int32 estimatedTotalHeal = AuraEffect::CalculateEstimatedfTotalPeriodicAmount(caster, target, renewSpellInfo, renewEffect, renewEffect.CalcValue(caster), 1); - int32 healAmount = CalculatePct(estimatedTotalHeal, aurEff->GetAmount()); + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pri_empowered_renew::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } +}; - caster->CastSpell(target, SPELL_PRIEST_EMPOWERED_RENEW_HEAL, CastSpellExtraArgs(aurEff).AddSpellBP0(healAmount)); +// 139 - Renew +class spell_pri_empowered_renew_heal : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellEffect({ { SPELL_PRIEST_EMPOWERED_RENEW, EFFECT_1 } }); + } + + void CalculateHealing(AuraEffect const* /*aurEff*/, Unit* /*victim*/, int32& /*healing*/, int32& /*flatMod*/, float& pctMod) const + { + if (Unit* caster = GetCaster()) + if (AuraEffect const* empRenew = caster->GetAuraEffect(SPELL_PRIEST_EMPOWERED_RENEW, EFFECT_1)) + AddPct(pctMod, empRenew->GetAmount()); } void Register() override { - OnEffectProc += AuraEffectProcFn(spell_pri_empowered_renew::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + DoEffectCalcDamageAndHealing += AuraEffectCalcHealingFn(spell_pri_empowered_renew_heal::CalculateHealing, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); } }; @@ -1481,7 +1503,7 @@ class spell_pri_holy_words : public AuraScript SpellInfo const* targetSpellInfo = sSpellMgr->AssertSpellInfo(targetSpellId, GetCastDifficulty()); int32 cdReduction = targetSpellInfo->GetEffect(cdReductionEffIndex).CalcValue(GetTarget()); - GetTarget()->GetSpellHistory()->ModifyCooldown(targetSpellInfo, Seconds(-cdReduction), true); + spell_pri_holy_words_base::ModifyCooldown(GetTarget(), targetSpellInfo, Seconds(-cdReduction)); } void Register() override @@ -2248,6 +2270,65 @@ class spell_pri_divine_aegis : public AuraScript } }; +// 472361 - Divine Procession +class spell_pri_divine_procession : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PRIEST_ATONEMENT, SPELL_PRIEST_ATONEMENT_EFFECT }) + && ValidateSpellEffect({ { SPELL_PRIEST_ATONEMENT_EFFECT, EFFECT_2 } }); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) const + { + Unit* caster = GetTarget(); + + Aura const* atonementAura = caster->GetAura(SPELL_PRIEST_ATONEMENT); + if (!atonementAura) + return; + + spell_pri_atonement const* atonementScript = atonementAura->GetScript<spell_pri_atonement>(); + if (!atonementScript) + return; + + std::vector<ObjectGuid> const& atonementTargets = atonementScript->GetAtonementTargets(); + if (atonementTargets.empty()) + return; + + // smallest Atonement duration should get increased + auto it = std::ranges::min_element(atonementTargets, std::ranges::less(), [caster](ObjectGuid const& guidA) + { + Unit const* target = ObjectAccessor::GetUnit(*caster, guidA); + if (!target) + return std::numeric_limits<int32>::max(); + + Aura const* atonementEffect = target->GetAura(SPELL_PRIEST_ATONEMENT_EFFECT, caster->GetGUID()); + if (!atonementEffect) + return std::numeric_limits<int32>::max(); + + return atonementEffect->GetDuration(); + }); + + if (Unit const* target = ObjectAccessor::GetUnit(*caster, *it)) + { + if (Aura* atonement = target->GetAura(SPELL_PRIEST_ATONEMENT_EFFECT, caster->GetGUID())) + { + if (atonement->GetDuration() < 30 * IN_MILLISECONDS) + { + int32 newDuration = atonement->GetDuration() + aurEff->GetAmount(); + atonement->SetDuration(newDuration); + atonement->SetMaxDuration(newDuration); + } + } + } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pri_divine_procession::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } +}; + // 129250 - Power Word: Solace class spell_pri_power_word_solace : public SpellScript { @@ -3607,7 +3688,9 @@ void AddSC_priest_spell_scripts() RegisterSpellScript(spell_pri_divine_service); RegisterSpellScript(spell_pri_divine_star_shadow); RegisterAreaTriggerAI(areatrigger_pri_divine_star); + RegisterSpellScript(spell_pri_divine_procession); RegisterSpellScript(spell_pri_empowered_renew); + RegisterSpellScript(spell_pri_empowered_renew_heal); RegisterSpellScript(spell_pri_epiphany); RegisterSpellScript(spell_pri_essence_devourer_heal); RegisterSpellScript(spell_pri_evangelism); |
