Core/Spells: Fixed Crackling Jade Lightning, initial pull request by @Infamous-devel

Closes #17050
This commit is contained in:
Shauren
2016-04-27 18:17:03 +02:00
parent 406ac4f4b4
commit 4953ee20a5
3 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_monk_crackling_jade_lightning','spell_monk_crackling_jade_lightning_knockback_proc_aura');
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(117952,'spell_monk_crackling_jade_lightning'),
(117959,'spell_monk_crackling_jade_lightning_knockback_proc_aura');

View File

@@ -0,0 +1,131 @@
/*
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* 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_MONK and SPELLFAMILY_GENERIC spells used by monk players.
* Scriptnames of files in this file should be prefixed with "spell_monk_".
*/
#include "SpellScript.h"
#include "ScriptMgr.h"
#include "Unit.h"
#include "SpellAuraEffects.h"
enum MonkSpells
{
SPELL_MONK_CRACKLING_JADE_LIGHTNING_CHANNEL = 117952,
SPELL_MONK_CRACKLING_JADE_LIGHTNING_CHI_PROC = 123333,
SPELL_MONK_STANCE_OF_THE_SPIRITED_CRANE = 154436,
SPELL_MONK_CRACKLING_JADE_LIGHTNING_KNOCKBACK = 117962,
SPELL_MONK_CRACKLING_JADE_LIGHTNING_KNOCKBACK_CD = 117953,
};
// 117952 - Crackling Jade Lightning
class spell_monk_crackling_jade_lightning : public SpellScriptLoader
{
public:
spell_monk_crackling_jade_lightning() : SpellScriptLoader("spell_monk_crackling_jade_lightning") { }
class spell_monk_crackling_jade_lightning_AuraScript : public AuraScript
{
PrepareAuraScript(spell_monk_crackling_jade_lightning_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_MONK_CRACKLING_JADE_LIGHTNING_CHI_PROC))
return false;
return true;
}
void OnTick(AuraEffect const* /*aurEff*/)
{
if (Unit* caster = GetCaster())
if (caster->HasAura(SPELL_MONK_STANCE_OF_THE_SPIRITED_CRANE))
caster->CastSpell(caster, SPELL_MONK_CRACKLING_JADE_LIGHTNING_CHI_PROC, TRIGGERED_FULL_MASK);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_monk_crackling_jade_lightning_AuraScript::OnTick, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_monk_crackling_jade_lightning_AuraScript();
}
};
// 117959 - Crackling Jade Lightning
class spell_monk_crackling_jade_lightning_knockback_proc_aura : public SpellScriptLoader
{
public:
spell_monk_crackling_jade_lightning_knockback_proc_aura() : SpellScriptLoader("spell_monk_crackling_jade_lightning_knockback_proc_aura") { }
class spell_monk_crackling_jade_lightning_aura_AuraScript : public AuraScript
{
PrepareAuraScript(spell_monk_crackling_jade_lightning_aura_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_MONK_CRACKLING_JADE_LIGHTNING_KNOCKBACK))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_MONK_CRACKLING_JADE_LIGHTNING_KNOCKBACK_CD))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
if (GetTarget()->HasAura(SPELL_MONK_CRACKLING_JADE_LIGHTNING_KNOCKBACK_CD))
return false;
if (eventInfo.GetActor()->GetGUID() != GetTarget()->GetChannelObjectGuid())
return false;
Spell* currentChanneledSpell = GetTarget()->GetCurrentSpell(CURRENT_CHANNELED_SPELL);
if (!currentChanneledSpell || currentChanneledSpell->GetSpellInfo()->Id != SPELL_MONK_CRACKLING_JADE_LIGHTNING_CHANNEL)
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_MONK_CRACKLING_JADE_LIGHTNING_KNOCKBACK, TRIGGERED_FULL_MASK);
GetTarget()->CastSpell(GetTarget(), SPELL_MONK_CRACKLING_JADE_LIGHTNING_KNOCKBACK_CD, TRIGGERED_FULL_MASK);
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_monk_crackling_jade_lightning_aura_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_monk_crackling_jade_lightning_aura_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_monk_crackling_jade_lightning_aura_AuraScript();
}
};
void AddSC_monk_spell_scripts()
{
new spell_monk_crackling_jade_lightning();
new spell_monk_crackling_jade_lightning_knockback_proc_aura();
}

View File

@@ -21,6 +21,7 @@ void AddSC_druid_spell_scripts();
void AddSC_generic_spell_scripts();
void AddSC_hunter_spell_scripts();
void AddSC_mage_spell_scripts();
void AddSC_monk_spell_scripts();
void AddSC_paladin_spell_scripts();
void AddSC_priest_spell_scripts();
void AddSC_rogue_spell_scripts();
@@ -40,6 +41,7 @@ void AddSpellsScripts()
AddSC_generic_spell_scripts();
AddSC_hunter_spell_scripts();
AddSC_mage_spell_scripts();
AddSC_monk_spell_scripts();
AddSC_paladin_spell_scripts();
AddSC_priest_spell_scripts();
AddSC_rogue_spell_scripts();