diff options
| author | Shauren <shauren.trinity@gmail.com> | 2012-07-05 14:16:44 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2012-07-05 14:16:44 +0200 |
| commit | 32ba32c4ebe56ba931c8638460c24cd57ae29a75 (patch) | |
| tree | 2f757648b85ec8989a7dfc573b954b9b4d718650 /src/server/scripts/Outland | |
| parent | c95905ddbb22e2b5b5362b790aa851ef10d4e27e (diff) | |
| parent | ed6f3e2deff55f913f9646db5f540b7704088478 (diff) | |
Merge branch '4.x' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src/server/scripts/Outland')
6 files changed, 144 insertions, 19 deletions
diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 0e654ade995..3443103fa70 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -19,11 +19,13 @@ /* ScriptData SDName: Boss_Gruul SD%Complete: 60 -SDComment: Ground Slam need further development (knock back effect and shatter effect must be added to the core) +SDComment: Ground Slam need further development (knock back effect must be added to the core) SDCategory: Gruul's Lair EndScriptData */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "gruuls_lair.h" enum eEnums @@ -144,12 +146,7 @@ public: //this part should be in the core if (pSpell->Id == SPELL_SHATTER) { - //this spell must have custom handling in the core, dealing damage based on distance - target->CastSpell(target, SPELL_SHATTER_EFFECT, true); - - if (target->HasAura(SPELL_STONED)) - target->RemoveAurasDueToSpell(SPELL_STONED); - + // todo: use eventmap to kill this stuff //clear this, if we are still performing if (m_bPerformingGroundSlam) { @@ -258,7 +255,83 @@ public: }; +class spell_gruul_shatter : public SpellScriptLoader +{ + public: + spell_gruul_shatter() : SpellScriptLoader("spell_gruul_shatter") { } + + class spell_gruul_shatter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gruul_shatter_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_STONED)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHATTER_EFFECT)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->RemoveAurasDueToSpell(SPELL_STONED); + target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gruul_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gruul_shatter_SpellScript(); + } +}; + +class spell_gruul_shatter_effect : public SpellScriptLoader +{ + public: + spell_gruul_shatter_effect() : SpellScriptLoader("spell_gruul_shatter_effect") { } + + class spell_gruul_shatter_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gruul_shatter_effect_SpellScript); + + void CalculateDamage() + { + if (!GetHitUnit()) + return; + + float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + if (!radius) + return; + + float distance = GetCaster()->GetDistance2d(GetHitUnit()); + if (distance > 1.0f) + SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius))); + } + + void Register() + { + OnHit += SpellHitFn(spell_gruul_shatter_effect_SpellScript::CalculateDamage); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gruul_shatter_effect_SpellScript(); + } +}; + void AddSC_boss_gruul() { new boss_gruul(); + new spell_gruul_shatter(); + new spell_gruul_shatter_effect(); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index d202fdd2f44..0454274401c 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -518,7 +518,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader return true; } - void CountTargets(std::list<Unit*>& targetList) + void CountTargets(std::list<WorldObject*>& targetList) { _targetCount = targetList.size(); } @@ -549,7 +549,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 3579a7d697b..1cd67065af1 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -52,10 +52,10 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader return true; } - void HandleTargets(std::list<Unit*>& targetList) + void HandleTargets(std::list<WorldObject*>& targetList) { uint8 count = 0; - for (std::list<Unit*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit) + for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit) if ((*ihit)->GetGUID() != GetCaster()->GetGUID()) if (Player* target = (*ihit)->ToPlayer()) if (target->HasAura(GetTriggeringSpell()->Id)) @@ -88,7 +88,7 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader void Register() { OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 4ec1d04b6ad..c46757a3956 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -651,7 +651,7 @@ class npc_simon_bunny : public CreatureScript { _events.Update(diff); - switch(_events.ExecuteEvent()) + switch (_events.ExecuteEvent()) { case EVENT_SIMON_PERIODIC_PLAYER_CHECK: if (!CheckPlayer()) diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index a213713ae1a..96897ae3033 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -16,7 +16,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" enum Texts { @@ -36,6 +39,7 @@ enum Spells SPELL_THUNDERCLAP = 36706, SPELL_VOID_BOLT = 39329, SPELL_MARK_OF_KAZZAK = 32960, + SPELL_MARK_OF_KAZZAK_DAMAGE = 32961, SPELL_ENRAGE = 32964, SPELL_CAPTURE_SOUL = 32966, SPELL_TWISTED_REFLECTION = 21063, @@ -171,7 +175,55 @@ class boss_doomlord_kazzak : public CreatureScript } }; +class spell_mark_of_kazzak : public SpellScriptLoader +{ + public: + spell_mark_of_kazzak() : SpellScriptLoader("spell_mark_of_kazzak") { } + + class spell_mark_of_kazzak_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mark_of_kazzak_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_KAZZAK_DAMAGE)) + return false; + return true; + } + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* owner = GetUnitOwner()) + amount = CalculatePctU(owner->GetPower(POWER_MANA), 5); + } + + void OnPeriodic(AuraEffect const* aurEff) + { + Unit* target = GetTarget(); + + if (target->GetPower(POWER_MANA) == 0) + { + target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, NULL, aurEff); + // Remove aura + SetDuration(0); + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_mark_of_kazzak_AuraScript(); + } +}; + void AddSC_boss_doomlordkazzak() { new boss_doomlord_kazzak(); + new spell_mark_of_kazzak(); } diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index afc18c71b92..16dac13d1a9 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -777,10 +777,10 @@ public: PlayerGUID = who->GetGUID(); } - void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/) - { - DoCast(me, SPELL_DE_MATERIALIZE); - } + //void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/) + //{ + // DoCast(me, SPELL_DE_MATERIALIZE); + //} void UpdateAI(const uint32 diff) { |
