2010-07-24 22:41:42 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2008-2010 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
2010-07-31 10:46:33 -07:00
|
|
|
* Scripts for spells with SPELLFAMILY_PALADIN and SPELLFAMILY_GENERIC spells used by paladin players.
|
2010-07-24 22:41:42 +02:00
|
|
|
* Ordered alphabetically using scriptname.
|
|
|
|
|
* Scriptnames of files in this file should be prefixed with "spell_pal_".
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ScriptPCH.h"
|
2010-08-18 12:26:17 +06:00
|
|
|
#include "SpellAuraEffects.h"
|
2010-07-24 22:41:42 +02:00
|
|
|
|
2010-07-31 10:46:33 -07:00
|
|
|
enum PaladinSpells
|
|
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
PALADIN_SPELL_DIVINE_PLEA = 54428,
|
|
|
|
|
|
2010-07-31 10:46:33 -07:00
|
|
|
PALADIN_SPELL_HOLY_SHOCK_R1 = 20473,
|
|
|
|
|
PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE = 25912,
|
|
|
|
|
PALADIN_SPELL_HOLY_SHOCK_R1_HEALING = 25914,
|
|
|
|
|
|
|
|
|
|
SPELL_BLESSING_OF_LOWER_CITY_DRUID = 37878,
|
|
|
|
|
SPELL_BLESSING_OF_LOWER_CITY_PALADIN = 37879,
|
|
|
|
|
SPELL_BLESSING_OF_LOWER_CITY_PRIEST = 37880,
|
|
|
|
|
SPELL_BLESSING_OF_LOWER_CITY_SHAMAN = 37881,
|
|
|
|
|
};
|
|
|
|
|
|
2010-08-06 11:35:39 -07:00
|
|
|
class spell_pal_blessing_of_faith : public SpellHandlerScript
|
2010-07-31 10:46:33 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
public:
|
|
|
|
|
spell_pal_blessing_of_faith() : SpellHandlerScript("spell_pal_blessing_of_faith") { }
|
2010-08-06 11:35:39 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
|
|
|
|
|
{
|
|
|
|
|
bool Validate(SpellEntry const *spellEntry)
|
2010-07-31 10:46:33 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
|
|
|
|
|
return false;
|
|
|
|
|
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PALADIN))
|
|
|
|
|
return false;
|
|
|
|
|
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PRIEST))
|
|
|
|
|
return false;
|
|
|
|
|
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-23 14:10:24 +02:00
|
|
|
void HandleDummy(SpellEffIndex /*effIndex*/)
|
2010-08-18 12:26:17 +06:00
|
|
|
{
|
|
|
|
|
if (Unit *unitTarget = GetHitUnit())
|
2010-08-06 11:35:39 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
uint32 spell_id = 0;
|
|
|
|
|
switch(unitTarget->getClass())
|
2010-08-06 11:35:39 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break;
|
|
|
|
|
case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break;
|
|
|
|
|
case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break;
|
|
|
|
|
case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break;
|
|
|
|
|
default: return; // ignore for non-healing classes
|
2010-08-06 11:35:39 -07:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
GetCaster()->CastSpell(GetCaster(), spell_id, true);
|
2010-08-06 11:35:39 -07:00
|
|
|
}
|
2010-08-18 12:26:17 +06:00
|
|
|
}
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
void Register()
|
2010-08-06 11:35:39 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
// add dummy effect spell handler to Blessing of Faith
|
|
|
|
|
EffectHandlers += EffectHandlerFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
2010-08-06 11:35:39 -07:00
|
|
|
}
|
2010-08-18 12:26:17 +06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SpellScript *GetSpellScript() const
|
|
|
|
|
{
|
|
|
|
|
return new spell_pal_blessing_of_faith_SpellScript();
|
|
|
|
|
}
|
2010-07-31 10:46:33 -07:00
|
|
|
};
|
|
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
// 63521 Guarded by The Light
|
|
|
|
|
class spell_pal_guarded_by_the_light : public SpellHandlerScript
|
2010-07-31 10:46:33 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
public:
|
|
|
|
|
spell_pal_guarded_by_the_light() : SpellHandlerScript("spell_pal_guarded_by_the_light") { }
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
|
|
|
|
|
{
|
2010-08-23 14:10:24 +02:00
|
|
|
bool Validate(SpellEntry const * /*spellEntry*/)
|
2010-07-31 10:46:33 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
if (!sSpellStore.LookupEntry(PALADIN_SPELL_DIVINE_PLEA))
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-23 14:10:24 +02:00
|
|
|
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
2010-08-18 12:26:17 +06:00
|
|
|
{
|
|
|
|
|
// Divine Plea
|
|
|
|
|
if (Aura* aura = GetCaster()->GetAura(PALADIN_SPELL_DIVINE_PLEA))
|
|
|
|
|
aura->RefreshDuration();
|
|
|
|
|
}
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
void Register()
|
|
|
|
|
{
|
|
|
|
|
EffectHandlers += EffectHandlerFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
|
|
|
|
}
|
|
|
|
|
};
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
SpellScript* GetSpellScript() const
|
|
|
|
|
{
|
|
|
|
|
return new spell_pal_guarded_by_the_light_SpellScript();
|
|
|
|
|
}
|
|
|
|
|
};
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
class spell_pal_holy_shock : public SpellHandlerScript
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
spell_pal_holy_shock() : SpellHandlerScript("spell_pal_holy_shock") { }
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
class spell_pal_holy_shock_SpellScript : public SpellScript
|
|
|
|
|
{
|
|
|
|
|
bool Validate(SpellEntry const *spellEntry)
|
|
|
|
|
{
|
|
|
|
|
if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1))
|
|
|
|
|
return false;
|
2010-08-06 11:35:39 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
// can't use other spell than holy shock due to spell_ranks dependency
|
|
|
|
|
if (sSpellMgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr.GetFirstSpellInChain(spellEntry->Id))
|
|
|
|
|
return false;
|
2010-08-06 11:35:39 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
uint8 rank = sSpellMgr.GetSpellRank(spellEntry->Id);
|
|
|
|
|
if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true))
|
|
|
|
|
return false;
|
|
|
|
|
if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-23 14:10:24 +02:00
|
|
|
void HandleDummy(SpellEffIndex /*effIndex*/)
|
2010-08-18 12:26:17 +06:00
|
|
|
{
|
|
|
|
|
if (Unit *unitTarget = GetHitUnit())
|
2010-08-06 11:35:39 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
Unit *caster = GetCaster();
|
|
|
|
|
|
|
|
|
|
uint8 rank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id);
|
|
|
|
|
|
|
|
|
|
if (caster->IsFriendlyTo(unitTarget))
|
|
|
|
|
caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0);
|
|
|
|
|
else
|
|
|
|
|
caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
|
2010-08-06 11:35:39 -07:00
|
|
|
}
|
2010-08-18 12:26:17 +06:00
|
|
|
}
|
2010-08-06 11:35:39 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
void Register()
|
2010-08-06 11:35:39 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
// add dummy effect spell handler to Holy Shock
|
|
|
|
|
EffectHandlers += EffectHandlerFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
2010-08-06 11:35:39 -07:00
|
|
|
}
|
2010-08-18 12:26:17 +06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SpellScript *GetSpellScript() const
|
|
|
|
|
{
|
|
|
|
|
return new spell_pal_holy_shock_SpellScript();
|
|
|
|
|
}
|
2010-07-31 10:46:33 -07:00
|
|
|
};
|
|
|
|
|
|
2010-08-06 11:35:39 -07:00
|
|
|
class spell_pal_judgement_of_command : public SpellHandlerScript
|
2010-07-31 10:46:33 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
public:
|
|
|
|
|
spell_pal_judgement_of_command() : SpellHandlerScript("spell_pal_judgement_of_command") { }
|
2010-08-06 11:35:39 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
class spell_pal_judgement_of_command_SpellScript : public SpellScript
|
|
|
|
|
{
|
2010-08-23 14:10:24 +02:00
|
|
|
void HandleDummy(SpellEffIndex /*effIndex*/)
|
2010-08-06 11:35:39 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
if (Unit *unitTarget = GetHitUnit())
|
|
|
|
|
if (SpellEntry const* spell_proto = sSpellStore.LookupEntry(GetEffectValue()))
|
|
|
|
|
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
|
|
|
|
|
}
|
2010-08-06 11:35:39 -07:00
|
|
|
|
2010-08-18 12:26:17 +06:00
|
|
|
void Register()
|
2010-08-06 11:35:39 -07:00
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
// add dummy effect spell handler to Judgement of Command
|
|
|
|
|
EffectHandlers += EffectHandlerFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
2010-08-06 11:35:39 -07:00
|
|
|
}
|
2010-08-18 12:26:17 +06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SpellScript *GetSpellScript() const
|
|
|
|
|
{
|
|
|
|
|
return new spell_pal_judgement_of_command_SpellScript();
|
|
|
|
|
}
|
2010-08-06 11:35:39 -07:00
|
|
|
};
|
2010-07-31 10:46:33 -07:00
|
|
|
|
2010-07-24 22:41:42 +02:00
|
|
|
void AddSC_paladin_spell_scripts()
|
|
|
|
|
{
|
2010-08-18 12:26:17 +06:00
|
|
|
new spell_pal_blessing_of_faith();
|
|
|
|
|
new spell_pal_guarded_by_the_light();
|
|
|
|
|
new spell_pal_holy_shock();
|
|
|
|
|
new spell_pal_judgement_of_command();
|
2010-07-31 10:46:33 -07:00
|
|
|
}
|