Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_chromaggus.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "Player.h"
9#include "blackwing_lair.h"
10
12{
15};
16
18{
19 // These spells are actually called elemental shield
20 // What they do is decrease all damage by 75% then they increase
21 // One school of damage by 1100%
27 // Other spells
28 SPELL_INCINERATE = 23308, //Incinerate 23308, 23309
29 SPELL_TIMELAPSE = 23310, //Time lapse 23310, 23311(old threat mod that was removed in 2.01)
30 SPELL_CORROSIVEACID = 23313, //Corrosive Acid 23313, 23314
31 SPELL_IGNITEFLESH = 23315, //Ignite Flesh 23315, 23316
32 SPELL_FROSTBURN = 23187, //Frost burn 23187, 23189
33 // 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
34 // Since Scripted spells arn't coded I'll just write a function that does the same thing
35 SPELL_BROODAF_BLUE = 23153, //Blue affliction 23153
36 SPELL_BROODAF_BLACK = 23154, //Black affliction 23154
37 SPELL_BROODAF_RED = 23155, //Red affliction 23155 (23168 on death)
38 SPELL_BROODAF_BRONZE = 23170, //Bronze Affliction 23170
39 SPELL_BROODAF_GREEN = 23169, //Brood Affliction Green 23169
40 SPELL_CHROMATIC_MUT_1 = 23174, //Spell cast on player if they get all 5 debuffs
41 SPELL_FRENZY = 28371, //The frenzy spell may be wrong
43};
44
53
55{
56public:
57 boss_chromaggus() : CreatureScript("boss_chromaggus") { }
58
59 struct boss_chromaggusAI : public BossAI
60 {
62 {
63 Breath1_Spell = 0;
64 Breath2_Spell = 0;
66 Enraged = false;
67
68 // Select the 2 breaths that we are going to use until despawned
69 // 5 possiblities for the first breath, 4 for the second, 20 total possiblites
70 // This way we don't end up casting 2 of the same breath
71 // TL TL would be stupid
72 switch (std::rand() % 19)
73 {
74 // B1 - Incin
75 case 0:
78 break;
79 case 1:
82 break;
83 case 2:
86 break;
87 case 3:
90 break;
91
92 // B1 - TL
93 case 4:
96 break;
97 case 5:
100 break;
101 case 6:
104 break;
105 case 7:
108 break;
109
110 //B1 - Acid
111 case 8:
114 break;
115 case 9:
118 break;
119 case 10:
122 break;
123 case 11:
126 break;
127
128 //B1 - Ignite
129 case 12:
132 break;
133 case 13:
136 break;
137 case 14:
140 break;
141 case 15:
144 break;
145
146 //B1 - Frost
147 case 16:
150 break;
151 case 17:
154 break;
155 case 18:
158 break;
159 case 19:
162 break;
163 };
164
166 }
167
169 {
170 _Reset();
171
172 CurrentVurln_Spell = 0; // We use this to store our last vulnerabilty spell so we can remove it later
173 Enraged = false;
174 }
175
176 void EnterCombat(Unit* /*who*/) OVERRIDE
177 {
178 if (instance && instance->GetBossState(BOSS_FLAMEGOR) != DONE)
179 {
181 return;
182 }
183 _EnterCombat();
184
185 events.ScheduleEvent(EVENT_SHIMMER, 0);
186 events.ScheduleEvent(EVENT_BREATH_1, 30000);
187 events.ScheduleEvent(EVENT_BREATH_2, 60000);
188 events.ScheduleEvent(EVENT_AFFLICTION, 10000);
189 events.ScheduleEvent(EVENT_FRENZY, 15000);
190 }
191
193 {
194 if (!UpdateVictim())
195 return;
196
197 events.Update(diff);
198
199 if (me->HasUnitState(UNIT_STATE_CASTING))
200 return;
201
202 while (uint32 eventId = events.ExecuteEvent())
203 {
204 switch (eventId)
205 {
206 case EVENT_SHIMMER:
207 {
208 // Remove old vulnerabilty spell
210 me->RemoveAurasDueToSpell(CurrentVurln_Spell);
211
212 // Cast new random vulnerabilty on self
214 DoCast(me, spell);
215 CurrentVurln_Spell = spell;
217 events.ScheduleEvent(EVENT_SHIMMER, 45000);
218 break;
219 }
220 case EVENT_BREATH_1:
222 events.ScheduleEvent(EVENT_BREATH_1, 60000);
223 break;
224 case EVENT_BREATH_2:
226 events.ScheduleEvent(EVENT_BREATH_2, 60000);
227 break;
228 case EVENT_AFFLICTION:
229 {
230 Map::PlayerList const &players = me->GetMap()->GetPlayers();
231 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
232 {
233 if (Player* player = itr->GetSource()->ToPlayer())
234 {
236
237 if (player->HasAura(SPELL_BROODAF_BLUE) &&
238 player->HasAura(SPELL_BROODAF_BLACK) &&
239 player->HasAura(SPELL_BROODAF_RED) &&
240 player->HasAura(SPELL_BROODAF_BRONZE) &&
241 player->HasAura(SPELL_BROODAF_GREEN))
242 {
244 }
245 }
246 }
247 }
248 events.ScheduleEvent(EVENT_AFFLICTION, 10000);
249 break;
250 case EVENT_FRENZY:
252 events.ScheduleEvent(EVENT_FRENZY, std::rand() % 15000 + 10000);
253 break;
254 }
255 }
256
257 // Enrage if not already enraged and below 20%
258 if (!Enraged && HealthBelowPct(20))
259 {
261 Enraged = true;
262 }
263
265 }
266
267 private:
272 };
273
275 {
276 return new boss_chromaggusAI(creature);
277 }
278};
279
281{
282 new boss_chromaggus();
283}
const T & RAND(const T &v1, const T &v2)
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ DONE
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SPELL_ENRAGE
@ BOSS_FLAMEGOR
@ BOSS_CHROMAGGUS
@ 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
@ SPELL_FRENZY
InstanceScript *const instance
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
MapRefManager PlayerList
Definition Map.h:406
iterator end()
iterator begin()
LinkedListHead::Iterator< MapReference const > const_iterator
Player * ToPlayer()
Definition Object.h:204
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthBelowPct(uint32 pct) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================