diff options
author | Killyana <morphone1@gmail.com> | 2019-06-04 18:25:21 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-10 21:37:45 +0100 |
commit | adb5535483cf202572ae34065959aa94cf0304e8 (patch) | |
tree | be85ef708b2e9662908469dcd401310f23419c4e /src | |
parent | 55c3e1f9dd8f559f49abadc50999ec00bbbeaa7d (diff) |
Spell/Script: Stasis Field
Closes #23355
(cherry picked from commit 7dd87e3df44c1c5b9b8ffb9652911d46d6676c38)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index c2e182a66c8..610fc24dbd4 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -4116,6 +4116,64 @@ class spell_corrupting_plague_aura : public AuraScript } }; +enum StasisFieldEntrys +{ + NPC_DAGGERTAIL_LIZARD = 22255, + SPELL_STASIS_FIELD = 40307 +}; + +// 40307 - Stasis Field +class StasisFieldSearcher +{ +public: + StasisFieldSearcher(Unit* obj, float distance) : _unit(obj), _distance(distance) { } + + bool operator()(Unit* u) const + { + if (_unit->GetDistance2d(u) < _distance && + (u->GetEntry() == NPC_APEXIS_FLAYER || u->GetEntry() == NPC_SHARD_HIDE_BOAR || u->GetEntry() == NPC_AETHER_RAY || u->GetEntry() == NPC_DAGGERTAIL_LIZARD) && + !u->HasAura(SPELL_STASIS_FIELD)) + return true; + + return false; + } + +private: + Unit* _unit; + float _distance; +}; + +// 40306 - Stasis Field +class spell_stasis_field_aura : public AuraScript +{ + PrepareAuraScript(spell_stasis_field_aura); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_STASIS_FIELD }); + } + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + Unit* owner = GetTarget(); + + std::list<Creature*> targets; + StasisFieldSearcher creature_check(owner, 15.0f); + Trinity::CreatureListSearcher<StasisFieldSearcher> creature_searcher(owner, targets, creature_check); + Cell::VisitGridObjects(owner, creature_searcher, 15.0f); + + if (!targets.empty()) + return; + + PreventDefaultAction(); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_stasis_field_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + enum SiegeTankControl { SPELL_SIEGE_TANK_CONTROL = 47963 @@ -4574,6 +4632,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_clear_debuffs); RegisterAuraScript(spell_gen_pony_mount_check); RegisterAuraScript(spell_corrupting_plague_aura); + RegisterAuraScript(spell_stasis_field_aura); RegisterAuraScript(spell_gen_vehicle_control_link); RegisterSpellScript(spell_freezing_circle); RegisterSpellScript(spell_gen_charmed_unit_spell_cooldown); |