Core/Spells: convert some spell effects to SpellScripts

This commit is contained in:
joschiwald committed 2012-05-28 04:07:51 +02:00
1 parent 58f63509cd
commit ca07f30d03
26 files changed
+1099 -455

No files matched your search

+14 -2
View File
@@ -723,14 +723,25 @@ class spell_dk_death_coil : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_death_coil_SpellScript);
bool Validate(SpellInfo const* /*SpellEntry*/)
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL))
return false;
return true;
}
void HandleDummy(SpellEffIndex /* effIndex */)
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
{
if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
return SPELL_FAILED_BAD_TARGETS;
}
return SPELL_CAST_OK;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
Unit* caster = GetCaster();
@@ -752,6 +763,7 @@ class spell_dk_death_coil : public SpellScriptLoader
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
+120 -5
View File
@@ -28,7 +28,9 @@
enum DruidSpells
{
DRUID_INCREASED_MOONFIRE_DURATION = 38414,
DRUID_NATURES_SPLENDOR = 57865
DRUID_NATURES_SPLENDOR = 57865,
DRUID_LIFEBLOOM_FINAL_HEAL = 33778,
DRUID_LIFEBLOOM_ENERGIZE = 64372
};
// 54846 Glyph of Starfire
@@ -154,7 +156,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// reduces all damage taken while Stunned in Cat Form
if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
}
@@ -328,6 +330,26 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader
}
};
class StarfallDummyTargetFilter
{
public:
StarfallDummyTargetFilter(Unit* caster) : _caster(caster) { }
bool operator()(Unit* target) const
{
if (target->HasStealthAura() || target->HasInvisibilityAura())
return true;
if (!target->IsWithinLOSInMap(_caster))
return true;
return false;
}
private:
Unit* _caster;
};
class spell_dru_starfall_dummy : public SpellScriptLoader
{
public:
@@ -337,7 +359,14 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
{
PrepareSpellScript(spell_dru_starfall_dummy_SpellScript);
void HandleDummy(SpellEffIndex /* effIndex */)
void FilterTargets(std::list<Unit*>& unitList)
{
// Remove targets not in LoS or in stealth
unitList.remove_if(StarfallDummyTargetFilter(GetCaster()));
Trinity::Containers::RandomResizeList(unitList, 2);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
// Shapeshifting into an animal form or mounting cancels the effect
@@ -348,15 +377,16 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
return;
}
//Any effect which causes you to lose control of your character will supress the starfall effect.
// Any effect which causes you to lose control of your character will supress the starfall effect.
if (caster->HasUnitState(UNIT_STATE_CONTROLLED))
return;
caster->CastSpell(GetHitUnit(), GetEffectValue(), true);
caster->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -367,6 +397,90 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
}
};
class spell_dru_lifebloom : public SpellScriptLoader
{
public:
spell_dru_lifebloom() : SpellScriptLoader("spell_dru_lifebloom") { }
class spell_dru_lifebloom_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dru_lifebloom_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_FINAL_HEAL))
return false;
if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_ENERGIZE))
return false;
return true;
}
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
// Final heal only on duration end
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
// final heal
int32 stack = GetStackAmount();
int32 healAmount = aurEff->GetAmount();
Unit* caster = GetCaster();
if (caster)
{
healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack);
healAmount = GetTarget()->SpellHealingBonusTaken(GetSpellInfo(), healAmount, HEAL, stack);
}
GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
// restore mana
if (caster)
{
int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
}
}
void HandleDispel(DispelInfo* dispelInfo)
{
if (Unit* target = GetUnitOwner())
{
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
{
// final heal
int32 healAmount = aurEff->GetAmount();
Unit* caster = GetCaster();
if (caster)
{
healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
healAmount = target->SpellHealingBonusTaken(GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
}
target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
// restore mana
if (caster)
{
int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
}
}
}
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const
{
return new spell_dru_lifebloom_AuraScript();
}
};
void AddSC_druid_spell_scripts()
{
new spell_dru_glyph_of_starfire();
@@ -377,4 +491,5 @@ void AddSC_druid_spell_scripts()
new spell_dru_starfall_aoe();
new spell_dru_swift_flight_passive();
new spell_dru_starfall_dummy();
new spell_dru_lifebloom();
}
+120
View File
@@ -2688,6 +2688,120 @@ public:
}
};
enum GenericBandage
{
SPELL_RECENTLY_BANDAGED = 11196,
};
class spell_gen_bandage : public SpellScriptLoader
{
public:
spell_gen_bandage() : SpellScriptLoader("spell_gen_bandage") { }
class spell_gen_bandage_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_bandage_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_RECENTLY_BANDAGED))
return false;
return true;
}
SpellCastResult CheckCast()
{
if (Unit* target = GetExplTargetUnit())
{
if (target->HasAura(SPELL_RECENTLY_BANDAGED))
return SPELL_FAILED_TARGET_AURASTATE;
}
return SPELL_CAST_OK;
}
void HandleScript()
{
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_RECENTLY_BANDAGED, true);
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_gen_bandage_SpellScript::CheckCast);
AfterHit += SpellHitFn(spell_gen_bandage_SpellScript::HandleScript);
}
};
SpellScript* GetSpellScript() const
{
return new spell_gen_bandage_SpellScript();
}
};
enum GenericLifebloom
{
SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL = 43422,
SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL = 52552,
SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL = 53692,
SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL = 57763,
SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL = 66094,
};
class spell_gen_lifebloom : public SpellScriptLoader
{
public:
spell_gen_lifebloom(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
class spell_gen_lifebloom_AuraScript : public AuraScript
{
PrepareAuraScript(spell_gen_lifebloom_AuraScript);
public:
spell_gen_lifebloom_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { }
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(_spellId))
return false;
return true;
}
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
// Final heal only on duration end
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
// final heal
GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID());
}
void HandleDispel(DispelInfo* /*dispelInfo*/)
{
// final heal
if (Unit* target = GetUnitOwner())
target->CastSpell(target, _spellId, true, NULL, GetEffect(EFFECT_0), GetCasterGUID());
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
AfterDispel += AuraDispelFn(spell_gen_lifebloom_AuraScript::HandleDispel);
}
private:
uint32 _spellId;
};
AuraScript* GetAuraScript() const
{
return new spell_gen_lifebloom_AuraScript(_spellId);
}
private:
uint32 _spellId;
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -2742,4 +2856,10 @@ void AddSC_generic_spell_scripts()
new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp");
new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50);
new spell_gen_despawn_self();
new spell_gen_bandage();
new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL);
new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL);
new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL);
new spell_gen_lifebloom("spell_twisted_visage_lifebloom", SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL);
new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL);
}
@@ -618,6 +618,34 @@ class spell_hun_misdirection_proc : public SpellScriptLoader
}
};
class spell_hun_disengage : public SpellScriptLoader
{
public:
spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { }
class spell_hun_disengage_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_disengage_SpellScript);
SpellCastResult CheckCast()
{
if (GetCaster()->GetTypeId() == TYPEID_PLAYER && !GetCaster()->isInCombat())
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_disengage_SpellScript();
}
};
void AddSC_hunter_spell_scripts()
{
@@ -633,4 +661,5 @@ void AddSC_hunter_spell_scripts()
new spell_hun_pet_carrion_feeder();
new spell_hun_misdirection();
new spell_hun_misdirection_proc();
new spell_hun_disengage();
}
+43 -4
View File
@@ -342,13 +342,52 @@ public:
}
};
class spell_mage_living_bomb : public SpellScriptLoader
{
public:
spell_mage_living_bomb() : SpellScriptLoader("spell_mage_living_bomb") { }
class spell_mage_living_bomb_AuraScript : public AuraScript
{
PrepareAuraScript(spell_mage_living_bomb_AuraScript);
bool Validate(SpellInfo const* spell)
{
if (!sSpellMgr->GetSpellInfo(uint32(spell->Effects[EFFECT_1].CalcValue())))
return false;
return true;
}
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE)
return;
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, NULL, aurEff);
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_mage_living_bomb_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_mage_living_bomb_AuraScript();
}
};
void AddSC_mage_spell_scripts()
{
new spell_mage_blast_wave;
new spell_mage_cold_snap;
new spell_mage_blast_wave();
new spell_mage_cold_snap();
new spell_mage_frost_warding_trigger();
new spell_mage_incanters_absorbtion_absorb();
new spell_mage_incanters_absorbtion_manashield();
new spell_mage_polymorph_cast_visual;
new spell_mage_summon_water_elemental;
new spell_mage_polymorph_cast_visual();
new spell_mage_summon_water_elemental();
new spell_mage_living_bomb();
}
+85 -7
View File
@@ -43,6 +43,10 @@ enum PaladinSpells
SPELL_DIVINE_STORM = 53385,
SPELL_DIVINE_STORM_DUMMY = 54171,
SPELL_DIVINE_STORM_HEAL = 54172,
SPELL_FORBEARANCE = 25771,
SPELL_AVENGING_WRATH_MARKER = 61987,
SPELL_IMMUNE_SHIELD_MARKER = 61988,
};
// 31850 - Ardent Defender
@@ -255,17 +259,18 @@ class spell_pal_holy_shock : public SpellScriptLoader
class spell_pal_holy_shock_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_holy_shock_SpellScript)
bool Validate(SpellInfo const* spellEntry)
PrepareSpellScript(spell_pal_holy_shock_SpellScript);
bool Validate(SpellInfo const* spell)
{
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1))
return false;
// can't use other spell than holy shock due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spell->Id))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
uint8 rank = sSpellMgr->GetSpellRank(spell->Id);
if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
return false;
@@ -287,10 +292,18 @@ class spell_pal_holy_shock : public SpellScriptLoader
SpellCastResult CheckCast()
{
Player* caster = GetCaster()->ToPlayer();
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
{
if (!caster->IsFriendlyTo(target))
{
if (!caster->HasInArc(static_cast<float>(M_PI), target))
return SPELL_FAILED_UNIT_NOT_INFRONT;
if (!caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
}
}
return SPELL_CAST_OK;
}
@@ -423,6 +436,70 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
}
};
class spell_pal_lay_on_hands : public SpellScriptLoader
{
public:
spell_pal_lay_on_hands() : SpellScriptLoader("spell_pal_lay_on_hands") { }
class spell_pal_lay_on_hands_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_lay_on_hands_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_FORBEARANCE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_AVENGING_WRATH_MARKER))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_IMMUNE_SHIELD_MARKER))
return false;
return true;
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
{
if (caster == target)
{
if (target->HasAura(SPELL_FORBEARANCE))
return SPELL_FAILED_TARGET_AURASTATE;
if (target->HasAura(SPELL_AVENGING_WRATH_MARKER))
return SPELL_FAILED_TARGET_AURASTATE;
if (target->HasAura(SPELL_IMMUNE_SHIELD_MARKER))
return SPELL_FAILED_TARGET_AURASTATE;
}
}
return SPELL_CAST_OK;
}
void HandleScript()
{
Unit* caster = GetCaster();
if (caster == GetHitUnit())
{
caster->CastSpell(caster, SPELL_FORBEARANCE, true);
caster->CastSpell(caster, SPELL_AVENGING_WRATH_MARKER, true);
caster->CastSpell(caster, SPELL_IMMUNE_SHIELD_MARKER, true);
}
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands_SpellScript::CheckCast);
AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_lay_on_hands_SpellScript();
}
};
void AddSC_paladin_spell_scripts()
{
new spell_pal_ardent_defender();
@@ -433,4 +510,5 @@ void AddSC_paladin_spell_scripts()
new spell_pal_judgement_of_command();
new spell_pal_divine_storm();
new spell_pal_divine_storm_dummy();
new spell_pal_lay_on_hands();
}
@@ -34,6 +34,7 @@ enum PriestSpells
PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619,
PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201,
PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085,
};
// Guardian Spirit
@@ -330,6 +331,50 @@ public:
}
};
class spell_pri_vampiric_touch : public SpellScriptLoader
{
public:
spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { }
class spell_pri_vampiric_touch_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pri_vampiric_touch_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL))
return false;
return true;
}
void HandleDispel(DispelInfo* /*dispelInfo*/)
{
if (Unit* caster = GetCaster())
{
if (Unit* target = GetUnitOwner())
{
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
{
int32 damage = aurEff->GetAmount() * 8;
// backfire damage
caster->CastCustomSpell(target, PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
}
}
}
}
void Register()
{
AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const
{
return new spell_pri_vampiric_touch_AuraScript();
}
};
void AddSC_priest_spell_scripts()
{
new spell_pri_guardian_spirit();
@@ -339,4 +384,5 @@ void AddSC_priest_spell_scripts()
new spell_pri_reflective_shield_trigger();
new spell_pri_mind_sear();
new spell_pri_prayer_of_mending_heal();
new spell_pri_vampiric_touch();
}
@@ -42,6 +42,10 @@ enum ShamanSpells
// For Earthen Power
SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474,
SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566,
ICON_ID_SHAMAN_LAVA_FLOW = 3087,
SHAMAN_LAVA_FLOWS_R1 = 51480,
SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694,
};
// 51474 - Astral shift
@@ -652,6 +656,52 @@ class spell_sha_chain_heal : public SpellScriptLoader
}
};
class spell_sha_flame_shock : public SpellScriptLoader
{
public:
spell_sha_flame_shock() : SpellScriptLoader("spell_sha_flame_shock") { }
class spell_sha_flame_shock_AuraScript : public AuraScript
{
PrepareAuraScript(spell_sha_flame_shock_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_R1))
return false;
if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_TRIGGERED_R1))
return false;
return true;
}
void HandleDispel(DispelInfo* /*dispelInfo*/)
{
if (Unit* caster = GetCaster())
{
// Lava Flows
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, 0))
{
if (sSpellMgr->GetFirstSpellInChain(SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId()))
return;
uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId());
caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true);
}
}
}
void Register()
{
AfterDispel += AuraDispelFn(spell_sha_flame_shock_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const
{
return new spell_sha_flame_shock_AuraScript();
}
};
void AddSC_shaman_spell_scripts()
{
new spell_sha_astral_shift();
@@ -667,4 +717,5 @@ void AddSC_shaman_spell_scripts()
new spell_sha_mana_spring_totem();
new spell_sha_lava_lash();
new spell_sha_chain_heal();
new spell_sha_flame_shock();
}
+104
View File
@@ -37,6 +37,8 @@ enum WarlockSpells
WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018,
WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020,
WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388,
WARLOCK_HAUNT_HEAL = 48210,
WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
};
class spell_warl_banish : public SpellScriptLoader
@@ -523,6 +525,106 @@ class spell_warl_demonic_circle_teleport : public SpellScriptLoader
}
};
class spell_warl_haunt : public SpellScriptLoader
{
public:
spell_warl_haunt() : SpellScriptLoader("spell_warl_haunt") { }
class spell_warl_haunt_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warl_haunt_SpellScript);
void HandleOnHit()
{
if (Aura* aura = GetHitAura())
if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1))
aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage()));
}
void Register()
{
OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit);
}
};
class spell_warl_haunt_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_haunt_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(WARLOCK_HAUNT_HEAL))
return false;
return true;
}
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
int32 amount = aurEff->GetAmount();
GetTarget()->CastCustomSpell(caster, WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
}
}
void Register()
{
OnEffectRemove += AuraEffectApplyFn(spell_warl_haunt_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
SpellScript* GetSpellScript() const
{
return new spell_warl_haunt_SpellScript();
}
AuraScript* GetAuraScript() const
{
return new spell_warl_haunt_AuraScript();
}
};
class spell_warl_unstable_affliction : public SpellScriptLoader
{
public:
spell_warl_unstable_affliction() : SpellScriptLoader("spell_warl_unstable_affliction") { }
class spell_warl_unstable_affliction_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_unstable_affliction_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(WARLOCK_UNSTABLE_AFFLICTION_DISPEL))
return false;
return true;
}
void HandleDispel(DispelInfo* dispelInfo)
{
if (Unit* caster = GetCaster())
{
if (AuraEffect const* aurEff = GetEffect(EFFECT_0))
{
int32 damage = aurEff->GetAmount() * 9;
// backfire damage and silence
caster->CastCustomSpell(dispelInfo->GetDispeller(), WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
}
}
}
void Register()
{
AfterDispel += AuraDispelFn(spell_warl_unstable_affliction_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const
{
return new spell_warl_unstable_affliction_AuraScript();
}
};
void AddSC_warlock_spell_scripts()
{
new spell_warl_banish();
@@ -535,4 +637,6 @@ void AddSC_warlock_spell_scripts()
new spell_warl_life_tap();
new spell_warl_demonic_circle_summon();
new spell_warl_demonic_circle_teleport();
new spell_warl_haunt();
new spell_warl_unstable_affliction();
}