TrinityCore
boss_chromaggus.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "blackwing_lair.h"
20#include "InstanceScript.h"
21#include "GameObject.h"
22#include "GameObjectAI.h"
23#include "Map.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26
28{
31};
32
34{
35 // These spells are actually called elemental shield
36 // What they do is decrease all damage by 75% then they increase
37 // One school of damage by 1100%
43 // Other spells
44 SPELL_INCINERATE = 23308, //Incinerate 23308, 23309
45 SPELL_TIMELAPSE = 23310, //Time lapse 23310, 23311(old threat mod that was removed in 2.01)
46 SPELL_CORROSIVEACID = 23313, //Corrosive Acid 23313, 23314
47 SPELL_IGNITEFLESH = 23315, //Ignite Flesh 23315, 23316
48 SPELL_FROSTBURN = 23187, //Frost burn 23187, 23189
49 // Brood Affliction 23173 - Scripted Spell that cycles through all targets within 100 yards and has a chance to cast one of the afflictions on them
50 // Since Scripted spells arn't coded I'll just write a function that does the same thing
51 SPELL_BROODAF_BLUE = 23153, //Blue affliction 23153
52 SPELL_BROODAF_BLACK = 23154, //Black affliction 23154
53 SPELL_BROODAF_RED = 23155, //Red affliction 23155 (23168 on death)
54 SPELL_BROODAF_BRONZE = 23170, //Bronze Affliction 23170
55 SPELL_BROODAF_GREEN = 23169, //Brood Affliction Green 23169
56 SPELL_CHROMATIC_MUT_1 = 23174, //Spell cast on player if they get all 5 debuffs
57 SPELL_FRENZY = 28371, //The frenzy spell may be wrong
58 SPELL_ENRAGE = 28747
59};
60
62{
67 EVENT_FRENZY = 5
68};
69
70struct boss_chromaggus : public BossAI
71{
73 {
74 Initialize();
75
76 Breath1_Spell = 0;
77 Breath2_Spell = 0;
78
79 // Select the 2 breaths that we are going to use until despawned
80 // 5 possiblities for the first breath, 4 for the second, 20 total possiblites
81 // This way we don't end up casting 2 of the same breath
82 // TL TL would be stupid
83 switch (urand(0, 19))
84 {
85 // B1 - Incin
86 case 0:
89 break;
90 case 1:
93 break;
94 case 2:
97 break;
98 case 3:
101 break;
102
103 // B1 - TL
104 case 4:
107 break;
108 case 5:
111 break;
112 case 6:
115 break;
116 case 7:
119 break;
120
121 //B1 - Acid
122 case 8:
125 break;
126 case 9:
129 break;
130 case 10:
133 break;
134 case 11:
137 break;
138
139 //B1 - Ignite
140 case 12:
143 break;
144 case 13:
147 break;
148 case 14:
151 break;
152 case 15:
155 break;
156
157 //B1 - Frost
158 case 16:
161 break;
162 case 17:
165 break;
166 case 18:
169 break;
170 case 19:
173 break;
174 }
175 }
176
178 {
179 CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later
180 Enraged = false;
181 }
182
183 void Reset() override
184 {
185 _Reset();
186
187 Initialize();
188 }
189
190 void JustEngagedWith(Unit* who) override
191 {
193
199 }
200
201 void UpdateAI(uint32 diff) override
202 {
203 if (!UpdateVictim())
204 return;
205
206 events.Update(diff);
207
209 return;
210
211 while (uint32 eventId = events.ExecuteEvent())
212 {
213 switch (eventId)
214 {
215 case EVENT_SHIMMER:
216 {
217 // Remove old vulnerabilty spell
220
221 // Cast new random vulnerabilty on self
223 DoCast(me, spell);
224 CurrentVurln_Spell = spell;
227 break;
228 }
229 case EVENT_BREATH_1:
232 break;
233 case EVENT_BREATH_2:
236 break;
237 case EVENT_AFFLICTION:
238 {
239 Map::PlayerList const& players = me->GetMap()->GetPlayers();
240 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
241 {
242 if (Player* player = itr->GetSource()->ToPlayer())
243 {
245
246 if (player->HasAura(SPELL_BROODAF_BLUE) &&
247 player->HasAura(SPELL_BROODAF_BLACK) &&
248 player->HasAura(SPELL_BROODAF_RED) &&
249 player->HasAura(SPELL_BROODAF_BRONZE) &&
250 player->HasAura(SPELL_BROODAF_GREEN))
251 {
253 }
254
255 }
256 }
257 }
259 break;
260 case EVENT_FRENZY:
263 break;
264 }
265
267 return;
268 }
269
270 // Enrage if not already enraged and below 20%
271 if (!Enraged && HealthBelowPct(20))
272 {
274 Enraged = true;
275 }
276 }
277
278private:
283};
284
286{
287 go_chromaggus_lever(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { }
288
289 bool OnGossipHello(Player* player) override
290 {
292 {
294
296 creature->AI()->JustEngagedWith(player);
297
300 }
301
304
305 return true;
306 }
307
308private:
310};
311
313{
316}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ GO_FLAG_NOT_SELECTABLE
@ GO_FLAG_IN_USE
@ GO_STATE_ACTIVE
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterBlackwingLairCreatureAI(ai_name)
#define RegisterBlackwingLairGameObjectAI(ai_name)
@ DATA_CHROMAGGUS
@ DATA_GO_CHROMAGGUS_DOOR
@ EMOTE_FRENZY
@ EMOTE_SHIMMER
void AddSC_boss_chromaggus()
@ SPELL_IGNITEFLESH
@ SPELL_FROSTBURN
@ SPELL_SHADOW_VULNERABILITY
@ SPELL_ENRAGE
@ SPELL_BROODAF_RED
@ SPELL_FROST_VULNERABILITY
@ SPELL_BROODAF_BLACK
@ SPELL_TIMELAPSE
@ SPELL_CORROSIVEACID
@ SPELL_FIRE_VULNERABILITY
@ SPELL_FRENZY
@ SPELL_BROODAF_GREEN
@ SPELL_NATURE_VULNERABILITY
@ SPELL_ARCANE_VULNERABILITY
@ SPELL_CHROMATIC_MUT_1
@ SPELL_BROODAF_BLUE
@ SPELL_INCINERATE
@ SPELL_BROODAF_BRONZE
@ EVENT_BREATH_1
@ EVENT_BREATH_2
@ EVENT_AFFLICTION
@ EVENT_FRENZY
@ EVENT_SHIMMER
void JustEngagedWith(Unit *who) override
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
GameObject *const me
Definition: GameObjectAI.h:50
void SetGoState(GOState state)
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:274
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
EncounterState GetBossState(uint32 id) const
GameObject * GetGameObject(uint32 type)
iterator end()
Definition: MapRefManager.h:35
iterator begin()
Definition: MapRefManager.h:34
PlayerList const & GetPlayers() const
Definition: Map.h:367
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
static Player * ToPlayer(Object *o)
Definition: Object.h:213
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
Map * GetMap() const
Definition: Object.h:624
bool HealthBelowPct(uint32 pct) const
void Reset() override
boss_chromaggus(Creature *creature)
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
bool OnGossipHello(Player *player) override
InstanceScript * _instance
go_chromaggus_lever(GameObject *go)