diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp | 199 |
1 files changed, 101 insertions, 98 deletions
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 1e255c3dcbd..7ecd9c84cbf 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -24,7 +24,6 @@ Script Data End */ // Find sniffed spawn position for chest // Implement a better way to disappear the gameobjects // Implement achievements -// Implement scaling for player's drakes (should be done with aura 66668, it is casted - but it is not working as it should) // Remove hack that re-adds targets to the aggro list after they enter to a vehicle when it works as expected // Improve whatever can be improved :) @@ -221,53 +220,52 @@ public: boss_malygosAI(Creature* creature) : BossAI(creature, DATA_MALYGOS_EVENT) { // If we enter in combat when MovePoint generator is active, it overrwrites our homeposition - homePosition = creature->GetHomePosition(); + _homePosition = creature->GetHomePosition(); } void Reset() { - _Reset(); - bersekerTimer = 0; - currentPos = 0; + _bersekerTimer = 0; + _currentPos = 0; SetPhase(PHASE_ONE, true); - delayedMovementTimer = 8000; - delayedMovement = false; + _delayedMovementTimer = 8000; + _delayedMovement = false; - summonDeaths = 0; + _summonDeaths = 0; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - cannotMove = true; + _cannotMove = true; } uint32 GetData(uint32 data) { if (data == DATA_SUMMON_DEATHS) - return summonDeaths; + return _summonDeaths; else if (data == DATA_PHASE) - return phase; + return _phase; return 0; } void SetData(uint32 data, uint32 value) { - if (data == DATA_SUMMON_DEATHS && phase == PHASE_TWO) + if (data == DATA_SUMMON_DEATHS && _phase == PHASE_TWO) { - summonDeaths = value; + _summonDeaths = value; - if (summonDeaths >= MAX_SUMMONS_PHASE_TWO) + if (_summonDeaths >= MAX_SUMMONS_PHASE_TWO) StartPhaseThree(); } } void EnterEvadeMode() { - me->SetHomePosition(homePosition); + me->SetHomePosition(_homePosition); me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); @@ -277,15 +275,15 @@ public: instance->SetBossState(DATA_MALYGOS_EVENT, FAIL); } - void SetPhase(uint8 _phase, bool setEvents = false) + void SetPhase(uint8 phase, bool setEvents = false) { events.Reset(); - events.SetPhase(_phase); - phase = _phase; + events.SetPhase(phase); + _phase = phase; if (setEvents) - SetPhaseEvents(_phase); + SetPhaseEvents(); } void StartPhaseThree() @@ -320,7 +318,7 @@ public: me->GetMotionMaster()->MovePoint(MOVE_CENTER_PLATFORM, MalygosPositions[0].GetPositionX(), MalygosPositions[0].GetPositionY(), MalygosPositions[0].GetPositionZ()); } - void SetPhaseEvents(uint8 _phase) + void SetPhaseEvents() { switch (_phase) { @@ -365,17 +363,17 @@ public: if (who->GetTypeId() != TYPEID_PLAYER) return; - switch (phase) + switch (_phase) { - case PHASE_ONE: - Talk(SAY_KILLED_PLAYER_P_ONE); - break; - case PHASE_TWO: - Talk(SAY_KILLED_PLAYER_P_TWO); - break; - case PHASE_THREE: - Talk(SAY_KILLED_PLAYER_P_THREE); - break; + case PHASE_ONE: + Talk(SAY_KILLED_PLAYER_P_ONE); + break; + case PHASE_TWO: + Talk(SAY_KILLED_PLAYER_P_TWO); + break; + case PHASE_THREE: + Talk(SAY_KILLED_PLAYER_P_THREE); + break; } } @@ -400,7 +398,6 @@ public: // not sure about the distance | I think it is better check this here than in the UpdateAI function... if (who->GetDistance(me) <= 2.5f) who->CastSpell(me, SPELL_POWER_SPARK_MALYGOS, true); - } } @@ -434,15 +431,15 @@ public: ExecuteVortex(); break; case MOVE_DEEP_BREATH_ROTATION: - currentPos = currentPos == MALYGOS_MAX_WAYPOINTS - 1 ? 0 : currentPos+1; + _currentPos = _currentPos == MALYGOS_MAX_WAYPOINTS - 1 ? 0 : _currentPos+1; me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MovePoint(MOVE_DEEP_BREATH_ROTATION, MalygosPhaseTwoWaypoints[currentPos]); + me->GetMotionMaster()->MovePoint(MOVE_DEEP_BREATH_ROTATION, MalygosPhaseTwoWaypoints[_currentPos]); break; case MOVE_INIT_PHASE_ONE: me->SetInCombatWithZone(); break; case MOVE_CENTER_PLATFORM: - cannotMove = false; + _cannotMove = false; // malygos will move into center of platform and then he does not chase dragons, he just turns to his current target. me->GetMotionMaster()->MoveIdle(); break; @@ -481,9 +478,9 @@ public: events.Update(diff); - if (phase == PHASE_THREE) + if (_phase == PHASE_THREE) { - if (!cannotMove) + if (!_cannotMove) { // it can change if the player falls from the vehicle. if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) @@ -502,18 +499,18 @@ public: } // we need a better way for pathing - if (delayedMovement) + if (_delayedMovement) { - if (delayedMovementTimer <= diff) + if (_delayedMovementTimer <= diff) { - me->GetMotionMaster()->MovePoint(MOVE_DEEP_BREATH_ROTATION, MalygosPhaseTwoWaypoints[currentPos]); - delayedMovementTimer = 8000; - delayedMovement = false; - } delayedMovementTimer -= diff; + me->GetMotionMaster()->MovePoint(MOVE_DEEP_BREATH_ROTATION, MalygosPhaseTwoWaypoints[_currentPos]); + _delayedMovementTimer = 8000; + _delayedMovement = false; + } _delayedMovementTimer -= diff; } // at 50 % health malygos switch to phase 2 - if (me->GetHealthPct() <= 50.0f && phase == PHASE_ONE) + if (me->GetHealthPct() <= 50.0f && _phase == PHASE_ONE) StartPhaseTwo(); // the boss is handling vortex @@ -561,7 +558,7 @@ public: break; case EVENT_SURGE_POWER: me->GetMotionMaster()->MoveIdle(); - delayedMovement = true; + _delayedMovement = true; DoCast(SPELL_SURGE_POWER); events.ScheduleEvent(EVENT_SURGE_POWER, urand(60, 70)*IN_MILLISECONDS, 0, PHASE_TWO); break; @@ -611,17 +608,16 @@ public: } private: - uint8 phase; - uint32 bersekerTimer; - uint8 currentPos; // used for phase 2 rotation... - bool delayedMovement; // used in phase2. - uint32 delayedMovementTimer; // used in phase 2 - uint8 summonDeaths; - Position homePosition; // it can get bugged because core thinks we are pathing - bool mustTalk; - bool cannotMove; + uint8 _phase; + uint32 _bersekerTimer; + uint8 _currentPos; // used for phase 2 rotation... + bool _delayedMovement; // used in phase 2. + uint32 _delayedMovementTimer; // used in phase 2 + uint8 _summonDeaths; + Position _homePosition; // it can get bugged because core thinks we are pathing + bool _mustTalk; + bool _cannotMove; }; - }; class spell_malygos_vortex_dummy : public SpellScriptLoader @@ -733,12 +729,12 @@ public: { npc_portal_eoeAI(Creature* creature) : ScriptedAI(creature) { - instance = creature->GetInstanceScript(); + _instance = creature->GetInstanceScript(); } void Reset() { - summonTimer = urand(5, 7)*IN_MILLISECONDS; + _summonTimer = urand(5, 7)*IN_MILLISECONDS; } void UpdateAI(uint32 const diff) @@ -747,9 +743,9 @@ public: !me->HasAura(SPELL_PORTAL_OPENED)) DoCast(me, SPELL_PORTAL_VISUAL_CLOSED, true); - if (instance) + if (_instance) { - if (Creature* malygos = Unit::GetCreature(*me, instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = Unit::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) { if (malygos->AI()->GetData(DATA_PHASE) != PHASE_ONE) { @@ -762,11 +758,12 @@ public: if (!me->HasAura(SPELL_PORTAL_OPENED)) return; - if (summonTimer <= diff) + if (_summonTimer <= diff) { DoCast(SPELL_SUMMON_POWER_PARK); - summonTimer = urand(5, 7)*IN_MILLISECONDS; - } else summonTimer -= diff; + _summonTimer = urand(5, 7)*IN_MILLISECONDS; + } else + _summonTimer -= diff; } void JustSummoned(Creature* summon) @@ -775,8 +772,8 @@ public: } private: - uint32 summonTimer; - InstanceScript* instance; + uint32 _summonTimer; + InstanceScript* _instance; }; }; @@ -795,7 +792,7 @@ public: { npc_power_sparkAI(Creature* creature) : ScriptedAI(creature) { - instance = creature->GetInstanceScript(); + _instance = creature->GetInstanceScript(); MoveToMalygos(); } @@ -809,19 +806,19 @@ public: { me->GetMotionMaster()->MoveIdle(); - if (instance) + if (_instance) { - if (Creature* malygos = Unit::GetCreature(*me, instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = Unit::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) me->GetMotionMaster()->MoveFollow(malygos, 0.0f, 0.0f); } } void UpdateAI(uint32 const /*diff*/) { - if (!instance) + if (!_instance) return; - if (Creature* malygos = Unit::GetCreature(*me, instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = Unit::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) { if (malygos->AI()->GetData(DATA_PHASE) != PHASE_ONE) { @@ -851,7 +848,7 @@ public: } private: - InstanceScript* instance; + InstanceScript* _instance; }; }; @@ -874,7 +871,7 @@ public: else me->SetInCombatWithZone(); - instance = creature->GetInstanceScript(); + _instance = creature->GetInstanceScript(); } void PassengerBoarded(Unit* unit, int8 /*seat*/, bool apply) @@ -894,9 +891,9 @@ public: if (unit->GetTypeId() == TYPEID_UNIT) { // This will only be called if the passenger dies - if (instance) + if (_instance) { - if (Creature* malygos = Unit::GetCreature(*me, instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = Unit::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) malygos->AI()->SetData(DATA_SUMMON_DEATHS, malygos->AI()->GetData(DATA_SUMMON_DEATHS)+1); } @@ -905,7 +902,7 @@ public: me->GetMotionMaster()->MoveIdle(); - if (me->GetEntry() == NPC_HOVER_DISK_MELEE) + if (me->GetEntry() == NPC_HOVER_DISK_MELEE || me->GetEntry() == NPC_HOVER_DISK_CASTER) { // Hack: Fall ground function can fail (remember the platform is a gameobject), we will teleport the disk to the ground if (me->GetPositionZ() > GROUND_Z) @@ -960,7 +957,7 @@ public: } private: - InstanceScript* instance; + InstanceScript* _instance; }; }; @@ -1013,47 +1010,54 @@ public: { npc_wyrmrest_skytalonAI(Creature* creature) : NullCreatureAI(creature) { - instance = creature->GetInstanceScript(); + _instance = creature->GetInstanceScript(); + + _timer = 1000; + _entered = false; + } - timer = 1000; - entered = false; + void PassengerBoarded(Unit* /*unit*/, int8 /*seat*/, bool apply) + { + if (!apply) + me->DespawnOrUnsummon(); } // we can't call this in reset function, it fails. void MakePlayerEnter() { - if (!instance) + if (!_instance) return; if (Unit* summoner = me->ToTempSummon()->GetSummoner()) { - if (Creature* malygos = Unit::GetCreature(*me, instance->GetData64(DATA_MALYGOS))) + if (Creature* malygos = Unit::GetCreature(*me, _instance->GetData64(DATA_MALYGOS))) { summoner->CastSpell(me, SPELL_RIDE_RED_DRAGON, true); - float victim_threat = malygos->getThreatManager().getThreat(summoner); + float victimThreat = malygos->getThreatManager().getThreat(summoner); malygos->getThreatManager().resetAllAggro(); malygos->AI()->AttackStart(me); - malygos->AddThreat(me, victim_threat); + malygos->AddThreat(me, victimThreat); } } } void UpdateAI(const uint32 diff) { - if (!entered) + if (!_entered) { - if (timer <= diff) + if (_timer <= diff) { MakePlayerEnter(); - entered = true; - } else timer -= diff; + _entered = true; + } else + _timer -= diff; } } private: - InstanceScript* instance; - uint32 timer; - bool entered; + InstanceScript* _instance; + uint32 _timer; + bool _entered; }; }; @@ -1068,7 +1072,7 @@ enum AlexstraszaYells class npc_alexstrasza_eoe : public CreatureScript { public: - npc_alexstrasza_eoe() : CreatureScript("npc_alexstrasza_eoe") { } + npc_alexstrasza_eoe() : CreatureScript("npc_alexstrasza_eoe") {} CreatureAI* GetAI(Creature* creature) const { @@ -1081,28 +1085,27 @@ public: void Reset() { - events.Reset(); - - events.ScheduleEvent(EVENT_YELL_1, 0); + _events.Reset(); + _events.ScheduleEvent(EVENT_YELL_1, 0); } void UpdateAI(uint32 const /*diff*/) { - while (uint32 eventId = events.ExecuteEvent()) + while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_YELL_1: Talk(SAY_ONE); - events.ScheduleEvent(EVENT_YELL_2, 4*IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_YELL_2, 4*IN_MILLISECONDS); break; case EVENT_YELL_2: Talk(SAY_TWO); - events.ScheduleEvent(EVENT_YELL_3, 4*IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_YELL_3, 4*IN_MILLISECONDS); break; case EVENT_YELL_3: Talk(SAY_THREE); - events.ScheduleEvent(EVENT_YELL_4, 7*IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_YELL_4, 7*IN_MILLISECONDS); break; case EVENT_YELL_4: Talk(SAY_FOUR); @@ -1111,14 +1114,14 @@ public: } } private: - EventMap events; + EventMap _events; }; }; class achievement_denyin_the_scion : public AchievementCriteriaScript { public: - achievement_denyin_the_scion() : AchievementCriteriaScript("achievement_denyin_the_scion") { } + achievement_denyin_the_scion() : AchievementCriteriaScript("achievement_denyin_the_scion") {} bool OnCheck(Player* source, Unit* /*target*/) { |