Add more methods to SpellScript.
Spells cleanup: move spells from the core to scripts. * Shaman spells: 39610 Mana Tide Totem, 1535 Fire Nova (and ranks) * Death Knight spells: 55090 Scourge Strike (and ranks), 49158 Corpse Explosion (and ranks), 50524 Runic Power Feed * Druid spells: 54846 Glyph of Starfire * Warlock spells: 6201 Create Healthstone (and ranks), 47422 Everlasting Affliction, 47193 Demonic Empowerment, 63521 Guarded by The Light * Hunter spells: 37506 Scatter Shot, 53412 Invigoration, 53209 Chimera Shot * Quest spells: 45449 Arcane Prisoner Rescue (quest 11587), 46023 The Ultrasonic Screwdriver (quest 11730). Closes issue #3068 Clean old code for hunter's Heart of the Phoenix, move script effect of hunter's Master's Call to corresponding script. Move DK's Hungering Cold to spell_scripts table (needs DB support) --HG-- branch : trunk
This commit is contained in:
1 parent
0284ed4cfe
commit
66fcd52106
12 files changed
+1127
-520
No files matched your search
@@ -22,8 +22,222 @@
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
enum WarlockSpells
|
||||
{
|
||||
WARLOCK_DIVINE_PLEA = 54428,
|
||||
WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS = 54435,
|
||||
WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER = 54443,
|
||||
WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD = 54508,
|
||||
WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER = 54509,
|
||||
WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444,
|
||||
WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692,
|
||||
WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693,
|
||||
};
|
||||
|
||||
// 47193 Demonic Empowerment
|
||||
class spell_warl_demonic_empowerment : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_warl_demonic_empowerment() : SpellHandlerScript("spell_warl_demonic_empowerment") { }
|
||||
|
||||
class spell_warl_demonic_empowerment_SpellScript : public SpellScript
|
||||
{
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS))
|
||||
return false;
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER))
|
||||
return false;
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD))
|
||||
return false;
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER))
|
||||
return false;
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_IMP))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
if (Creature* targetCreature = GetHitCreature())
|
||||
{
|
||||
if (targetCreature->isPet())
|
||||
{
|
||||
CreatureInfo const * ci = sObjectMgr.GetCreatureTemplate(targetCreature->GetEntry());
|
||||
switch (ci->family)
|
||||
{
|
||||
case CREATURE_FAMILY_SUCCUBUS:
|
||||
targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS, true);
|
||||
break;
|
||||
case CREATURE_FAMILY_VOIDWALKER:
|
||||
{
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER);
|
||||
int32 hp = targetCreature->GetMaxHealth() * GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0) / 100;
|
||||
targetCreature->CastCustomSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, NULL, NULL, true);
|
||||
//unitTarget->CastSpell(unitTarget, 54441, true);
|
||||
break;
|
||||
}
|
||||
case CREATURE_FAMILY_FELGUARD:
|
||||
targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD, true);
|
||||
break;
|
||||
case CREATURE_FAMILY_FELHUNTER:
|
||||
targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER, true);
|
||||
break;
|
||||
case CREATURE_FAMILY_IMP:
|
||||
targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_IMP, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_warl_demonic_empowerment_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_demonic_empowerment_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 47422 Everlasting Affliction
|
||||
class spell_warl_everlasting_affliction : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_warl_everlasting_affliction() : SpellHandlerScript("spell_warl_everlasting_affliction") { }
|
||||
|
||||
class spell_warl_everlasting_affliction_SpellScript : public SpellScript
|
||||
{
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
// Refresh corruption on target
|
||||
if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, GetCaster()->GetGUID()))
|
||||
aur->GetBase()->RefreshDuration();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_warl_everlasting_affliction_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_everlasting_affliction_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 63521 Guarded by The Light
|
||||
class spell_warl_guarded_by_the_light : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_warl_guarded_by_the_light() : SpellHandlerScript("spell_warl_guarded_by_the_light") { }
|
||||
|
||||
class spell_warl_guarded_by_the_light_SpellScript : public SpellScript
|
||||
{
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_DIVINE_PLEA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
// Divine Plea
|
||||
if (Aura* aura = GetCaster()->GetAura(WARLOCK_DIVINE_PLEA))
|
||||
aura->RefreshDuration();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_warl_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_guarded_by_the_light_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 6201 Create Healthstone (and ranks)
|
||||
class spell_warl_create_healthstone : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_warl_create_healthstone() : SpellHandlerScript("spell_warl_create_healthstone") { }
|
||||
|
||||
class spell_warl_create_healthstone_SpellScript : public SpellScript
|
||||
{
|
||||
static uint32 const iTypes[8][3];
|
||||
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_IMPROVED_HEALTHSTONE_R1))
|
||||
return false;
|
||||
if (!sSpellStore.LookupEntry(WARLOCK_IMPROVED_HEALTHSTONE_R2))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
uint32 rank = 0;
|
||||
// Improved Healthstone
|
||||
if (AuraEffect const * aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0))
|
||||
{
|
||||
switch (aurEff->GetId())
|
||||
{
|
||||
case WARLOCK_IMPROVED_HEALTHSTONE_R1: rank = 1; break;
|
||||
case WARLOCK_IMPROVED_HEALTHSTONE_R2: rank = 2; break;
|
||||
default:
|
||||
sLog.outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint8 spellRank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id);
|
||||
if (spellRank > 0 && spellRank <= 8)
|
||||
CreateItem(effIndex, iTypes[spellRank - 1][rank]);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_create_healthstone_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
uint32 const spell_warl_create_healthstone::spell_warl_create_healthstone_SpellScript::iTypes[8][3] = {
|
||||
{ 5512, 19004, 19005}, // Minor Healthstone
|
||||
{ 5511, 19006, 19007}, // Lesser Healthstone
|
||||
{ 5509, 19008, 19009}, // Healthstone
|
||||
{ 5510, 19010, 19011}, // Greater Healthstone
|
||||
{ 9421, 19012, 19013}, // Major Healthstone
|
||||
{22103, 22104, 22105}, // Master Healthstone
|
||||
{36889, 36890, 36891}, // Demonic Healthstone
|
||||
{36892, 36893, 36894} // Fel Healthstone
|
||||
};
|
||||
|
||||
|
||||
void AddSC_warlock_spell_scripts()
|
||||
{
|
||||
|
||||
new spell_warl_demonic_empowerment();
|
||||
new spell_warl_everlasting_affliction();
|
||||
new spell_warl_guarded_by_the_light();
|
||||
new spell_warl_create_healthstone();
|
||||
}
|
||||
Reference in new issue
Block a user