diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/server/game/Scripting/ScriptLoader.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp | 180 |
2 files changed, 164 insertions, 18 deletions
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index e4cb3753563..adbfbe64810 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -398,6 +398,7 @@ void AddSC_instance_nexus(); void AddSC_boss_drakos(); //The Nexus The Oculus void AddSC_boss_urom(); void AddSC_boss_varos(); +void AddSC_boss_eregos(); void AddSC_instance_oculus(); void AddSC_oculus(); void AddSC_boss_sartharion(); //Obsidian Sanctum @@ -1086,6 +1087,7 @@ void AddNorthrendScripts() AddSC_boss_drakos(); //The Nexus The Oculus AddSC_boss_urom(); AddSC_boss_varos(); + AddSC_boss_eregos(); AddSC_instance_oculus(); AddSC_oculus(); AddSC_boss_sartharion(); //Obsidian Sanctum diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index ff5264d68c2..73c933301f7 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -21,16 +21,50 @@ //Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer) //Two Repeating phases +enum Events +{ + EVENT_ARCANE_BARRAGE = 1, + EVENT_ARCANE_VOLLEY, + EVENT_ENRAGED_ASSAULT, + EVENT_SUMMON_LEY_WHELP +}; + +enum Says +{ + SAY_AGGRO = 0, + SAY_ENRAGE = 1, + SAY_DEATH = 2 +}; + enum Spells { SPELL_ARCANE_BARRAGE = 50804, - H_SPELL_ARCANE_BARRAGE = 59381, SPELL_ARCANE_VOLLEY = 51153, - H_SPELL_ARCANE_VOLLEY = 59382, SPELL_ENRAGED_ASSAULT = 51170, SPELL_PLANAR_ANOMALIES = 57959, SPELL_PLANAR_SHIFT = 51162, + SPELL_SUMMON_LEY_WHELP = 51175, + SPELL_SUMMON_PLANAR_ANOMALIES = 57963, + SPELL_PLANAR_BLAST = 57976 +}; + +enum Npcs +{ + NPC_PLANAR_ANOMALY = 30879 +}; + +enum Phases +{ + PHASE_NORMAL = 1, + PHASE_FIRST_PLANAR = 2, + PHASE_SECOND_PLANAR = 3 +}; + +enum Actions +{ + ACTION_SET_NORMAL_EVENTS = 1 }; + /*Ruby Drake , (npc 27756) (item 37860) (summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756) @@ -60,6 +94,7 @@ enum AmberDrake //you do not have access to until you kill the Mage-Lord Urom. SPELL_AMBER_TEMPORAL_RIFT = 49592 //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15,000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. }; + /*Emerald Drake, (npc 27692) (item 37815), (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692) @@ -85,49 +120,158 @@ public: return new boss_eregosAI (pCreature); } - struct boss_eregosAI : public ScriptedAI + struct boss_eregosAI : public BossAI { - boss_eregosAI(Creature *c) : ScriptedAI(c) + boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS_EVENT) { } + + void Reset() { - pInstance = c->GetInstanceScript(); + _Reset(); + + phase = PHASE_NORMAL; + + DoAction(ACTION_SET_NORMAL_EVENTS); } - InstanceScript* pInstance; + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); - void Reset() + Talk(SAY_AGGRO); + } + + void DoAction(const int32 action) { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, NOT_STARTED); + if (action != ACTION_SET_NORMAL_EVENTS) + return; + + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3,10) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10,25) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35,50) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15,30) * IN_MILLISECONDS, 0, PHASE_NORMAL); } - void EnterCombat(Unit* /*who*/) + void JustSummoned(Creature* summon) + { + BossAI::JustSummoned(summon); + + if (summon->GetEntry() != NPC_PLANAR_ANOMALY) + return; + + summon->CombatStop(true); + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MoveRandom(100.0f); + } + + void SummonedCreatureDespawn(Creature* summon) { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, IN_PROGRESS); + if (summon->GetEntry() != NPC_PLANAR_ANOMALY) + return; + + // TO-DO: See why the spell is not casted + summon->CastSpell(summon,SPELL_PLANAR_BLAST,true); } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) + { + if (!me->GetMap()->IsHeroic()) + return; + + if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && phase < PHASE_FIRST_PLANAR) + || (me->GetHealthPct() < 20.0f && phase < PHASE_SECOND_PLANAR) ) + { + events.Reset(); + phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR; + + DoCast(SPELL_PLANAR_SHIFT); + + // not sure about the amount, and if we should despawn previous spawns (dragon trashs) + summons.DespawnAll(); + for (uint8 i = 0; i < 6; i++) + DoCast(SPELL_PLANAR_ANOMALIES); + } + } + + void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_ARCANE_BARRAGE: + DoCast(me->getVictim(),SPELL_ARCANE_BARRAGE); + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3,10) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_ARCANE_VOLLEY: + DoCastAOE(SPELL_ARCANE_VOLLEY); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10,25) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_ENRAGED_ASSAULT: + Talk(SAY_ENRAGE); + DoCast(SPELL_ENRAGED_ASSAULT); + events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35,50) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_SUMMON_LEY_WHELP: + for (uint8 i = 0; i < 3; i++) + DoCast(SPELL_SUMMON_LEY_WHELP); + events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15,30) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + } + } + DoMeleeAttackIfReady(); } void JustDied(Unit* /*killer*/) { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, DONE); + Talk(SAY_DEATH); + + _JustDied(); } - }; + private: + uint8 phase; + }; }; +class spell_eregos_planar_shift : public SpellScriptLoader +{ + public: + spell_eregos_planar_shift() : SpellScriptLoader("spell_eregos_planar_shift") { } + + class spell_eregos_planar_shift_AuraScript : public AuraScript + { + PrepareAuraScript(spell_eregos_planar_shift_AuraScript); + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Creature* caster = GetCaster()->ToCreature()) + caster->AI()->DoAction(ACTION_SET_NORMAL_EVENTS); + } + + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_eregos_planar_shift_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_SCHOOL_IMMUNITY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_eregos_planar_shift_AuraScript(); + } +}; void AddSC_boss_eregos() { new boss_eregos(); + new spell_eregos_planar_shift(); } |
