diff options
author | Killyana <morphone1@gmail.com> | 2019-06-04 18:25:21 +0200 |
---|---|---|
committer | Killyana <morphone1@gmail.com> | 2019-06-04 18:25:21 +0200 |
commit | 7dd87e3df44c1c5b9b8ffb9652911d46d6676c38 (patch) | |
tree | fa11fe5039c9f930adf7c0b84d29b55fb247df79 /src | |
parent | bb60122f2c0a67fbb7e1a7e31e1be9b5722ef6ee (diff) |
Spell/Script: Stasis Field
Closes #23355
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 ac85b24e9c8..e03a43331bb 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -4182,6 +4182,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 @@ -4390,6 +4448,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); |