diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2023-01-02 21:47:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 21:47:54 +0100 |
commit | b428f600b1e5cfd71e661f924a30d59f3970800d (patch) | |
tree | 6b819b09ccf3c6bd0d0f71bb89a6aa5c118cee67 | |
parent | 2eea58f26e8fe88f3294dca3d4a38d6a20d68e07 (diff) |
Scripts/Evoker: Implement Glide (#28654)
-rw-r--r-- | sql/updates/world/master/2023_01_02_02_world.sql | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_evoker.cpp | 79 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_script_loader.cpp | 2 |
3 files changed, 84 insertions, 0 deletions
diff --git a/sql/updates/world/master/2023_01_02_02_world.sql b/sql/updates/world/master/2023_01_02_02_world.sql new file mode 100644 index 00000000000..11172d8e3d8 --- /dev/null +++ b/sql/updates/world/master/2023_01_02_02_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=358733 AND `ScriptName`='spell_evo_glide'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(358733, 'spell_evo_glide'); diff --git a/src/server/scripts/Spells/spell_evoker.cpp b/src/server/scripts/Spells/spell_evoker.cpp new file mode 100644 index 00000000000..261f6671b0c --- /dev/null +++ b/src/server/scripts/Spells/spell_evoker.cpp @@ -0,0 +1,79 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * Scripts for spells with SPELLFAMILY_EVOKER and SPELLFAMILY_GENERIC spells used by evoker players. + * Ordered alphabetically using scriptname. + * Scriptnames of files in this file should be prefixed with "spell_evo_". + */ +#include "Player.h" +#include "ScriptMgr.h" +#include "Spell.h" +#include "SpellHistory.h" +#include "SpellMgr.h" +#include "SpellScript.h" + +enum EvokerSpells +{ + SPELL_EVOKER_GLIDE_KNOCKBACK = 358736, + SPELL_EVOKER_HOVER = 358267, + SPELL_EVOKER_SOAR_RACIAL = 369536 +}; + +// 358733 - Glide (Racial) +class spell_evo_glide : public SpellScript +{ + PrepareSpellScript(spell_evo_glide); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_EVOKER_GLIDE_KNOCKBACK, SPELL_EVOKER_HOVER, SPELL_EVOKER_SOAR_RACIAL }); + } + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + + if (!caster->IsFalling()) + return SPELL_FAILED_NOT_ON_GROUND; + + return SPELL_CAST_OK; + } + + void HandleCast() + { + Player* caster = GetCaster()->ToPlayer(); + if (!caster) + return; + + caster->CastSpell(caster, SPELL_EVOKER_GLIDE_KNOCKBACK, true); + + caster->GetSpellHistory()->StartCooldown(sSpellMgr->AssertSpellInfo(SPELL_EVOKER_HOVER, GetCastDifficulty()), 0, nullptr, false, 250ms); + caster->GetSpellHistory()->StartCooldown(sSpellMgr->AssertSpellInfo(SPELL_EVOKER_SOAR_RACIAL, GetCastDifficulty()), 0, nullptr, false, 250ms); + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_evo_glide::CheckCast); + OnCast += SpellCastFn(spell_evo_glide::HandleCast); + } +}; + +void AddSC_evoker_spell_scripts() +{ + RegisterSpellScript(spell_evo_glide); +} diff --git a/src/server/scripts/Spells/spell_script_loader.cpp b/src/server/scripts/Spells/spell_script_loader.cpp index c4c19b292ed..fa3d7c97bd3 100644 --- a/src/server/scripts/Spells/spell_script_loader.cpp +++ b/src/server/scripts/Spells/spell_script_loader.cpp @@ -19,6 +19,7 @@ void AddSC_deathknight_spell_scripts(); void AddSC_demon_hunter_spell_scripts(); void AddSC_druid_spell_scripts(); +void AddSC_evoker_spell_scripts(); void AddSC_generic_spell_scripts(); void AddSC_hunter_spell_scripts(); void AddSC_mage_spell_scripts(); @@ -39,6 +40,7 @@ void AddSpellsScripts() AddSC_deathknight_spell_scripts(); AddSC_demon_hunter_spell_scripts(); AddSC_druid_spell_scripts(); + AddSC_evoker_spell_scripts(); AddSC_generic_spell_scripts(); AddSC_hunter_spell_scripts(); AddSC_mage_spell_scripts(); |