Core/Spell: convert more spells to SpellScripts

This commit is contained in:
joschiwald committed 2013-01-22 23:36:51 +01:00
1 parent 017ff298dd
commit af50ce6223
21 files changed
+1795 -801

No files matched your search

+286 -65
View File
@@ -102,6 +102,63 @@ class spell_item_arcane_shroud : public SpellScriptLoader
}
};
// 64411 - Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings)
enum BlessingOfAncientKings
{
SPELL_PROTECTION_OF_ANCIENT_KINGS = 64413
};
class spell_item_blessing_of_ancient_kings : public SpellScriptLoader
{
public:
spell_item_blessing_of_ancient_kings() : SpellScriptLoader("spell_item_blessing_of_ancient_kings") { }
class spell_item_blessing_of_ancient_kings_AuraScript : public AuraScript
{
PrepareAuraScript(spell_item_blessing_of_ancient_kings_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PROTECTION_OF_ANCIENT_KINGS))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetProcTarget();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 absorb = int32(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15.0f));
if (AuraEffect* protEff = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, 0, eventInfo.GetActor()->GetGUID()))
{
// The shield can grow to a maximum size of 20,000 damage absorbtion
protEff->SetAmount(std::min<int32>(protEff->GetAmount() + absorb, 20000));
// Refresh and return to prevent replacing the aura
aurEff->GetBase()->RefreshDuration();
}
else
GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, NULL, aurEff);
}
void Register()
{
DoCheckProc += AuraCheckProcFn(spell_item_blessing_of_ancient_kings_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_item_blessing_of_ancient_kings_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_item_blessing_of_ancient_kings_AuraScript();
}
};
// 8342 - Defibrillate (Goblin Jumper Cables) have 33% chance on success
// 22999 - Defibrillate (Goblin Jumper Cables XL) have 50% chance on success
// 54732 - Defibrillate (Gnomish Army Knife) have 67% chance on success
@@ -444,6 +501,47 @@ class spell_item_mingos_fortune_generator : public SpellScriptLoader
}
};
// 71875, 71877 - Item - Black Bruise: Necrotic Touch Proc
enum NecroticTouch
{
SPELL_ITEM_NECROTIC_TOUCH_PROC = 71879
};
class spell_item_necrotic_touch : public SpellScriptLoader
{
public:
spell_item_necrotic_touch() : SpellScriptLoader("spell_item_necrotic_touch") { }
class spell_item_necrotic_touch_AuraScript : public AuraScript
{
PrepareAuraScript(spell_item_necrotic_touch_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_ITEM_NECROTIC_TOUCH_PROC))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 bp = CalculatePct(int32(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount());
GetTarget()->CastCustomSpell(SPELL_ITEM_NECROTIC_TOUCH_PROC, SPELLVALUE_BASE_POINT0, bp, GetTarget(), true, NULL, aurEff);
}
void Register()
{
OnEffectProc += AuraEffectProcFn(spell_item_necrotic_touch_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_item_necrotic_touch_AuraScript();
}
};
// http://www.wowhead.com/item=10720 Gnomish Net-o-Matic Projector
// 13120 Net-o-Matic
enum NetOMaticSpells
@@ -711,6 +809,189 @@ class spell_item_scroll_of_recall : public SpellScriptLoader
}
};
// 71169 - Shadow's Fate (Shadowmourne questline)
enum ShadowsFate
{
SPELL_SOUL_FEAST = 71203,
QUEST_A_FEAST_OF_SOULS = 24547
};
class spell_item_shadows_fate : public SpellScriptLoader
{
public:
spell_item_shadows_fate() : SpellScriptLoader("spell_item_shadows_fate") { }
class spell_item_shadows_fate_AuraScript : public AuraScript
{
PrepareAuraScript(spell_item_shadows_fate_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_FEAST))
return false;
if (!sObjectMgr->GetQuestTemplate(QUEST_A_FEAST_OF_SOULS))
return false;
return true;
}
bool Load()
{
_procTarget = NULL;
return true;
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
{
_procTarget = GetCaster();
return _procTarget && _procTarget->GetTypeId() == TYPEID_PLAYER && _procTarget->ToPlayer()->GetQuestStatus(QUEST_A_FEAST_OF_SOULS) == QUEST_STATUS_INCOMPLETE;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
GetTarget()->CastSpell(_procTarget, SPELL_SOUL_FEAST, true);
}
void Register()
{
DoCheckProc += AuraCheckProcFn(spell_item_shadows_fate_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_item_shadows_fate_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
private:
Unit* _procTarget;
};
AuraScript* GetAuraScript() const
{
return new spell_item_shadows_fate_AuraScript();
}
};
enum Shadowmourne
{
SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE = 71904,
SPELL_SHADOWMOURNE_SOUL_FRAGMENT = 71905,
SPELL_SHADOWMOURNE_VISUAL_LOW = 72521,
SPELL_SHADOWMOURNE_VISUAL_HIGH = 72523,
SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF = 73422,
};
// 71903 - Item - Shadowmourne Legendary
class spell_item_shadowmourne : public SpellScriptLoader
{
public:
spell_item_shadowmourne() : SpellScriptLoader("spell_item_shadowmourne") { }
class spell_item_shadowmourne_AuraScript : public AuraScript
{
PrepareAuraScript(spell_item_shadowmourne_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_SOUL_FRAGMENT))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
if (GetTarget()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) // cant collect shards while under effect of Chaos Bane buff
return false;
return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->isAlive();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true, NULL, aurEff);
// this can't be handled in AuraScript of SoulFragments because we need to know victim
if (Aura* soulFragments = GetTarget()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT))
{
if (soulFragments->GetStackAmount() >= 10)
{
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL, aurEff);
soulFragments->Remove();
}
}
}
void Register()
{
DoCheckProc += AuraCheckProcFn(spell_item_shadowmourne_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_item_shadowmourne_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_item_shadowmourne_AuraScript();
}
};
// 71905 - Soul Fragment
class spell_item_shadowmourne_soul_fragment : public SpellScriptLoader
{
public:
spell_item_shadowmourne_soul_fragment() : SpellScriptLoader("spell_item_shadowmourne_soul_fragment") { }
class spell_item_shadowmourne_soul_fragment_AuraScript : public AuraScript
{
PrepareAuraScript(spell_item_shadowmourne_soul_fragment_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_LOW) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_HIGH) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
return false;
return true;
}
void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
switch (GetStackAmount())
{
case 1:
target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_LOW, true);
break;
case 6:
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW);
target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_HIGH, true);
break;
case 10:
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH);
target->CastSpell(target, SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF, true);
break;
default:
break;
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW);
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH);
}
void Register()
{
AfterEffectApply += AuraEffectApplyFn(spell_item_shadowmourne_soul_fragment_AuraScript::OnStackChange, EFFECT_0, SPELL_AURA_MOD_STAT, AuraEffectHandleModes(AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY));
AfterEffectRemove += AuraEffectRemoveFn(spell_item_shadowmourne_soul_fragment_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_item_shadowmourne_soul_fragment_AuraScript();
}
};
// http://www.wowhead.com/item=7734 Six Demon Bag
// 14537 Six Demon Bag
enum SixDemonBagSpells
@@ -864,70 +1145,6 @@ class spell_item_underbelly_elixir : public SpellScriptLoader
}
};
enum eShadowmourneVisuals
{
SPELL_SHADOWMOURNE_VISUAL_LOW = 72521,
SPELL_SHADOWMOURNE_VISUAL_HIGH = 72523,
SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF = 73422,
};
class spell_item_shadowmourne : public SpellScriptLoader
{
public:
spell_item_shadowmourne() : SpellScriptLoader("spell_item_shadowmourne") { }
class spell_item_shadowmourne_AuraScript : public AuraScript
{
PrepareAuraScript(spell_item_shadowmourne_AuraScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_LOW) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_HIGH) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
return false;
return true;
}
void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
switch (GetStackAmount())
{
case 1:
target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_LOW, true);
break;
case 6:
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW);
target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_HIGH, true);
break;
case 10:
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH);
target->CastSpell(target, SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF, true);
break;
default:
break;
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW);
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH);
}
void Register()
{
AfterEffectApply += AuraEffectApplyFn(spell_item_shadowmourne_AuraScript::OnStackChange, EFFECT_0, SPELL_AURA_MOD_STAT, AuraEffectHandleModes(AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY));
AfterEffectRemove += AuraEffectRemoveFn(spell_item_shadowmourne_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_item_shadowmourne_AuraScript();
}
};
enum AirRifleSpells
{
SPELL_AIR_RIFLE_HOLD_VISUAL = 65582,
@@ -2249,6 +2466,7 @@ void AddSC_item_spell_scripts()
new spell_item_trigger_spell("spell_item_mithril_mechanical_dragonling", SPELL_MITHRIL_MECHANICAL_DRAGONLING);
new spell_item_arcane_shroud();
new spell_item_blessing_of_ancient_kings();
new spell_item_defibrillate("spell_item_goblin_jumper_cables", 67, SPELL_GOBLIN_JUMPER_CABLES_FAIL);
new spell_item_defibrillate("spell_item_goblin_jumper_cables_xl", 50, SPELL_GOBLIN_JUMPER_CABLES_XL_FAIL);
new spell_item_defibrillate("spell_item_gnomish_army_knife", 33);
@@ -2257,15 +2475,18 @@ void AddSC_item_spell_scripts()
new spell_item_gnomish_death_ray();
new spell_item_make_a_wish();
new spell_item_mingos_fortune_generator();
new spell_item_necrotic_touch();
new spell_item_net_o_matic();
new spell_item_noggenfogger_elixir();
new spell_item_piccolo_of_the_flaming_fire();
new spell_item_savory_deviate_delight();
new spell_item_scroll_of_recall();
new spell_item_shadows_fate();
new spell_item_shadowmourne();
new spell_item_shadowmourne_soul_fragment();
new spell_item_six_demon_bag();
new spell_item_the_eye_of_diminution();
new spell_item_underbelly_elixir();
new spell_item_shadowmourne();
new spell_item_red_rider_air_rifle();
new spell_item_create_heart_candy();