Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2017 InevitableGaming
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include "ScriptPCH.h"
- #include "zone_azshara_crater.h"
- enum Texts
- {
- SAY_AGGRO = 0,
- SAY_KILL_TARGET = 1,
- SAY_DEATH = 2
- };
- enum Spells
- {
- SPELL_WRATH = 67953,
- SPELL_MOONFIRE = 67946,
- SPELL_STARFIRE = 67949,
- SPELL_INSECT_SWARM = 67943,
- SPELL_TYPHOON = 61384,
- SPELL_THORNS = 34663,
- SPELL_INNERVATE = 29166
- };
- enum Events
- {
- EVENT_WRATH = 1,
- EVENT_MOONFIRE = 2,
- EVENT_STARFIRE = 3,
- EVENT_INSECT_SWARM = 4,
- EVENT_TYPHOON = 5,
- EVENT_THORNS = 6,
- EVENT_MANA_CHECK = 7,
- EVENT_INNERVATE = 8
- };
- enum Phases
- {
- PHASE_ONE = 1,
- PHASE_TWO = 2,
- PHASE_THREE = 3
- };
- class boss_amlolas : public CreatureScript
- {
- public:
- boss_amlolas() : CreatureScript("boss_amlolas") { }
- struct boss_amlolasAI : public BossAI
- {
- boss_amlolasAI(Creature* creature) : BossAI(creature, DATA_AMLOLAS)
- {
- Initialize();
- }
- void Initialize()
- {
- }
- void EnterCombat(Unit* /*who*/) override
- {
- if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_AMLOLAS)))
- gate->SetGoState(GO_STATE_READY);
- events.SetPhase(PHASE_ONE);
- Talk(SAY_AGGRO);
- events.ScheduleEvent(EVENT_THORNS, 2000, 0, PHASE_ONE);
- events.ScheduleEvent(EVENT_WRATH, 8000, 0, PHASE_ONE);
- events.ScheduleEvent(EVENT_MOONFIRE, 11000, 0, PHASE_ONE);
- events.ScheduleEvent(EVENT_MANA_CHECK, 1000);
- DoZoneInCombat();
- _EnterCombat();
- }
- void KilledUnit(Unit* /*killer*/) override
- {
- Talk(SAY_KILL_TARGET);
- }
- void Reset() override
- {
- _Reset();
- if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_AMLOLAS)))
- {
- gate->ResetDoorOrButton();
- gate->SetGoState(GO_STATE_ACTIVE);
- }
- }
- void JustDied(Unit* /*killer*/) override
- {
- if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_AMLOLAS)))
- {
- gate->ResetDoorOrButton();
- gate->SetGoState(GO_STATE_ACTIVE);
- Talk(SAY_DEATH);
- }
- _JustDied();
- }
- bool ManaBelowPct(int32 pct) const
- {
- return (me->GetPower(POWER_MANA) < CountPctFromMaxMana(pct));
- }
- uint32 CountPctFromMaxMana(int32 pct) const
- {
- return CalculatePct(me->GetMaxPower(POWER_MANA), pct);
- }
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
- events.Update(diff);
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
- if (events.IsInPhase(PHASE_ONE) && HealthBelowPct(50))
- {
- events.SetPhase(PHASE_TWO);
- events.ScheduleEvent(EVENT_STARFIRE, 1000, 0, PHASE_TWO);
- events.ScheduleEvent(EVENT_TYPHOON, 5000, 0, PHASE_TWO);
- events.ScheduleEvent(EVENT_WRATH, 7000, 0, PHASE_TWO);
- events.ScheduleEvent(EVENT_INSECT_SWARM, 3500, 0, PHASE_TWO);
- events.ScheduleEvent(EVENT_MOONFIRE, 500, 0, PHASE_TWO);
- }
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_WRATH:
- DoCastVictim(SPELL_WRATH);
- events.ScheduleEvent(EVENT_WRATH, 11000, 0, PHASE_ONE);
- break;
- case EVENT_MOONFIRE:
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_MOONFIRE);
- events.ScheduleEvent(EVENT_MOONFIRE, 9000, 0, PHASE_ONE);
- break;
- }
- case EVENT_INSECT_SWARM:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_INSECT_SWARM);
- events.ScheduleEvent(EVENT_INSECT_SWARM, 7500, 0, PHASE_ONE);
- break;
- case EVENT_STARFIRE:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_STARFIRE);
- events.ScheduleEvent(EVENT_STARFIRE, 10000, 0, PHASE_TWO);
- break;
- case EVENT_THORNS:
- DoCast(me, SPELL_THORNS, true);
- events.ScheduleEvent(EVENT_THORNS, 15000, PHASE_ONE);
- break;
- case EVENT_TYPHOON:
- DoCast(me, SPELL_TYPHOON);
- events.ScheduleEvent(EVENT_TYPHOON, 13000, 0, PHASE_TWO);
- break;
- case EVENT_MANA_CHECK:
- if (ManaBelowPct(30))
- events.ScheduleEvent(EVENT_INNERVATE, 1000);
- else
- events.ScheduleEvent(EVENT_MANA_CHECK, 1000);
- break;
- case EVENT_INNERVATE:
- DoCast(me, SPELL_INNERVATE);
- break;
- default:
- break;
- }
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
- }
- DoMeleeAttackIfReady();
- }
- };
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetAzsharaCraterAI<boss_amlolasAI>(creature);
- }
- };
- void AddSC_boss_amlolas()
- {
- new boss_amlolas();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement