Scripts/Spells: move implementation of some spells into scripts.

* 41337 Aura of Anger
* 46394 Burn (Brutallus)
* 53302 Sniper Training
* 45472 Parachute
* 66118 Leeching Swarm
* 51685 Prey on the Weak
* 20911 Blessing of Sanctuary
* 25899 Greater Blessing of Sanctuary
Scripts/Spells: remove several spells implementations from core to table (requires DB data)
* 31231 Cheat Death
* 51662 Hunger for Blood

--HG--
branch : trunk
This commit is contained in:
azazel
2010-09-21 23:59:45 +06:00
parent 38be7aab55
commit 5eb0fd80ac
7 changed files with 346 additions and 183 deletions
+154
View File
@@ -23,6 +23,106 @@
*/
#include "ScriptPCH.h"
#include "SpellAuraEffects.h"
// 41337 Aura of Anger
class spell_gen_aura_of_anger : public SpellScriptLoader
{
public:
spell_gen_aura_of_anger() : SpellScriptLoader("spell_gen_aura_of_anger") { }
class spell_gen_aura_of_anger_AuraScript : public AuraScript
{
void HandleEffectPeriodicUpdate(AuraEffect * aurEff)
{
if (AuraEffect * aurEff1 = aurEff->GetBase()->GetEffect(EFFECT_1))
aurEff1->ChangeAmount(aurEff1->GetAmount() + 5);
aurEff->SetAmount(100 * aurEff->GetTickNumber());
}
void Register()
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_aura_of_anger_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript *GetAuraScript() const
{
return new spell_gen_aura_of_anger_AuraScript();
}
};
// 46394 Brutallus Burn
class spell_gen_burn_brutallus : public SpellScriptLoader
{
public:
spell_gen_burn_brutallus() : SpellScriptLoader("spell_gen_burn_brutallus") { }
class spell_gen_burn_brutallus_AuraScript : public AuraScript
{
void HandleEffectPeriodicUpdate(AuraEffect * aurEff)
{
if (aurEff->GetTickNumber() % 11 == 0)
aurEff->SetAmount(aurEff->GetAmount() * 2);
}
void Register()
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_burn_brutallus_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
AuraScript *GetAuraScript() const
{
return new spell_gen_burn_brutallus_AuraScript();
}
};
// 45472 Parachute
enum eParachuteSpells
{
SPELL_PARACHUTE = 45472,
SPELL_PARACHUTE_BUFF = 44795,
};
class spell_gen_parachute : public SpellScriptLoader
{
public:
spell_gen_parachute() : SpellScriptLoader("spell_gen_parachute") { }
class spell_gen_parachute_AuraScript : public AuraScript
{
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_PARACHUTE))
return false;
if (!sSpellStore.LookupEntry(SPELL_PARACHUTE_BUFF))
return false;
return true;
}
void HandleEffectPeriodic(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp)
{
if (Unit* pTarget = aurApp->GetTarget())
if (Player* pPlayerTarget = pTarget->ToPlayer())
if (pPlayerTarget->IsFalling())
{
pPlayerTarget->RemoveAurasDueToSpell(SPELL_PARACHUTE);
pPlayerTarget->CastSpell(pPlayerTarget, SPELL_PARACHUTE_BUFF, true);
}
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript *GetAuraScript() const
{
return new spell_gen_parachute_AuraScript();
}
};
enum NPCEntries
{
@@ -115,6 +215,56 @@ public:
}
};
// 66118 Leeching Swarm
enum eLeechingSwarmSpells
{
SPELL_LEECHING_SWARM_DMG = 66240,
SPELL_LEECHING_SWARM_HEAL = 66125,
};
class spell_gen_leeching_swarm : public SpellScriptLoader
{
public:
spell_gen_leeching_swarm() : SpellScriptLoader("spell_gen_leeching_swarm") { }
class spell_gen_leeching_swarm_AuraScript : public AuraScript
{
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(SPELL_LEECHING_SWARM_DMG))
return false;
if (!sSpellStore.LookupEntry(SPELL_LEECHING_SWARM_HEAL))
return false;
return true;
}
void HandleEffectPeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp)
{
if (Unit* pTarget = aurApp->GetTarget())
if (Unit* pCaster = GetCaster())
{
int32 lifeLeeched = pTarget->CountPctFromMaxHealth(aurEff->GetAmount());
if (lifeLeeched < 250)
lifeLeeched = 250;
// Damage
pCaster->CastCustomSpell(pTarget, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false);
// Heal
pCaster->CastCustomSpell(pCaster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false);
}
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript *GetAuraScript() const
{
return new spell_gen_leeching_swarm_AuraScript();
}
};
// 24750 Trick
enum eTrickSpells
{
@@ -320,6 +470,10 @@ public:
void AddSC_generic_spell_scripts()
{
new spell_gen_aura_of_anger();
new spell_gen_burn_brutallus();
new spell_gen_leeching_swarm();
new spell_gen_parachute();
new spell_gen_pet_summoned();
new spell_gen_remove_flight_auras();
new spell_gen_trick();
@@ -329,6 +329,72 @@ public:
}
};
// 53302, 53303, 53304 Sniper Training
enum eSniperTrainingSpells
{
SPELL_SNIPER_TRAINING_R1 = 53302,
SPELL_SNIPER_TRAINING_BUFF_R1 = 64418,
};
class spell_hun_sniper_training : public SpellScriptLoader
{
public:
spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { }
class spell_hun_sniper_training_AuraScript : public AuraScript
{
bool Validate(SpellEntry const * entry)
{
if (!sSpellStore.LookupEntry(SPELL_SNIPER_TRAINING_R1))
return false;
if (!sSpellStore.LookupEntry(SPELL_SNIPER_TRAINING_BUFF_R1))
return false;
return true;
}
void HandlePeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp)
{
if (aurEff->GetAmount() > 0)
return;
if (Unit* pTarget = aurApp->GetTarget())
{
uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1;
if (!pTarget->HasAura(spellId))
{
const SpellEntry* triggeredSpellInfo = sSpellStore.LookupEntry(spellId);
Unit* triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, GetCaster(), pTarget);
triggerCaster->CastSpell(pTarget, triggeredSpellInfo, true, 0, aurEff);
}
}
}
void HandleUpdatePeriodic(AuraEffect * aurEff)
{
if (Unit* pTarget = GetUnitOwner())
if (Player* pPlayerTarget = pTarget->ToPlayer())
{
int32 baseAmount = aurEff->GetBaseAmount();
int32 amount = pPlayerTarget->isMoving() ?
pTarget->CalculateSpellDamage(pTarget, GetSpellProto(), aurEff->GetEffIndex(), &baseAmount) :
aurEff->GetAmount() - 1;
aurEff->SetAmount(amount);
}
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_sniper_training_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hun_sniper_training_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript *GetAuraScript() const
{
return new spell_hun_sniper_training_AuraScript();
}
};
class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
{
public:
@@ -424,6 +490,7 @@ void AddSC_hunter_spell_scripts()
new spell_hun_masters_call();
new spell_hun_readiness();
new spell_hun_scatter_shot();
new spell_hun_sniper_training();
new spell_hun_pet_heart_of_the_phoenix();
new spell_hun_pet_carrion_feeder();
}
@@ -27,6 +27,7 @@
enum PaladinSpells
{
PALADIN_SPELL_DIVINE_PLEA = 54428,
PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF = 67480,
PALADIN_SPELL_HOLY_SHOCK_R1 = 20473,
PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE = 25912,
@@ -89,6 +90,49 @@ public:
}
};
// 20911 Blessing of Sanctuary
// 25899 Greater Blessing of Sanctuary
class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
{
public:
spell_pal_blessing_of_sanctuary() : SpellScriptLoader("spell_pal_blessing_of_sanctuary") { }
class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript
{
bool Validate(SpellEntry const * entry)
{
if (!sSpellStore.LookupEntry(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF))
return false;
return true;
}
void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/)
{
if (Unit* pCaster = GetCaster())
if (Unit* pTarget = aurApp->GetTarget())
pCaster->CastSpell(pTarget, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true);
}
void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/)
{
if (GetCaster())
if (Unit* pTarget = aurApp->GetTarget())
pTarget->RemoveAura(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID());
}
void Register()
{
OnEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript *GetAuraScript() const
{
return new spell_pal_blessing_of_sanctuary_AuraScript();
}
};
// 63521 Guarded by The Light
class spell_pal_guarded_by_the_light : public SpellScriptLoader
{
@@ -206,6 +250,7 @@ public:
void AddSC_paladin_spell_scripts()
{
new spell_pal_blessing_of_faith();
new spell_pal_blessing_of_sanctuary();
new spell_pal_guarded_by_the_light();
new spell_pal_holy_shock();
new spell_pal_judgement_of_command();
+50 -72
View File
@@ -25,76 +25,9 @@
enum RogueSpells
{
ROGUE_SPELL_HUNGER_FOR_BLOOD_BUFF = 63848,
ROGUE_SPELL_SHIV_TRIGGERED = 5940,
ROGUE_SPELL_CHEATING_DEATH = 45182,
ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819,
};
class spell_rog_cheat_death : public SpellScriptLoader
{
public:
spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { }
class spell_rog_cheat_death_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_CHEATING_DEATH))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit *caster = GetCaster();
caster->CastSpell(caster, ROGUE_SPELL_CHEATING_DEATH, true);
}
void Register()
{
// add dummy effect spell handler to Cheat Death
OnEffect += SpellEffectFn(spell_rog_cheat_death_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_rog_cheat_death_SpellScript;
}
};
class spell_rog_hunger_for_blood : public SpellScriptLoader
{
public:
spell_rog_hunger_for_blood() : SpellScriptLoader("spell_rog_hunger_for_blood") { }
class spell_rog_hunger_for_blood_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_HUNGER_FOR_BLOOD_BUFF))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit *caster = GetCaster();
caster->CastSpell(caster, ROGUE_SPELL_HUNGER_FOR_BLOOD_BUFF, true);
}
void Register()
{
// add dummy effect spell handler to Hunger for Blood
OnEffect += SpellEffectFn(spell_rog_hunger_for_blood_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_rog_hunger_for_blood_SpellScript();
}
ROGUE_SPELL_PREY_ON_THE_WEAK = 58670,
};
class spell_rog_preparation : public SpellScriptLoader
@@ -159,6 +92,52 @@ class spell_rog_preparation : public SpellScriptLoader
}
};
// 51685-51689 Prey on the Weak
class spell_rog_prey_on_the_weak : public SpellScriptLoader
{
public:
spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { }
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
{
bool Validate(SpellEntry const * /*spellEntry*/)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_PREY_ON_THE_WEAK))
return false;
return true;
}
void HandleEffectPeriodic(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp)
{
if (Unit* pTarget = aurApp->GetTarget())
{
Unit* pVictim = pTarget->getVictim();
if (pVictim && (pTarget->GetHealthPct() > pVictim->GetHealthPct()))
{
if (!pTarget->HasAura(ROGUE_SPELL_PREY_ON_THE_WEAK))
{
int32 bp = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 0);
pTarget->CastCustomSpell(pTarget, ROGUE_SPELL_PREY_ON_THE_WEAK, &bp, 0, 0, true);
}
}
else
pTarget->RemoveAurasDueToSpell(ROGUE_SPELL_PREY_ON_THE_WEAK);
}
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript *GetAuraScript() const
{
return new spell_rog_prey_on_the_weak_AuraScript();
}
};
class spell_rog_shiv : public SpellScriptLoader
{
public:
@@ -198,8 +177,7 @@ class spell_rog_shiv : public SpellScriptLoader
void AddSC_rogue_spell_scripts()
{
new spell_rog_cheat_death;
new spell_rog_hunger_for_blood;
new spell_rog_preparation;
new spell_rog_shiv;
new spell_rog_preparation();
new spell_rog_prey_on_the_weak();
new spell_rog_shiv();
}