diff options
author | Teleqraph <nyrdeveloper@gmail.com> | 2023-08-28 22:13:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-28 22:13:47 +0200 |
commit | 1715ddf680a2c693c80db3c31fbf697e23f30876 (patch) | |
tree | fd66428caf19e6a2f547f5b88a4db2483ffd43d0 /src | |
parent | 0a9b3e089fcebdd42ccf10a0e4d41bf634582ef3 (diff) |
Scripts/Spells: Implement priest talent Shadow Covenant (#29227)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 7de2d510d50..77f29c5cbc9 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -26,6 +26,7 @@ #include "Containers.h" #include "G3DPosition.hpp" #include "GridNotifiers.h" +#include "ListUtils.h" #include "Log.h" #include "MoveSplineInitArgs.h" #include "ObjectAccessor.h" @@ -2449,6 +2450,34 @@ class spell_pri_spirit_of_redemption : public AuraScript } }; +// 314867 - Shadow Covenant +class spell_pri_shadow_covenant : public SpellScript +{ + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } }); + } + + void FilterTargets(std::list<WorldObject*>& targets) const + { + // remove explicit target (will be readded later) + Trinity::Containers::Lists::RemoveUnique(targets, GetExplTargetWorldObject()); + + // we must remove one since explicit target is always added. + uint32 maxTargets = uint32(GetEffectInfo(EFFECT_2).CalcValue(GetCaster()) - 1); + + Trinity::SelectRandomInjuredTargets(targets, maxTargets, true); + + if (Unit* explicitTarget = GetExplTargetUnit()) + targets.push_front(explicitTarget); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_shadow_covenant::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY); + } +}; + // 186263 - Shadow Mend class spell_pri_shadow_mend : public SpellScript { @@ -2849,6 +2878,7 @@ void AddSC_priest_spell_scripts() RegisterSpellScript(spell_pri_rapture); RegisterSpellScript(spell_pri_sins_of_the_many); RegisterSpellScript(spell_pri_spirit_of_redemption); + RegisterSpellScript(spell_pri_shadow_covenant); RegisterSpellScript(spell_pri_shadow_mend); RegisterSpellScript(spell_pri_shadow_mend_periodic_damage); RegisterSpellScript(spell_pri_trail_of_light); |