diff options
3 files changed, 343 insertions, 384 deletions
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h index e371f3c7af0..41d48e4d7d2 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h @@ -95,4 +95,7 @@ inline AI* GetBlackwingLairAI(T* obj) return GetInstanceAI<AI>(obj, BWLScriptName); } +#define RegisterBlackwingLairCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetBlackwingLairAI) +#define RegisterBlackwingLairGameObjectAI(ai_name) RegisterGameObjectAIWithFactory(ai_name, GetBlackwingLairAI) + #endif diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp index 33f0cb798d3..76c021e3b91 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -54,190 +54,168 @@ enum Actions ACTION_DEACTIVATE = 0 }; -class boss_broodlord : public CreatureScript +struct boss_broodlord : public BossAI { -public: - boss_broodlord() : CreatureScript("boss_broodlord") { } + boss_broodlord(Creature* creature) : BossAI(creature, DATA_BROODLORD_LASHLAYER) { } - struct boss_broodlordAI : public BossAI + void JustEngagedWith(Unit* who) override { - boss_broodlordAI(Creature* creature) : BossAI(creature, DATA_BROODLORD_LASHLAYER) { } - - void JustEngagedWith(Unit* who) override - { - BossAI::JustEngagedWith(who); - Talk(SAY_AGGRO); - - events.ScheduleEvent(EVENT_CLEAVE, 8s); - events.ScheduleEvent(EVENT_BLASTWAVE, 12s); - events.ScheduleEvent(EVENT_MORTALSTRIKE, 20s); - events.ScheduleEvent(EVENT_KNOCKBACK, 30s); - events.ScheduleEvent(EVENT_CHECK, 1s); - } + BossAI::JustEngagedWith(who); + Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_CLEAVE, 8s); + events.ScheduleEvent(EVENT_BLASTWAVE, 12s); + events.ScheduleEvent(EVENT_MORTALSTRIKE, 20s); + events.ScheduleEvent(EVENT_KNOCKBACK, 30s); + events.ScheduleEvent(EVENT_CHECK, 1s); + } - void JustDied(Unit* /*killer*/) override - { - _JustDied(); + void JustDied(Unit* /*killer*/) override + { + _JustDied(); - std::list<GameObject*> _goList; - GetGameObjectListWithEntryInGrid(_goList, me, GO_SUPPRESSION_DEVICE, 200.0f); - for (std::list<GameObject*>::const_iterator itr = _goList.begin(); itr != _goList.end(); itr++) - ((*itr)->AI()->DoAction(ACTION_DEACTIVATE)); - } + std::list<GameObject*> _goList; + GetGameObjectListWithEntryInGrid(_goList, me, GO_SUPPRESSION_DEVICE, 200.0f); + for (std::list<GameObject*>::const_iterator itr = _goList.begin(); itr != _goList.end(); itr++) + ((*itr)->AI()->DoAction(ACTION_DEACTIVATE)); + } - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) { - switch (eventId) - { - case EVENT_CLEAVE: - DoCastVictim(SPELL_CLEAVE); - events.ScheduleEvent(EVENT_CLEAVE, 7s); - break; - case EVENT_BLASTWAVE: - DoCastVictim(SPELL_BLASTWAVE); - events.ScheduleEvent(EVENT_BLASTWAVE, 8s, 16s); - break; - case EVENT_MORTALSTRIKE: - DoCastVictim(SPELL_MORTALSTRIKE); - events.ScheduleEvent(EVENT_MORTALSTRIKE, 25s, 35s); - break; - case EVENT_KNOCKBACK: - DoCastVictim(SPELL_KNOCKBACK); - if (GetThreat(me->GetVictim())) - ModifyThreatByPercent(me->GetVictim(), -50); - events.ScheduleEvent(EVENT_KNOCKBACK, 15s, 30s); - break; - case EVENT_CHECK: - if (me->GetDistance(me->GetHomePosition()) > 150.0f) - { - Talk(SAY_LEASH); - EnterEvadeMode(EVADE_REASON_BOUNDARY); - } - events.ScheduleEvent(EVENT_CHECK, 1s); - break; - } + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE, 7s); + break; + case EVENT_BLASTWAVE: + DoCastVictim(SPELL_BLASTWAVE); + events.ScheduleEvent(EVENT_BLASTWAVE, 8s, 16s); + break; + case EVENT_MORTALSTRIKE: + DoCastVictim(SPELL_MORTALSTRIKE); + events.ScheduleEvent(EVENT_MORTALSTRIKE, 25s, 35s); + break; + case EVENT_KNOCKBACK: + DoCastVictim(SPELL_KNOCKBACK); + if (GetThreat(me->GetVictim())) + ModifyThreatByPercent(me->GetVictim(), -50); + events.ScheduleEvent(EVENT_KNOCKBACK, 15s, 30s); + break; + case EVENT_CHECK: + if (me->GetDistance(me->GetHomePosition()) > 150.0f) + { + Talk(SAY_LEASH); + EnterEvadeMode(EVADE_REASON_BOUNDARY); + } + events.ScheduleEvent(EVENT_CHECK, 1s); + break; } - - DoMeleeAttackIfReady(); } - }; - CreatureAI* GetAI(Creature* creature) const override - { - return GetBlackwingLairAI<boss_broodlordAI>(creature); + DoMeleeAttackIfReady(); } }; -class go_suppression_device : public GameObjectScript +struct go_suppression_device : public GameObjectAI { - public: - go_suppression_device() : GameObjectScript("go_suppression_device") { } + go_suppression_device(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()), _active(true) { } - struct go_suppression_deviceAI : public GameObjectAI + void InitializeAI() override + { + if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE) { - go_suppression_deviceAI(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()), _active(true) { } + Deactivate(); + return; + } - void InitializeAI() override - { - if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE) - { - Deactivate(); - return; - } + _events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s, 5s); + } - _events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s, 5s); - } + void UpdateAI(uint32 diff) override + { + _events.Update(diff); - void UpdateAI(uint32 diff) override + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) { - _events.Update(diff); - - while (uint32 eventId = _events.ExecuteEvent()) - { - switch (eventId) + case EVENT_SUPPRESSION_CAST: + if (me->GetGoState() == GO_STATE_READY) { - case EVENT_SUPPRESSION_CAST: - if (me->GetGoState() == GO_STATE_READY) - { - me->CastSpell(nullptr, SPELL_SUPPRESSION_AURA, true); - me->SendCustomAnim(0); - } - _events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 5s); - break; - case EVENT_SUPPRESSION_RESET: - Activate(); - break; + me->CastSpell(nullptr, SPELL_SUPPRESSION_AURA, true); + me->SendCustomAnim(0); } - } - } - - void OnLootStateChanged(uint32 state, Unit* /*unit*/) override - { - switch (state) - { - case GO_ACTIVATED: - Deactivate(); - _events.CancelEvent(EVENT_SUPPRESSION_CAST); - _events.ScheduleEvent(EVENT_SUPPRESSION_RESET, 30s, 120s); - break; - case GO_JUST_DEACTIVATED: // This case prevents the Gameobject despawn by Disarm Trap - me->SetLootState(GO_READY); - break; - } - } - - void DoAction(int32 action) override - { - if (action == ACTION_DEACTIVATE) - { - Deactivate(); - _events.CancelEvent(EVENT_SUPPRESSION_RESET); - } - } - - void Activate() - { - if (_active) - return; - _active = true; - if (me->GetGoState() == GO_STATE_ACTIVE) - me->SetGoState(GO_STATE_READY); - me->SetLootState(GO_READY); - me->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - _events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s); + _events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 5s); + break; + case EVENT_SUPPRESSION_RESET: + Activate(); + break; } + } + } - void Deactivate() - { - if (!_active) - return; - _active = false; - me->SetGoState(GO_STATE_ACTIVE); - me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + void OnLootStateChanged(uint32 state, Unit* /*unit*/) override + { + switch (state) + { + case GO_ACTIVATED: + Deactivate(); _events.CancelEvent(EVENT_SUPPRESSION_CAST); - } - - private: - InstanceScript* _instance; - EventMap _events; - bool _active; - }; + _events.ScheduleEvent(EVENT_SUPPRESSION_RESET, 30s, 120s); + break; + case GO_JUST_DEACTIVATED: // This case prevents the Gameobject despawn by Disarm Trap + me->SetLootState(GO_READY); + break; + } + } - GameObjectAI* GetAI(GameObject* go) const override + void DoAction(int32 action) override + { + if (action == ACTION_DEACTIVATE) { - return GetBlackwingLairAI<go_suppression_deviceAI>(go); + Deactivate(); + _events.CancelEvent(EVENT_SUPPRESSION_RESET); } + } + + void Activate() + { + if (_active) + return; + _active = true; + if (me->GetGoState() == GO_STATE_ACTIVE) + me->SetGoState(GO_STATE_READY); + me->SetLootState(GO_READY); + me->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + _events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 0s); + } + + void Deactivate() + { + if (!_active) + return; + _active = false; + me->SetGoState(GO_STATE_ACTIVE); + me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + _events.CancelEvent(EVENT_SUPPRESSION_CAST); + } + +private: + InstanceScript* _instance; + EventMap _events; + bool _active; }; void AddSC_boss_broodlord() { - new boss_broodlord(); - new go_suppression_device(); + RegisterBlackwingLairCreatureAI(boss_broodlord); + RegisterBlackwingLairGameObjectAI(go_suppression_device); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp index 91c0acc0e07..808b14e45f1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp @@ -67,276 +67,254 @@ enum Events EVENT_FRENZY = 5 }; -class boss_chromaggus : public CreatureScript +struct boss_chromaggus : public BossAI { -public: - boss_chromaggus() : CreatureScript("boss_chromaggus") { } - - struct boss_chromaggusAI : public BossAI + boss_chromaggus(Creature* creature) : BossAI(creature, DATA_CHROMAGGUS) { - boss_chromaggusAI(Creature* creature) : BossAI(creature, DATA_CHROMAGGUS) - { - Initialize(); - - Breath1_Spell = 0; - Breath2_Spell = 0; + Initialize(); - // Select the 2 breaths that we are going to use until despawned - // 5 possiblities for the first breath, 4 for the second, 20 total possiblites - // This way we don't end up casting 2 of the same breath - // TL TL would be stupid - switch (urand(0, 19)) - { - // B1 - Incin - case 0: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 1: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 2: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 3: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_FROSTBURN; - break; + Breath1_Spell = 0; + Breath2_Spell = 0; - // B1 - TL - case 4: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_INCINERATE; - break; - case 5: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 6: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 7: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_FROSTBURN; - break; + // Select the 2 breaths that we are going to use until despawned + // 5 possiblities for the first breath, 4 for the second, 20 total possiblites + // This way we don't end up casting 2 of the same breath + // TL TL would be stupid + switch (urand(0, 19)) + { + // B1 - Incin + case 0: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 1: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 2: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 3: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_FROSTBURN; + break; + + // B1 - TL + case 4: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_INCINERATE; + break; + case 5: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 6: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 7: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Acid + case 8: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_INCINERATE; + break; + case 9: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 10: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 11: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Ignite + case 12: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_INCINERATE; + break; + case 13: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 14: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 15: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Frost + case 16: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_INCINERATE; + break; + case 17: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 18: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 19: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + }; - //B1 - Acid - case 8: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_INCINERATE; - break; - case 9: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 10: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 11: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_FROSTBURN; - break; + EnterEvadeMode(); + } - //B1 - Ignite - case 12: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_INCINERATE; - break; - case 13: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 14: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 15: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_FROSTBURN; - break; + void Initialize() + { + CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later + Enraged = false; + } - //B1 - Frost - case 16: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_INCINERATE; - break; - case 17: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 18: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 19: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - }; + void Reset() override + { + _Reset(); - EnterEvadeMode(); - } + Initialize(); + } - void Initialize() - { - CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later - Enraged = false; - } + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); - void Reset() override - { - _Reset(); + events.ScheduleEvent(EVENT_SHIMMER, 0s); + events.ScheduleEvent(EVENT_BREATH_1, 30s); + events.ScheduleEvent(EVENT_BREATH_2, 60s); + events.ScheduleEvent(EVENT_AFFLICTION, 10s); + events.ScheduleEvent(EVENT_FRENZY, 15s); + } - Initialize(); - } + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - void JustEngagedWith(Unit* who) override - { - BossAI::JustEngagedWith(who); + events.Update(diff); - events.ScheduleEvent(EVENT_SHIMMER, 0s); - events.ScheduleEvent(EVENT_BREATH_1, 30s); - events.ScheduleEvent(EVENT_BREATH_2, 60s); - events.ScheduleEvent(EVENT_AFFLICTION, 10s); - events.ScheduleEvent(EVENT_FRENZY, 15s); - } + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - void UpdateAI(uint32 diff) override + while (uint32 eventId = events.ExecuteEvent()) { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + switch (eventId) { - switch (eventId) - { - case EVENT_SHIMMER: - { - // Remove old vulnerabilty spell - if (CurrentVurln_Spell) - me->RemoveAurasDueToSpell(CurrentVurln_Spell); - - // Cast new random vulnerabilty on self - uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY); - DoCast(me, spell); - CurrentVurln_Spell = spell; - Talk(EMOTE_SHIMMER); - events.ScheduleEvent(EVENT_SHIMMER, 45s); - break; - } - case EVENT_BREATH_1: - DoCastVictim(Breath1_Spell); - events.ScheduleEvent(EVENT_BREATH_1, 60s); - break; - case EVENT_BREATH_2: - DoCastVictim(Breath2_Spell); - events.ScheduleEvent(EVENT_BREATH_2, 60s); - break; - case EVENT_AFFLICTION: - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* player = itr->GetSource()->ToPlayer()) - { - DoCast(player, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); - - if (player->HasAura(SPELL_BROODAF_BLUE) && - player->HasAura(SPELL_BROODAF_BLACK) && - player->HasAura(SPELL_BROODAF_RED) && - player->HasAura(SPELL_BROODAF_BRONZE) && - player->HasAura(SPELL_BROODAF_GREEN)) - { - DoCast(player, SPELL_CHROMATIC_MUT_1); - } - - } - } - } - events.ScheduleEvent(EVENT_AFFLICTION, 10s); + case EVENT_SHIMMER: + { + // Remove old vulnerabilty spell + if (CurrentVurln_Spell) + me->RemoveAurasDueToSpell(CurrentVurln_Spell); + + // Cast new random vulnerabilty on self + uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY); + DoCast(me, spell); + CurrentVurln_Spell = spell; + Talk(EMOTE_SHIMMER); + events.ScheduleEvent(EVENT_SHIMMER, 45s); + break; + } + case EVENT_BREATH_1: + DoCastVictim(Breath1_Spell); + events.ScheduleEvent(EVENT_BREATH_1, 60s); break; - case EVENT_FRENZY: - DoCast(me, SPELL_FRENZY); - events.ScheduleEvent(EVENT_FRENZY, 10s, 15s); + case EVENT_BREATH_2: + DoCastVictim(Breath2_Spell); + events.ScheduleEvent(EVENT_BREATH_2, 60s); break; - } + case EVENT_AFFLICTION: + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->GetSource()->ToPlayer()) + { + DoCast(player, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - } + if (player->HasAura(SPELL_BROODAF_BLUE) && + player->HasAura(SPELL_BROODAF_BLACK) && + player->HasAura(SPELL_BROODAF_RED) && + player->HasAura(SPELL_BROODAF_BRONZE) && + player->HasAura(SPELL_BROODAF_GREEN)) + { + DoCast(player, SPELL_CHROMATIC_MUT_1); + } - // Enrage if not already enraged and below 20% - if (!Enraged && HealthBelowPct(20)) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; + } + } + } + events.ScheduleEvent(EVENT_AFFLICTION, 10s); + break; + case EVENT_FRENZY: + DoCast(me, SPELL_FRENZY); + events.ScheduleEvent(EVENT_FRENZY, 10s, 15s); + break; } - DoMeleeAttackIfReady(); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; } - private: - uint32 Breath1_Spell; - uint32 Breath2_Spell; - uint32 CurrentVurln_Spell; - bool Enraged; - }; + // Enrage if not already enraged and below 20% + if (!Enraged && HealthBelowPct(20)) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } - CreatureAI* GetAI(Creature* creature) const override - { - return GetBlackwingLairAI<boss_chromaggusAI>(creature); + DoMeleeAttackIfReady(); } + +private: + uint32 Breath1_Spell; + uint32 Breath2_Spell; + uint32 CurrentVurln_Spell; + bool Enraged; }; -class go_chromaggus_lever : public GameObjectScript +struct go_chromaggus_lever : public GameObjectAI { - public: - go_chromaggus_lever() : GameObjectScript("go_chromaggus_lever") { } + go_chromaggus_lever(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { } - struct go_chromaggus_leverAI : public GameObjectAI + bool OnGossipHello(Player* player) override + { + if (_instance->GetBossState(DATA_CHROMAGGUS) != DONE && _instance->GetBossState(DATA_CHROMAGGUS) != IN_PROGRESS) { - go_chromaggus_leverAI(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { } + _instance->SetBossState(DATA_CHROMAGGUS, IN_PROGRESS); - bool OnGossipHello(Player* player) override - { - if (_instance->GetBossState(DATA_CHROMAGGUS) != DONE && _instance->GetBossState(DATA_CHROMAGGUS) != IN_PROGRESS) - { - _instance->SetBossState(DATA_CHROMAGGUS, IN_PROGRESS); - - if (Creature* creature = _instance->GetCreature(DATA_CHROMAGGUS)) - creature->AI()->JustEngagedWith(player); - - if (GameObject* go = _instance->GetGameObject(DATA_GO_CHROMAGGUS_DOOR)) - _instance->HandleGameObject(ObjectGuid::Empty, true, go); - } + if (Creature* creature = _instance->GetCreature(DATA_CHROMAGGUS)) + creature->AI()->JustEngagedWith(player); - me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE); - me->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = _instance->GetGameObject(DATA_GO_CHROMAGGUS_DOOR)) + _instance->HandleGameObject(ObjectGuid::Empty, true, go); + } - return true; - } + me->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE); + me->SetGoState(GO_STATE_ACTIVE); - private: - InstanceScript* _instance; - }; + return true; + } - GameObjectAI* GetAI(GameObject* go) const override - { - return GetBlackwingLairAI<go_chromaggus_leverAI>(go); - } +private: + InstanceScript* _instance; }; void AddSC_boss_chromaggus() { - new boss_chromaggus(); - new go_chromaggus_lever(); + RegisterBlackwingLairCreatureAI(boss_chromaggus); + RegisterBlackwingLairGameObjectAI(go_chromaggus_lever); } |