diff options
author | Nyr <nyrdeveloper@gmail.com> | 2023-08-04 15:24:19 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-08-26 23:36:26 +0200 |
commit | 07a03dd730db6febe61aaec7a411dce9961cabb8 (patch) | |
tree | 50ecdaaa8a476e0c153770a29cd0ff6bf9fbd8f6 | |
parent | f5c65c3551f381d394035404c60ab62fa80b8240 (diff) |
Scripts/Spells: Implement priest talent Light's Wrath
-rw-r--r-- | sql/updates/world/master/2023_08_26_05_world.sql | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 51 |
2 files changed, 54 insertions, 0 deletions
diff --git a/sql/updates/world/master/2023_08_26_05_world.sql b/sql/updates/world/master/2023_08_26_05_world.sql new file mode 100644 index 00000000000..c1a0907578d --- /dev/null +++ b/sql/updates/world/master/2023_08_26_05_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_pri_lights_wrath'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(373178, 'spell_pri_lights_wrath'); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 48239cd172c..27354ef2f7a 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -106,6 +106,7 @@ enum PriestSpells SPELL_PRIEST_LEAP_OF_FAITH_EFFECT = 92832, SPELL_PRIEST_LEVITATE_EFFECT = 111759, SPELL_PRIEST_LIGHT_ERUPTION = 196812, + SPELL_PRIEST_LIGHTS_WRATH_VISUAL = 215795, SPELL_PRIEST_MASOCHISM_TALENT = 193063, SPELL_PRIEST_MASOCHISM_PERIODIC_HEAL = 193065, SPELL_PRIEST_MASTERY_GRACE = 271534, @@ -387,6 +388,11 @@ public: UpdateSinsOfTheManyValue(); } + std::vector<ObjectGuid> const& GetAtonementTargets() const + { + return _appliedAtonements; + } + void TriggerAtonementHealOnTargets(AuraEffect const* atonementEffect, ProcEventInfo const& eventInfo) { Unit* priest = GetUnitOwner(); @@ -1267,6 +1273,50 @@ class spell_pri_levitate : public SpellScript } }; +// 373178 - Light's Wrath +class spell_pri_lights_wrath : public SpellScript +{ + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } }); + } + + void OnPrecast() override + { + Aura const* atonement = GetCaster()->GetAura(SPELL_PRIEST_ATONEMENT); + if (!atonement) + return; + + spell_pri_atonement const* script = atonement->GetScript<spell_pri_atonement>(); + if (!script) + return; + + for (ObjectGuid const& atonementTarget : script->GetAtonementTargets()) + { + if (Unit* target = ObjectAccessor::GetUnit(*GetCaster(), atonementTarget)) + { + target->CastSpell(GetCaster(), SPELL_PRIEST_LIGHTS_WRATH_VISUAL, TRIGGERED_IGNORE_CAST_IN_PROGRESS); + } + } + } + + void CalculateDamageBonus(Unit const* /*victim*/, int32 const& /*damage*/, int32 const& /*flatMod*/, float& pctMod) const + { + Aura const* atonement = GetCaster()->GetAura(SPELL_PRIEST_ATONEMENT); + if (!atonement) + return; + + // Atonement size may have changed when missile hits, we need to take an updated count of Atonement applications. + if (spell_pri_atonement const* script = atonement->GetScript<spell_pri_atonement>()) + AddPct(pctMod, GetEffectInfo(EFFECT_1).CalcValue(GetCaster()) * script->GetAtonementTargets().size()); + } + + void Register() override + { + CalcDamage += SpellCalcDamageFn(spell_pri_lights_wrath::CalculateDamageBonus); + } +}; + // 205369 - Mind Bomb class spell_pri_mind_bomb : public AuraScript { @@ -2592,6 +2642,7 @@ void AddSC_priest_spell_scripts() RegisterSpellScript(spell_pri_item_t6_trinket); RegisterSpellScript(spell_pri_leap_of_faith_effect_trigger); RegisterSpellScript(spell_pri_levitate); + RegisterSpellScript(spell_pri_lights_wrath); RegisterSpellScript(spell_pri_mind_bomb); RegisterSpellScript(spell_pri_painful_punishment); RegisterSpellScriptWithArgs(spell_pri_penance, "spell_pri_penance", SPELL_PRIEST_PENANCE_CHANNEL_DAMAGE, SPELL_PRIEST_PENANCE_CHANNEL_HEALING); |