Scripts/Evoker: Implement Glide (#28654)

This commit is contained in:
Aqua Deus
2023-01-02 21:47:54 +01:00
committed by GitHub
parent 2eea58f26e
commit b428f600b1
3 changed files with 84 additions and 0 deletions

View File

@@ -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');

View File

@@ -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);
}

View File

@@ -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();