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,141 @@
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "Spell.h"
|
||||
|
||||
enum DeathKnightSpells
|
||||
{
|
||||
DK_SPELL_SUMMON_GARGOYLE = 50514,
|
||||
DK_SPELL_CORPSE_EXPLOSION_TRIGGERED = 43999,
|
||||
DISPLAY_GHOUL_CORPSE = 25537,
|
||||
DK_SPELL_SCOURGE_STRIKE_TRIGGERED = 70890,
|
||||
};
|
||||
|
||||
// 49158 Corpse Explosion (51325, 51326, 51327, 51328)
|
||||
class spell_dk_corpse_explosion : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_dk_corpse_explosion() : SpellHandlerScript("spell_dk_corpse_explosion") { }
|
||||
|
||||
class spell_dk_corpse_explosion_SpellScript : public SpellScript
|
||||
{
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
int32 bp = 0;
|
||||
// Living ghoul as a target
|
||||
if (unitTarget->isAlive())
|
||||
bp = unitTarget->GetMaxHealth() * 0.25f;
|
||||
// Some corpse
|
||||
else
|
||||
bp = GetEffectValue();
|
||||
GetCaster()->CastCustomSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1), &bp, NULL, NULL, true);
|
||||
// Corpse Explosion (Suicide)
|
||||
unitTarget->CastCustomSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, &bp, NULL, NULL, true);
|
||||
// Set corpse look
|
||||
unitTarget->SetDisplayId(DISPLAY_GHOUL_CORPSE + urand(0, 3));
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_dk_corpse_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dk_corpse_explosion_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 50524 Runic Power Feed (keeping Gargoyle alive)
|
||||
class spell_dk_runic_power_feed : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_dk_runic_power_feed() : SpellHandlerScript("spell_dk_runic_power_feed") { }
|
||||
|
||||
class spell_dk_runic_power_feed_SpellScript : public SpellScript
|
||||
{
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(DK_SPELL_SUMMON_GARGOYLE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
// No power, dismiss Gargoyle
|
||||
if (caster->GetPower(POWER_RUNIC_POWER) < 30)
|
||||
caster->RemoveAurasDueToSpell(DK_SPELL_SUMMON_GARGOYLE, caster->GetGUID());
|
||||
else
|
||||
caster->ModifyPower(POWER_RUNIC_POWER, -30);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_dk_runic_power_feed_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dk_runic_power_feed_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 55090 Scourge Strike (55265, 55270, 55271)
|
||||
class spell_dk_scourge_strike : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_dk_scourge_strike() : SpellHandlerScript("spell_dk_scourge_strike") { }
|
||||
|
||||
class spell_dk_scourge_strike_SpellScript : public SpellScript
|
||||
{
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(DK_SPELL_SCOURGE_STRIKE_TRIGGERED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
int32 bp = (GetHitDamage() * GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID())) / 100;
|
||||
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dk_scourge_strike_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_deathknight_spell_scripts()
|
||||
{
|
||||
|
||||
new spell_dk_corpse_explosion();
|
||||
new spell_dk_runic_power_feed();
|
||||
new spell_dk_scourge_strike();
|
||||
}
|
||||
Reference in new issue
Block a user