Move a couple of warrior spell dummy effect handlers to spell scripts.

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-08-02 13:18:45 -07:00
parent 891df4eccb
commit e798097ae3
5 changed files with 78 additions and 22 deletions

View File

@@ -37,7 +37,7 @@ enum PaladinSpells
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
return false;
@@ -82,10 +82,11 @@ SpellScript * GetSpellScript_spell_pal_blessing_of_faith()
class spell_pal_holy_shock_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1))
return false;
// can't use other spell than holy shock due to spell_ranks dependency
if (spellmgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id))
return false;

View File

@@ -23,14 +23,77 @@
#include "ScriptPCH.h"
enum WarriorSpells
{
WARRIOR_SPELL_LAST_STAND_TRIGGERED = 12976,
WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED = 21887,
};
class spell_warr_last_stand_SpellScript : public SpellScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
int32 healthModSpellBasePoints0 = int32(GetCaster()->GetMaxHealth() * 0.3);
GetCaster()->CastCustomSpell(GetCaster(), WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
}
void Register()
{
// add dummy effect spell handler to Last Stand
EffectHandlers += EffectHandlerFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_warr_last_stand()
{
return new spell_warr_last_stand_SpellScript();
}
class spell_warr_warriors_wrath_SpellScript : public SpellScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
GetCaster()->CastSpell(unitTarget, WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED, true);
}
void Register()
{
// add dummy effect spell handler to Warrior's Wrath
EffectHandlers += EffectHandlerFn(spell_warr_warriors_wrath_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_warr_warriors_wrath()
{
return new spell_warr_warriors_wrath_SpellScript();
}
void AddSC_warrior_spell_scripts()
{
//Script *newscript;
Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_warr_";
newscript->GetSpellScript = &GetSpellScript_spell_warr_;
newscript->Name = "spell_warr_last_stand";
newscript->GetSpellScript = &GetSpellScript_spell_warr_last_stand;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_warr_warriors_wrath";
newscript->GetSpellScript = &GetSpellScript_spell_warr_warriors_wrath;
newscript->RegisterSelf();
*/
}