diff options
author | blub <Vincent_Michael@gmx.de> | 2013-01-12 18:19:55 -0800 |
---|---|---|
committer | blub <Vincent_Michael@gmx.de> | 2013-01-12 18:19:55 -0800 |
commit | 673a85e1838151c2989a318f1d1691ea0706db73 (patch) | |
tree | 4108e7d57cbfe03b0be1bee47eafbd751578b05e | |
parent | abe4b656c8775c2fe25649e83c135510442dc2b8 (diff) | |
parent | 2f1bbb2c7ae29ee9f7509395f126bd341f683046 (diff) |
Merge pull request #8928 from joschiwald/spellscripts_reorder3
Misc: Reorder more scripts in some script files and some cosmetic stuff
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_holiday.cpp | 8 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 549 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 714 |
6 files changed, 640 insertions, 640 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index afb9a625761..060db02d53c 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -172,7 +172,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader return true; } - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { if (!sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT)) return false; diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index 83532e7d72d..d883b4d7da7 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -17,6 +17,7 @@ /* * Spells used in holidays/game events that do not fit any other category. + * Ordered alphabetically using scriptname. * Scriptnames in this file should be prefixed with "spell_#holidayname_". */ @@ -133,6 +134,7 @@ class spell_hallow_end_trick : public SpellScriptLoader class spell_hallow_end_trick_SpellScript : public SpellScript { PrepareSpellScript(spell_hallow_end_trick_SpellScript); + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE) @@ -170,7 +172,7 @@ class spell_hallow_end_trick : public SpellScriptLoader break; } - caster->CastSpell(target, spellId, true, NULL); + caster->CastSpell(target, spellId, true); } } @@ -218,8 +220,8 @@ class spell_hallow_end_trick_or_treat : public SpellScriptLoader Unit* caster = GetCaster(); if (Player* target = GetHitPlayer()) { - caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL); - caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL); + caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true); + caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true); } } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index b3c429d27aa..a9b21807899 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -286,7 +286,6 @@ class spell_hun_last_stand_pet : public SpellScriptLoader void Register() { - // add dummy effect spell handler to pet's Last Stand OnEffectHitTarget += SpellEffectFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -452,7 +451,6 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader void Register() { - // add dummy effect spell handler to pet's Last Stand OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear); } @@ -501,7 +499,6 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader void Register() { - // add dummy effect spell handler to pet's Last Stand OnEffectHitTarget += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -551,7 +548,6 @@ class spell_hun_readiness : public SpellScriptLoader void Register() { - // add dummy effect spell handler to Readiness OnEffectHitTarget += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 1a2738afdbb..70b677f5aaa 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -250,7 +250,7 @@ class spell_rog_preparation : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_GLYPH_OF_PREPARATION)) return false; @@ -292,7 +292,6 @@ class spell_rog_preparation : public SpellScriptLoader void Register() { - // add dummy effect spell handler to Preparation OnEffectHitTarget += SpellEffectFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index ff7c83b95a5..0d249953421 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -30,28 +30,69 @@ enum ShamanSpells { - SHAMAN_SPELL_GLYPH_OF_MANA_TIDE = 55441, - SHAMAN_SPELL_MANA_TIDE_TOTEM = 39609, - SHAMAN_SPELL_FIRE_NOVA_R1 = 1535, - SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349, - SHAMAN_SPELL_SATED = 57724, - SHAMAN_SPELL_EXHAUSTION = 57723, + SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC = 52752, + SPELL_SHAMAN_BIND_SIGHT = 6277, + SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT = 52025, + SPELL_SHAMAN_EXHAUSTION = 57723, + SPELL_SHAMAN_FIRE_NOVA_R1 = 1535, + SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1 = 8349, + SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM = 55456, + SPELL_SHAMAN_GLYPH_OF_MANA_TIDE = 55441, + SPELL_SHAMAN_LAVA_FLOWS_R1 = 51480, + SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694, + SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE = 52032, + SPELL_SHAMAN_MANA_TIDE_TOTEM = 39609, + SPELL_SHAMAN_SATED = 57724, + SPELL_SHAMAN_STORM_EARTH_AND_FIRE = 51483, + SPELL_SHAMAN_TOTEM_EARTHBIND_EARTHGRAB = 64695, + SPELL_SHAMAN_TOTEM_EARTHBIND_TOTEM = 6474, + SPELL_SHAMAN_TOTEM_EARTHEN_POWER = 59566, + SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL = 52042 +}; - SHAMAN_SPELL_STORM_EARTH_AND_FIRE = 51483, - EARTHBIND_TOTEM_SPELL_EARTHGRAB = 64695, +enum ShamanSpellIcons +{ + SHAMAN_ICON_ID_RESTORATIVE_TOTEMS = 338, + SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW = 3087 +}; - // For Earthen Power - SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474, - SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566, +// 52759 - Ancestral Awakening (Proc) +class spell_sha_ancestral_awakening_proc : public SpellScriptLoader +{ + public: + spell_sha_ancestral_awakening_proc() : SpellScriptLoader("spell_sha_ancestral_awakening_proc") { } - SHAMAN_BIND_SIGHT = 6277, + class spell_sha_ancestral_awakening_proc_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_ancestral_awakening_proc_SpellScript); - ICON_ID_SHAMAN_LAVA_FLOW = 3087, - SHAMAN_LAVA_FLOWS_R1 = 51480, - SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694, + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + int32 damage = GetEffectValue(); + if (GetHitUnit()) + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC, &damage, NULL, NULL, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sha_ancestral_awakening_proc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_ancestral_awakening_proc_SpellScript(); + } }; -// 51474 - Astral shift +// 51474 - Astral Shift class spell_sha_astral_shift : public SpellScriptLoader { public: @@ -95,115 +136,136 @@ class spell_sha_astral_shift : public SpellScriptLoader } }; -// 1535 Fire Nova -class spell_sha_fire_nova : public SpellScriptLoader +// 2825 - Bloodlust +class spell_sha_bloodlust : public SpellScriptLoader { public: - spell_sha_fire_nova() : SpellScriptLoader("spell_sha_fire_nova") { } + spell_sha_bloodlust() : SpellScriptLoader("spell_sha_bloodlust") { } - class spell_sha_fire_nova_SpellScript : public SpellScript + class spell_sha_bloodlust_SpellScript : public SpellScript { - PrepareSpellScript(spell_sha_fire_nova_SpellScript); + PrepareSpellScript(spell_sha_bloodlust_SpellScript); - bool Validate(SpellInfo const* spellEntry) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_FIRE_NOVA_R1) || sSpellMgr->GetFirstSpellInChain(SHAMAN_SPELL_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) - return false; - - uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); - if (!sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank, true)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_SATED)) return false; return true; } - SpellCastResult CheckFireTotem() + void RemoveInvalidTargets(std::list<WorldObject*>& targets) { - // fire totem - if (!GetCaster()->m_SummonSlot[1]) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_FIRE_TOTEM); - return SPELL_FAILED_CUSTOM_ERROR; - } + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SHAMAN_SATED)); + } - return SPELL_CAST_OK; + void ApplyDebuff() + { + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SPELL_SHAMAN_SATED, true); } - void HandleDummy(SpellEffIndex /*effIndex*/) + void Register() { - if (Unit* caster = GetCaster()) + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); + AfterHit += SpellHitFn(spell_sha_bloodlust_SpellScript::ApplyDebuff); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_bloodlust_SpellScript(); + } +}; + +// -1064 - Chain Heal +class spell_sha_chain_heal : public SpellScriptLoader +{ + public: + spell_sha_chain_heal() : SpellScriptLoader("spell_sha_chain_heal") { } + + class spell_sha_chain_heal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_chain_heal_SpellScript); + + bool Load() + { + firstHeal = true; + riptide = false; + return true; + } + + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (firstHeal) { - uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); - if (uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank)) + // Check if the target has Riptide + if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, GetCaster()->GetGUID())) { - Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]); - if (totem && totem->isTotem()) - caster->CastSpell(totem, spellId, true); + riptide = true; + // Consume it + GetHitUnit()->RemoveAura(aurEff->GetBase()); } + firstHeal = false; } + // Riptide increases the Chain Heal effect by 25% + if (riptide) + SetHitHeal(GetHitHeal() * 1.25f); } void Register() { - OnCheckCast += SpellCheckCastFn(spell_sha_fire_nova_SpellScript::CheckFireTotem); - OnEffectHitTarget += SpellEffectFn(spell_sha_fire_nova_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_sha_chain_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); } + + bool firstHeal; + bool riptide; }; SpellScript* GetSpellScript() const { - return new spell_sha_fire_nova_SpellScript(); + return new spell_sha_chain_heal_SpellScript(); } }; -// 39610 Mana Tide Totem -class spell_sha_mana_tide_totem : public SpellScriptLoader +// 8171 - Cleansing Totem (Pulse) +class spell_sha_cleansing_totem_pulse : public SpellScriptLoader { public: - spell_sha_mana_tide_totem() : SpellScriptLoader("spell_sha_mana_tide_totem") { } + spell_sha_cleansing_totem_pulse() : SpellScriptLoader("spell_sha_cleansing_totem_pulse") { } - class spell_sha_mana_tide_totem_SpellScript : public SpellScript + class spell_sha_cleansing_totem_pulse_SpellScript : public SpellScript { - PrepareSpellScript(spell_sha_mana_tide_totem_SpellScript); + PrepareSpellScript(spell_sha_cleansing_totem_pulse_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE) || !sSpellMgr->GetSpellInfo(SHAMAN_SPELL_MANA_TIDE_TOTEM)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT)) return false; return true; } void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* caster = GetCaster()) - if (Unit* unitTarget = GetHitUnit()) - { - if (unitTarget->getPowerType() == POWER_MANA) - { - int32 effValue = GetEffectValue(); - // Glyph of Mana Tide - if (Unit* owner = caster->GetOwner()) - if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0)) - effValue += dummy->GetAmount(); - // Regenerate 6% of Total Mana Every 3 secs - int32 effBasePoints0 = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue)); - caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); - } - } + int32 bp = 1; + if (GetCaster() && GetHitUnit() && GetOriginalCaster()) + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_sha_mana_tide_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_sha_cleansing_totem_pulse_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_sha_mana_tide_totem_SpellScript(); + return new spell_sha_cleansing_totem_pulse_SpellScript(); } }; -// 6474 - Earthbind Totem - Fix Talent:Earthen Power +// 6474 - Earthbind Totem - Fix Talent: Earthen Power class spell_sha_earthbind_totem : public SpellScriptLoader { public: @@ -213,9 +275,9 @@ class spell_sha_earthbind_totem : public SpellScriptLoader { PrepareAuraScript(spell_sha_earthbind_totem_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM) || !sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHEN_POWER)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_EARTHBIND_TOTEM) || !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_EARTHEN_POWER)) return false; return true; } @@ -227,7 +289,7 @@ class spell_sha_earthbind_totem : public SpellScriptLoader if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) if (roll_chance_i(aur->GetBaseAmount())) - GetTarget()->CastSpell((Unit*)NULL, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true); + GetTarget()->CastSpell((Unit*)NULL, SPELL_SHAMAN_TOTEM_EARTHEN_POWER, true); } void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -238,10 +300,10 @@ class spell_sha_earthbind_totem : public SpellScriptLoader if (!owner) return; // Storm, Earth and Fire - if (AuraEffect* aurEff = owner->GetAuraEffectOfRankedSpell(SHAMAN_SPELL_STORM_EARTH_AND_FIRE, EFFECT_1)) + if (AuraEffect* aurEff = owner->GetAuraEffectOfRankedSpell(SPELL_SHAMAN_STORM_EARTH_AND_FIRE, EFFECT_1)) { if (roll_chance_i(aurEff->GetAmount())) - GetCaster()->CastSpell(GetCaster(), EARTHBIND_TOTEM_SPELL_EARTHGRAB, false); + GetCaster()->CastSpell(GetCaster(), SPELL_SHAMAN_TOTEM_EARTHBIND_EARTHGRAB, false); } } @@ -275,6 +337,7 @@ class EarthenPowerTargetSelector } }; +// 59566 - Earthen Power class spell_sha_earthen_power : public SpellScriptLoader { public: @@ -301,177 +364,112 @@ class spell_sha_earthen_power : public SpellScriptLoader } }; -class spell_sha_bloodlust : public SpellScriptLoader +// -1535 - Fire Nova +class spell_sha_fire_nova : public SpellScriptLoader { public: - spell_sha_bloodlust() : SpellScriptLoader("spell_sha_bloodlust") { } + spell_sha_fire_nova() : SpellScriptLoader("spell_sha_fire_nova") { } - class spell_sha_bloodlust_SpellScript : public SpellScript + class spell_sha_fire_nova_SpellScript : public SpellScript { - PrepareSpellScript(spell_sha_bloodlust_SpellScript); + PrepareSpellScript(spell_sha_fire_nova_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* spellInfo) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_SATED)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_FIRE_NOVA_R1) || sSpellMgr->GetFirstSpellInChain(SPELL_SHAMAN_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id)) return false; - return true; - } - void RemoveInvalidTargets(std::list<WorldObject*>& targets) - { - targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); - } - - void ApplyDebuff() - { - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SHAMAN_SPELL_SATED, true); - } - - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); - AfterHit += SpellHitFn(spell_sha_bloodlust_SpellScript::ApplyDebuff); - } - }; - - SpellScript* GetSpellScript() const - { - return new spell_sha_bloodlust_SpellScript(); - } -}; - -class spell_sha_heroism : public SpellScriptLoader -{ - public: - spell_sha_heroism() : SpellScriptLoader("spell_sha_heroism") { } - - class spell_sha_heroism_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sha_heroism_SpellScript); - - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_EXHAUSTION)) + uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id); + if (!sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1, rank, true)) return false; return true; } - void RemoveInvalidTargets(std::list<WorldObject*>& targets) - { - targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_EXHAUSTION)); - } - - void ApplyDebuff() - { - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SHAMAN_SPELL_EXHAUSTION, true); - } - - void Register() + SpellCastResult CheckFireTotem() { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); - AfterHit += SpellHitFn(spell_sha_heroism_SpellScript::ApplyDebuff); - } - }; - - SpellScript* GetSpellScript() const - { - return new spell_sha_heroism_SpellScript(); - } -}; - -enum AncestralAwakeningProc -{ - SPELL_ANCESTRAL_AWAKENING_PROC = 52752, -}; - -class spell_sha_ancestral_awakening_proc : public SpellScriptLoader -{ - public: - spell_sha_ancestral_awakening_proc() : SpellScriptLoader("spell_sha_ancestral_awakening_proc") { } - - class spell_sha_ancestral_awakening_proc_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sha_ancestral_awakening_proc_SpellScript); + // fire totem + if (!GetCaster()->m_SummonSlot[1]) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_FIRE_TOTEM); + return SPELL_FAILED_CUSTOM_ERROR; + } - bool Validate(SpellInfo const* /*SpellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ANCESTRAL_AWAKENING_PROC)) - return false; - return true; + return SPELL_CAST_OK; } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleDummy(SpellEffIndex /*effIndex*/) { - int32 damage = GetEffectValue(); - if (GetCaster() && GetHitUnit()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_ANCESTRAL_AWAKENING_PROC, &damage, NULL, NULL, true); + if (Unit* caster = GetCaster()) + { + uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + if (uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1, rank)) + { + Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]); + if (totem && totem->isTotem()) + caster->CastSpell(totem, spellId, true); + } + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_sha_ancestral_awakening_proc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_sha_fire_nova_SpellScript::CheckFireTotem); + OnEffectHitTarget += SpellEffectFn(spell_sha_fire_nova_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_sha_ancestral_awakening_proc_SpellScript(); + return new spell_sha_fire_nova_SpellScript(); } }; -enum CleansingTotemPulse -{ - SPELL_CLEANSING_TOTEM_EFFECT = 52025, -}; - -class spell_sha_cleansing_totem_pulse : public SpellScriptLoader +// -8050 - Flame Shock +class spell_sha_flame_shock : public SpellScriptLoader { public: - spell_sha_cleansing_totem_pulse() : SpellScriptLoader("spell_sha_cleansing_totem_pulse") { } + spell_sha_flame_shock() : SpellScriptLoader("spell_sha_flame_shock") { } - class spell_sha_cleansing_totem_pulse_SpellScript : public SpellScript + class spell_sha_flame_shock_AuraScript : public AuraScript { - PrepareSpellScript(spell_sha_cleansing_totem_pulse_SpellScript); + PrepareAuraScript(spell_sha_flame_shock_AuraScript); - bool Validate(SpellInfo const* /*SpellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_CLEANSING_TOTEM_EFFECT)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LAVA_FLOWS_R1)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1)) return false; return true; } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleDispel(DispelInfo* /*dispelInfo*/) { - int32 bp = 1; - if (GetCaster() && GetHitUnit() && GetOriginalCaster()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + if (Unit* caster = GetCaster()) + // Lava Flows + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW, EFFECT_0)) + { + if (sSpellMgr->GetFirstSpellInChain(SPELL_SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId())) + return; + + uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId()); + caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true); + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_sha_cleansing_totem_pulse_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + AfterDispel += AuraDispelFn(spell_sha_flame_shock_AuraScript::HandleDispel); } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_sha_cleansing_totem_pulse_SpellScript(); + return new spell_sha_flame_shock_AuraScript(); } }; -enum HealingStreamTotem -{ - SPELL_GLYPH_OF_HEALING_STREAM_TOTEM = 55456, - ICON_ID_RESTORATIVE_TOTEMS = 338, - SPELL_HEALING_STREAM_TOTEM_HEAL = 52042, -}; - +// 52041, 52046, 52047, 52048, 52049, 52050, 58759, 58760, 58761 - Healing Stream Totem class spell_sha_healing_stream_totem : public SpellScriptLoader { public: @@ -481,14 +479,14 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader { PrepareSpellScript(spell_sha_healing_stream_totem_SpellScript); - bool Validate(SpellInfo const* /*SpellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM) || !sSpellMgr->GetSpellInfo(SPELL_HEALING_STREAM_TOTEM_HEAL)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM) || !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL)) return false; return true; } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); SpellInfo const* triggeringSpell = GetTriggeringSpell(); @@ -501,16 +499,16 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader damage = int32(owner->SpellHealingBonusDone(target, triggeringSpell, damage, HEAL)); // Restorative Totems - if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1)) + if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_RESTORATIVE_TOTEMS, 1)) AddPct(damage, dummy->GetAmount()); // Glyph of Healing Stream Totem - if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) + if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) AddPct(damage, aurEff->GetAmount()); damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL)); } - caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); + caster->CastCustomSpell(target, SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); } } @@ -526,49 +524,50 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader } }; -enum ManaSpringTotem -{ - SPELL_MANA_SPRING_TOTEM_ENERGIZE = 52032, -}; - -class spell_sha_mana_spring_totem : public SpellScriptLoader +// 32182 - Heroism +class spell_sha_heroism : public SpellScriptLoader { public: - spell_sha_mana_spring_totem() : SpellScriptLoader("spell_sha_mana_spring_totem") { } + spell_sha_heroism() : SpellScriptLoader("spell_sha_heroism") { } - class spell_sha_mana_spring_totem_SpellScript : public SpellScript + class spell_sha_heroism_SpellScript : public SpellScript { - PrepareSpellScript(spell_sha_mana_spring_totem_SpellScript); + PrepareSpellScript(spell_sha_heroism_SpellScript); - bool Validate(SpellInfo const* /*SpellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_MANA_SPRING_TOTEM_ENERGIZE)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_EXHAUSTION)) return false; return true; } - void HandleDummy(SpellEffIndex /* effIndex */) + void RemoveInvalidTargets(std::list<WorldObject*>& targets) + { + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SHAMAN_EXHAUSTION)); + } + + void ApplyDebuff() { - int32 damage = GetEffectValue(); if (Unit* target = GetHitUnit()) - if (Unit* caster = GetCaster()) - if (target->getPowerType() == POWER_MANA) - caster->CastCustomSpell(target, SPELL_MANA_SPRING_TOTEM_ENERGIZE, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); + target->CastSpell(target, SPELL_SHAMAN_EXHAUSTION, true); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_sha_mana_spring_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID); + AfterHit += SpellHitFn(spell_sha_heroism_SpellScript::ApplyDebuff); } - }; SpellScript* GetSpellScript() const { - return new spell_sha_mana_spring_totem_SpellScript(); + return new spell_sha_heroism_SpellScript(); } }; +// 60103 - Lava Lash class spell_sha_lava_lash : public SpellScriptLoader { public: @@ -583,7 +582,7 @@ class spell_sha_lava_lash : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleDummy(SpellEffIndex /*effIndex*/) { if (Player* caster = GetCaster()->ToPlayer()) { @@ -612,100 +611,94 @@ class spell_sha_lava_lash : public SpellScriptLoader } }; -// 1064 Chain Heal -class spell_sha_chain_heal : public SpellScriptLoader +// 52031, 52033, 52034, 52035, 52036, 58778, 58779, 58780 - Mana Spring Totem +class spell_sha_mana_spring_totem : public SpellScriptLoader { public: - spell_sha_chain_heal() : SpellScriptLoader("spell_sha_chain_heal") { } + spell_sha_mana_spring_totem() : SpellScriptLoader("spell_sha_mana_spring_totem") { } - class spell_sha_chain_heal_SpellScript : public SpellScript + class spell_sha_mana_spring_totem_SpellScript : public SpellScript { - PrepareSpellScript(spell_sha_chain_heal_SpellScript); + PrepareSpellScript(spell_sha_mana_spring_totem_SpellScript); - bool Load() + bool Validate(SpellInfo const* /*spellInfo*/) { - firstHeal = true; - riptide = false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE)) + return false; return true; } - void HandleHeal(SpellEffIndex /*effIndex*/) + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (firstHeal) - { - // Check if the target has Riptide - if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, GetCaster()->GetGUID())) - { - riptide = true; - // Consume it - GetHitUnit()->RemoveAura(aurEff->GetBase()); - } - firstHeal = false; - } - // Riptide increases the Chain Heal effect by 25% - if (riptide) - SetHitHeal(GetHitHeal() * 1.25f); + int32 damage = GetEffectValue(); + if (Unit* target = GetHitUnit()) + if (Unit* caster = GetCaster()) + if (target->getPowerType() == POWER_MANA) + caster->CastCustomSpell(target, SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_sha_chain_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + OnEffectHitTarget += SpellEffectFn(spell_sha_mana_spring_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - bool firstHeal; - bool riptide; }; SpellScript* GetSpellScript() const { - return new spell_sha_chain_heal_SpellScript(); + return new spell_sha_mana_spring_totem_SpellScript(); } }; -class spell_sha_flame_shock : public SpellScriptLoader +// 39610 - Mana Tide Totem +class spell_sha_mana_tide_totem : public SpellScriptLoader { public: - spell_sha_flame_shock() : SpellScriptLoader("spell_sha_flame_shock") { } + spell_sha_mana_tide_totem() : SpellScriptLoader("spell_sha_mana_tide_totem") { } - class spell_sha_flame_shock_AuraScript : public AuraScript + class spell_sha_mana_tide_totem_SpellScript : public SpellScript { - PrepareAuraScript(spell_sha_flame_shock_AuraScript); + PrepareSpellScript(spell_sha_mana_tide_totem_SpellScript); - bool Validate(SpellInfo const* /*spell*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_R1)) - return false; - if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_TRIGGERED_R1)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_GLYPH_OF_MANA_TIDE) || !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_MANA_TIDE_TOTEM)) return false; return true; } - void HandleDispel(DispelInfo* /*dispelInfo*/) + void HandleDummy(SpellEffIndex /*effIndex*/) { if (Unit* caster = GetCaster()) - // Lava Flows - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, EFFECT_0)) + if (Unit* unitTarget = GetHitUnit()) { - 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); + if (unitTarget->getPowerType() == POWER_MANA) + { + int32 effValue = GetEffectValue(); + // Glyph of Mana Tide + if (Unit* owner = caster->GetOwner()) + if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_MANA_TIDE, 0)) + effValue += dummy->GetAmount(); + // Regenerate 6% of Total Mana Every 3 secs + int32 effBasePoints0 = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue)); + caster->CastCustomSpell(unitTarget, SPELL_SHAMAN_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + } } } void Register() { - AfterDispel += AuraDispelFn(spell_sha_flame_shock_AuraScript::HandleDispel); + OnEffectHitTarget += SpellEffectFn(spell_sha_mana_tide_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_sha_flame_shock_AuraScript(); + return new spell_sha_mana_tide_totem_SpellScript(); } }; +// 6495 - Sentry Totem class spell_sha_sentry_totem : public SpellScriptLoader { public: @@ -717,7 +710,7 @@ class spell_sha_sentry_totem : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_BIND_SIGHT)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_BIND_SIGHT)) return false; return true; } @@ -727,7 +720,7 @@ class spell_sha_sentry_totem : public SpellScriptLoader if (Unit* caster = GetCaster()) if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[4])) if (totem->isTotem()) - caster->CastSpell(totem, SHAMAN_BIND_SIGHT, true); + caster->CastSpell(totem, SPELL_SHAMAN_BIND_SIGHT, true); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -752,19 +745,19 @@ class spell_sha_sentry_totem : public SpellScriptLoader void AddSC_shaman_spell_scripts() { + new spell_sha_ancestral_awakening_proc(); new spell_sha_astral_shift(); - new spell_sha_fire_nova(); - new spell_sha_mana_tide_totem(); - new spell_sha_earthbind_totem(); - new spell_sha_earthen_power(); new spell_sha_bloodlust(); - new spell_sha_heroism(); - new spell_sha_ancestral_awakening_proc(); + new spell_sha_chain_heal(); new spell_sha_cleansing_totem_pulse(); + new spell_sha_earthbind_totem(); + new spell_sha_earthen_power(); + new spell_sha_fire_nova(); + new spell_sha_flame_shock(); new spell_sha_healing_stream_totem(); - new spell_sha_mana_spring_totem(); + new spell_sha_heroism(); new spell_sha_lava_lash(); - new spell_sha_chain_heal(); - new spell_sha_flame_shock(); + new spell_sha_mana_spring_totem(); + new spell_sha_mana_tide_totem(); new spell_sha_sentry_totem(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 2070933173b..89c69733daf 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -28,141 +28,88 @@ enum WarlockSpells { - 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, - WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018, - WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020, - WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388, - WARLOCK_HAUNT = 48181, - WARLOCK_HAUNT_HEAL = 48210, - WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117, - WARLOCK_CURSE_OF_DOOM_EFFECT = 18662, - WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703, - WARLOCK_IMPROVED_HEALTH_FUNNEL_R2 = 18704, - WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1 = 60955, - WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956, + SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT = 18662, + SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018, + SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020, + SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388, + SPELL_WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS = 54435, + SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER = 54443, + SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD = 54508, + SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER = 54509, + SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444, + SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692, + SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693, + SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703, + SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R2 = 18704, + SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1 = 60955, + SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956, + SPELL_WARLOCK_HAUNT = 48181, + SPELL_WARLOCK_HAUNT_HEAL = 48210, + SPELL_WARLOCK_LIFE_TAP_ENERGIZE = 31818, + SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2 = 32553, + SPELL_WARLOCK_SOULSHATTER = 32835, + SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117 }; -class spell_warl_banish : public SpellScriptLoader +enum WarlockSpellIcons { -public: - spell_warl_banish() : SpellScriptLoader("spell_warl_banish") { } - - class spell_warl_banish_SpellScript : public SpellScript - { - PrepareSpellScript(spell_warl_banish_SpellScript); - - bool Load() - { - _removed = false; - return true; - } - - void HandleBanish() - { - if (Unit* target = GetHitUnit()) - { - if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0)) - { - //No need to remove old aura since its removed due to not stack by current Banish aura - PreventHitDefaultEffect(EFFECT_0); - PreventHitDefaultEffect(EFFECT_1); - PreventHitDefaultEffect(EFFECT_2); - _removed = true; - } - } - } - - void RemoveAura() - { - if (_removed) - PreventHitAura(); - } - - void Register() - { - BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish); - AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura); - } - - bool _removed; - }; - - SpellScript* GetSpellScript() const - { - return new spell_warl_banish_SpellScript(); - } + WARLOCK_ICON_ID_IMPROVED_LIFE_TAP = 208, + WARLOCK_ICON_ID_MANA_FEED = 1982 }; -// 47193 Demonic Empowerment -class spell_warl_demonic_empowerment : public SpellScriptLoader +// 710, 18647 - Banish +class spell_warl_banish : public SpellScriptLoader { public: - spell_warl_demonic_empowerment() : SpellScriptLoader("spell_warl_demonic_empowerment") { } + spell_warl_banish() : SpellScriptLoader("spell_warl_banish") { } - class spell_warl_demonic_empowerment_SpellScript : public SpellScript + class spell_warl_banish_SpellScript : public SpellScript { - PrepareSpellScript(spell_warl_demonic_empowerment_SpellScript); + PrepareSpellScript(spell_warl_banish_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Load() { - if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP)) - return false; + _removed = false; return true; } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleBanish() { - if (Creature* targetCreature = GetHitCreature()) + if (Unit* target = GetHitUnit()) { - if (targetCreature->isPet()) + if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0)) { - CreatureTemplate 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: - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER); - int32 hp = int32(targetCreature->CountPctFromMaxHealth(GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0))); - 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; - } + // No need to remove old aura since its removed due to not stack by current Banish aura + PreventHitDefaultEffect(EFFECT_0); + PreventHitDefaultEffect(EFFECT_1); + PreventHitDefaultEffect(EFFECT_2); + _removed = true; } } } + void RemoveAura() + { + if (_removed) + PreventHitAura(); + } + void Register() { - OnEffectHitTarget += SpellEffectFn(spell_warl_demonic_empowerment_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish); + AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura); } + + bool _removed; }; SpellScript* GetSpellScript() const { - return new spell_warl_demonic_empowerment_SpellScript(); + return new spell_warl_banish_SpellScript(); } }; -// 6201 Create Healthstone (and ranks) +// 6201 - Create Healthstone (and ranks) class spell_warl_create_healthstone : public SpellScriptLoader { public: @@ -174,9 +121,9 @@ class spell_warl_create_healthstone : public SpellScriptLoader static uint32 const iTypes[8][3]; - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2)) + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2)) return false; return true; } @@ -204,8 +151,12 @@ class spell_warl_create_healthstone : public SpellScriptLoader { switch (aurEff->GetId()) { - case WARLOCK_IMPROVED_HEALTHSTONE_R1: rank = 1; break; - case WARLOCK_IMPROVED_HEALTHSTONE_R2: rank = 2; break; + case SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1: + rank = 1; + break; + case SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2: + rank = 2; + break; default: sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); break; @@ -241,142 +192,336 @@ uint32 const spell_warl_create_healthstone::spell_warl_create_healthstone_SpellS {36892, 36893, 36894} // Fel Healthstone }; -// 47422 Everlasting Affliction -class spell_warl_everlasting_affliction : public SpellScriptLoader +// -603 - Curse of Doom +class spell_warl_curse_of_doom : public SpellScriptLoader { public: - spell_warl_everlasting_affliction() : SpellScriptLoader("spell_warl_everlasting_affliction") { } + spell_warl_curse_of_doom() : SpellScriptLoader("spell_warl_curse_of_doom") { } - class spell_warl_everlasting_affliction_SpellScript : public SpellScript + class spell_warl_curse_of_doom_AuraScript : public AuraScript { - PrepareSpellScript(spell_warl_everlasting_affliction_SpellScript); + PrepareAuraScript(spell_warl_curse_of_doom_AuraScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + bool Validate(SpellInfo const* /*spell*/) { - 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(); + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT)) + return false; + return true; + } + + bool Load() + { + return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (!GetCaster()) + return; + + AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); + if (removeMode != AURA_REMOVE_BY_DEATH || !IsExpired()) + return; + + if (GetCaster()->ToPlayer()->isHonorOrXPTarget(GetTarget())) + GetCaster()->CastSpell(GetTarget(), SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT, true, NULL, aurEff); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_warl_everlasting_affliction_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + AfterEffectRemove += AuraEffectRemoveFn(spell_warl_curse_of_doom_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_warl_everlasting_affliction_SpellScript(); + return new spell_warl_curse_of_doom_AuraScript(); } }; -// 18541 Ritual of Doom Effect -class spell_warl_ritual_of_doom_effect : public SpellScriptLoader +// 48018 - Demonic Circle Summon +class spell_warl_demonic_circle_summon : public SpellScriptLoader { -public: - spell_warl_ritual_of_doom_effect() : SpellScriptLoader("spell_warl_ritual_of_doom_effect") { } + public: + spell_warl_demonic_circle_summon() : SpellScriptLoader("spell_warl_demonic_circle_summon") { } + + class spell_warl_demonic_circle_summon_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_demonic_circle_summon_AuraScript); + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode) + { + // If effect is removed by expire remove the summoned demonic circle too. + if (!(mode & AURA_EFFECT_HANDLE_REAPPLY)) + GetTarget()->RemoveGameObject(GetId(), true); + + GetTarget()->RemoveAura(SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST); + } + + void HandleDummyTick(AuraEffect const* /*aurEff*/) + { + if (GameObject* circle = GetTarget()->GetGameObject(GetId())) + { + // Here we check if player is in demonic circle teleport range, if so add + // WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT. + // If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST. + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT); + + if (GetTarget()->IsWithinDist(circle, spellInfo->GetMaxRange(true))) + { + if (!GetTarget()->HasAura(SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST)) + GetTarget()->CastSpell(GetTarget(), SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST, true); + } + else + GetTarget()->RemoveAura(SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST); + } + } - class spell_warl_ritual_of_doom_effect_SpellScript : public SpellScript - { - PrepareSpellScript(spell_warl_ritual_of_doom_effect_SpellScript); + void Register() + { + OnEffectRemove += AuraEffectApplyFn(spell_warl_demonic_circle_summon_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_demonic_circle_summon_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - void HandleDummy(SpellEffIndex /*effIndex*/) + AuraScript* GetAuraScript() const { - Unit* caster = GetCaster(); - caster->CastSpell(caster, GetEffectValue(), true); + return new spell_warl_demonic_circle_summon_AuraScript(); } +}; - void Register() +// 48020 - Demonic Circle Teleport +class spell_warl_demonic_circle_teleport : public SpellScriptLoader +{ + public: + spell_warl_demonic_circle_teleport() : SpellScriptLoader("spell_warl_demonic_circle_teleport") { } + + class spell_warl_demonic_circle_teleport_AuraScript : public AuraScript { - OnEffectHit += SpellEffectFn(spell_warl_ritual_of_doom_effect_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + PrepareAuraScript(spell_warl_demonic_circle_teleport_AuraScript); - SpellScript* GetSpellScript() const - { - return new spell_warl_ritual_of_doom_effect_SpellScript(); - } + void HandleTeleport(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* player = GetTarget()->ToPlayer()) + { + if (GameObject* circle = player->GetGameObject(SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON)) + { + player->NearTeleportTo(circle->GetPositionX(), circle->GetPositionY(), circle->GetPositionZ(), circle->GetOrientation()); + player->RemoveMovementImpairingAuras(); + } + } + } + + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_warl_demonic_circle_teleport_AuraScript::HandleTeleport, EFFECT_0, SPELL_AURA_MECHANIC_IMMUNITY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_demonic_circle_teleport_AuraScript(); + } }; -class spell_warl_seed_of_corruption : public SpellScriptLoader +// 47193 - Demonic Empowerment +class spell_warl_demonic_empowerment : public SpellScriptLoader { public: - spell_warl_seed_of_corruption() : SpellScriptLoader("spell_warl_seed_of_corruption") { } + spell_warl_demonic_empowerment() : SpellScriptLoader("spell_warl_demonic_empowerment") { } - class spell_warl_seed_of_corruption_SpellScript : public SpellScript + class spell_warl_demonic_empowerment_SpellScript : public SpellScript { - PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript); + PrepareSpellScript(spell_warl_demonic_empowerment_SpellScript); - void FilterTargets(std::list<WorldObject*>& targets) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (GetExplTargetUnit()) - targets.remove(GetExplTargetUnit()); + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Creature* targetCreature = GetHitCreature()) + { + if (targetCreature->isPet()) + { + CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(targetCreature->GetEntry()); + switch (ci->family) + { + case CREATURE_FAMILY_SUCCUBUS: + targetCreature->CastSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS, true); + break; + case CREATURE_FAMILY_VOIDWALKER: + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER); + int32 hp = int32(targetCreature->CountPctFromMaxHealth(GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0))); + targetCreature->CastCustomSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, NULL, NULL, true); + //unitTarget->CastSpell(unitTarget, 54441, true); + break; + } + case CREATURE_FAMILY_FELGUARD: + targetCreature->CastSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD, true); + break; + case CREATURE_FAMILY_FELHUNTER: + targetCreature->CastSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER, true); + break; + case CREATURE_FAMILY_IMP: + targetCreature->CastSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP, true); + break; + } + } + } } void Register() { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_warl_demonic_empowerment_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const { - return new spell_warl_seed_of_corruption_SpellScript(); + return new spell_warl_demonic_empowerment_SpellScript(); } }; -enum Soulshatter +// 47422 - Everlasting Affliction +class spell_warl_everlasting_affliction : public SpellScriptLoader { - SPELL_SOULSHATTER = 32835, + public: + spell_warl_everlasting_affliction() : SpellScriptLoader("spell_warl_everlasting_affliction") { } + + class spell_warl_everlasting_affliction_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warl_everlasting_affliction_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() + { + OnEffectHitTarget += SpellEffectFn(spell_warl_everlasting_affliction_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_everlasting_affliction_SpellScript(); + } }; -class spell_warl_soulshatter : public SpellScriptLoader +// -48181 - Haunt +class spell_warl_haunt : public SpellScriptLoader { public: - spell_warl_soulshatter() : SpellScriptLoader("spell_warl_soulshatter") { } + spell_warl_haunt() : SpellScriptLoader("spell_warl_haunt") { } - class spell_warl_soulshatter_SpellScript : public SpellScript + class spell_warl_haunt_SpellScript : public SpellScript { - PrepareSpellScript(spell_warl_soulshatter_SpellScript); + PrepareSpellScript(spell_warl_haunt_SpellScript); + + void HandleOnHit() + { + if (Aura* aura = GetHitAura()) + if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) + aurEff->SetAmount(CalculatePct(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(SPELL_SOULSHATTER)) + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_HAUNT_HEAL)) return false; return true; } - void HandleDummy(SpellEffIndex /*effIndex*/) + void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) + if (Unit* caster = GetCaster()) { - if (target->CanHaveThreatList() && target->getThreatManager().getThreat(caster) > 0.0f) - caster->CastSpell(target, SPELL_SOULSHATTER, true); + int32 amount = aurEff->GetAmount(); + GetTarget()->CastCustomSpell(caster, SPELL_WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_warl_soulshatter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + 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_soulshatter_SpellScript(); + return new spell_warl_haunt_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_warl_haunt_AuraScript(); } }; -enum LifeTap +// -755 - Health Funnel +class spell_warl_health_funnel : public SpellScriptLoader { - SPELL_LIFE_TAP_ENERGIZE = 31818, - SPELL_LIFE_TAP_ENERGIZE_2 = 32553, - ICON_ID_IMPROVED_LIFE_TAP = 208, - ICON_ID_MANA_FEED = 1982, + public: + spell_warl_health_funnel() : SpellScriptLoader("spell_warl_health_funnel") { } + + class spell_warl_health_funnel_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_health_funnel_AuraScript); + + void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + Unit* target = GetTarget(); + if (caster->HasAura(SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R2)) + target->CastSpell(target, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2, true); + else if (caster->HasAura(SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1)) + target->CastSpell(target, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1, true); + } + + void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->RemoveAurasDueToSpell(SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1); + target->RemoveAurasDueToSpell(SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2); + } + + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_warl_health_funnel_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_warl_health_funnel_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_health_funnel_AuraScript(); + } }; +// -1454 - Life Tap class spell_warl_life_tap : public SpellScriptLoader { public: @@ -393,7 +538,7 @@ class spell_warl_life_tap : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE_2)) + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_LIFE_TAP_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2)) return false; return true; } @@ -410,20 +555,20 @@ class spell_warl_life_tap : public SpellScriptLoader target->ModifyHealth(-damage); // Improved Life Tap mod - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0)) + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, 0)) AddPct(mana, aurEff->GetAmount()); - caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false); + caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false); // Mana Feed int32 manaFeedVal = 0; - if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, ICON_ID_MANA_FEED, 0)) + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_MANA_FEED, 0)) manaFeedVal = aurEff->GetAmount(); if (manaFeedVal > 0) { ApplyPct(manaFeedVal, mana); - caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL); + caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL); } } } @@ -448,149 +593,102 @@ class spell_warl_life_tap : public SpellScriptLoader } }; -class spell_warl_demonic_circle_summon : public SpellScriptLoader +// 18541 - Ritual of Doom Effect +class spell_warl_ritual_of_doom_effect : public SpellScriptLoader { public: - spell_warl_demonic_circle_summon() : SpellScriptLoader("spell_warl_demonic_circle_summon") { } + spell_warl_ritual_of_doom_effect() : SpellScriptLoader("spell_warl_ritual_of_doom_effect") { } - class spell_warl_demonic_circle_summon_AuraScript : public AuraScript + class spell_warl_ritual_of_doom_effect_SpellScript : public SpellScript { - PrepareAuraScript(spell_warl_demonic_circle_summon_AuraScript); - - void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode) - { - // If effect is removed by expire remove the summoned demonic circle too. - if (!(mode & AURA_EFFECT_HANDLE_REAPPLY)) - GetTarget()->RemoveGameObject(GetId(), true); + PrepareSpellScript(spell_warl_ritual_of_doom_effect_SpellScript); - GetTarget()->RemoveAura(WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST); - } - - void HandleDummyTick(AuraEffect const* /*aurEff*/) + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (GameObject* circle = GetTarget()->GetGameObject(GetId())) - { - // Here we check if player is in demonic circle teleport range, if so add - // WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT. - // If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST. - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_CIRCLE_TELEPORT); - - if (GetTarget()->IsWithinDist(circle, spellInfo->GetMaxRange(true))) - { - if (!GetTarget()->HasAura(WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST)) - GetTarget()->CastSpell(GetTarget(), WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST, true); - } - else - GetTarget()->RemoveAura(WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST); - } + Unit* caster = GetCaster(); + caster->CastSpell(caster, GetEffectValue(), true); } void Register() { - OnEffectRemove += AuraEffectApplyFn(spell_warl_demonic_circle_summon_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_demonic_circle_summon_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectHit += SpellEffectFn(spell_warl_ritual_of_doom_effect_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_warl_demonic_circle_summon_AuraScript(); + return new spell_warl_ritual_of_doom_effect_SpellScript(); } }; -class spell_warl_demonic_circle_teleport : public SpellScriptLoader +// -27285 - Seed of Corruption +class spell_warl_seed_of_corruption : public SpellScriptLoader { public: - spell_warl_demonic_circle_teleport() : SpellScriptLoader("spell_warl_demonic_circle_teleport") { } + spell_warl_seed_of_corruption() : SpellScriptLoader("spell_warl_seed_of_corruption") { } - class spell_warl_demonic_circle_teleport_AuraScript : public AuraScript + class spell_warl_seed_of_corruption_SpellScript : public SpellScript { - PrepareAuraScript(spell_warl_demonic_circle_teleport_AuraScript); + PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript); - void HandleTeleport(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void FilterTargets(std::list<WorldObject*>& targets) { - if (Player* player = GetTarget()->ToPlayer()) - { - if (GameObject* circle = player->GetGameObject(WARLOCK_DEMONIC_CIRCLE_SUMMON)) - { - player->NearTeleportTo(circle->GetPositionX(), circle->GetPositionY(), circle->GetPositionZ(), circle->GetOrientation()); - player->RemoveMovementImpairingAuras(); - } - } + if (GetExplTargetUnit()) + targets.remove(GetExplTargetUnit()); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_warl_demonic_circle_teleport_AuraScript::HandleTeleport, EFFECT_0, SPELL_AURA_MECHANIC_IMMUNITY, AURA_EFFECT_HANDLE_REAL); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_warl_demonic_circle_teleport_AuraScript(); + return new spell_warl_seed_of_corruption_SpellScript(); } }; -class spell_warl_haunt : public SpellScriptLoader +// 29858 - Soulshatter +class spell_warl_soulshatter : 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(CalculatePct(aurEff->GetAmount(), GetHitDamage())); - } - - void Register() - { - OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit); - } - }; + spell_warl_soulshatter() : SpellScriptLoader("spell_warl_soulshatter") { } - class spell_warl_haunt_AuraScript : public AuraScript + class spell_warl_soulshatter_SpellScript : public SpellScript { - PrepareAuraScript(spell_warl_haunt_AuraScript); + PrepareSpellScript(spell_warl_soulshatter_SpellScript); bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(WARLOCK_HAUNT_HEAL)) + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOULSHATTER)) return false; return true; } - void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* caster = GetCaster()) + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) { - int32 amount = aurEff->GetAmount(); - GetTarget()->CastCustomSpell(caster, WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + if (target->CanHaveThreatList() && target->getThreatManager().getThreat(caster) > 0.0f) + caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER, true); } } void Register() { - OnEffectRemove += AuraEffectApplyFn(spell_warl_haunt_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectHitTarget += SpellEffectFn(spell_warl_soulshatter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_warl_haunt_SpellScript(); - } - - AuraScript* GetAuraScript() const - { - return new spell_warl_haunt_AuraScript(); + return new spell_warl_soulshatter_SpellScript(); } }; +// -30108 - Unstable Affliction class spell_warl_unstable_affliction : public SpellScriptLoader { public: @@ -602,7 +700,7 @@ class spell_warl_unstable_affliction : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(WARLOCK_UNSTABLE_AFFLICTION_DISPEL)) + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL)) return false; return true; } @@ -614,7 +712,7 @@ class spell_warl_unstable_affliction : public SpellScriptLoader { int32 damage = aurEff->GetAmount() * 9; // backfire damage and silence - caster->CastCustomSpell(dispelInfo->GetDispeller(), WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + caster->CastCustomSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); } } @@ -630,108 +728,20 @@ class spell_warl_unstable_affliction : public SpellScriptLoader } }; -class spell_warl_curse_of_doom : public SpellScriptLoader -{ - public: - spell_warl_curse_of_doom() : SpellScriptLoader("spell_warl_curse_of_doom") { } - - class spell_warl_curse_of_doom_AuraScript : public AuraScript - { - PrepareAuraScript(spell_warl_curse_of_doom_AuraScript); - - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(WARLOCK_CURSE_OF_DOOM_EFFECT)) - return false; - return true; - } - - bool Load() - { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (!GetCaster()) - return; - - AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); - if (removeMode != AURA_REMOVE_BY_DEATH || !IsExpired()) - return; - - if (GetCaster()->ToPlayer()->isHonorOrXPTarget(GetTarget())) - GetCaster()->CastSpell(GetTarget(), WARLOCK_CURSE_OF_DOOM_EFFECT, true, NULL, aurEff); - } - - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_warl_curse_of_doom_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_warl_curse_of_doom_AuraScript(); - } -}; - -class spell_warl_health_funnel : public SpellScriptLoader -{ -public: - spell_warl_health_funnel() : SpellScriptLoader("spell_warl_health_funnel") { } - - class spell_warl_health_funnel_AuraScript : public AuraScript - { - PrepareAuraScript(spell_warl_health_funnel_AuraScript); - - void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* caster = GetCaster(); - if (!caster) - return; - - Unit* target = GetTarget(); - if (caster->HasAura(WARLOCK_IMPROVED_HEALTH_FUNNEL_R2)) - target->CastSpell(target, WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2, true); - else if (caster->HasAura(WARLOCK_IMPROVED_HEALTH_FUNNEL_R1)) - target->CastSpell(target, WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1, true); - } - - void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - target->RemoveAurasDueToSpell(WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1); - target->RemoveAurasDueToSpell(WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2); - } - - void Register() - { - OnEffectRemove += AuraEffectRemoveFn(spell_warl_health_funnel_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); - OnEffectApply += AuraEffectApplyFn(spell_warl_health_funnel_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_warl_health_funnel_AuraScript(); - } -}; - void AddSC_warlock_spell_scripts() { new spell_warl_banish(); - new spell_warl_demonic_empowerment(); new spell_warl_create_healthstone(); + new spell_warl_curse_of_doom(); + new spell_warl_demonic_circle_summon(); + new spell_warl_demonic_circle_teleport(); + new spell_warl_demonic_empowerment(); new spell_warl_everlasting_affliction(); + new spell_warl_haunt(); + new spell_warl_health_funnel(); + new spell_warl_life_tap(); new spell_warl_ritual_of_doom_effect(); new spell_warl_seed_of_corruption(); new spell_warl_soulshatter(); - 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(); - new spell_warl_curse_of_doom(); - new spell_warl_health_funnel(); } |