Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_warbringer_omrogg.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/* ScriptData
7SDName: Boss_Warbringer_Omrogg
8SD%Complete: 85
9SDComment: Heroic enabled. Spell timing may need additional tweaks
10SDCategory: Hellfire Citadel, Shattered Halls
11EndScriptData */
12
13/* ContentData
14npc_omrogg_heads
15boss_warbringer_omrogg
16EndContentData */
17
18#include "ScriptMgr.h"
19#include "ScriptedCreature.h"
20#include "shattered_halls.h"
21
23{
27};
28
38
40{
43};
44
50
52{
53 // Omrogg Heads
55};
56
57struct Yell
58{
61};
62
63static Yell GoCombat[]=
64{
65 {0, NPC_LEFT_HEAD},
66 {1, NPC_LEFT_HEAD},
67 {2, NPC_LEFT_HEAD},
68};
69
71{
72 {0, NPC_RIGHT_HEAD},
73 {1, NPC_RIGHT_HEAD},
74 {2, NPC_RIGHT_HEAD},
75};
76
77static Yell Threat[]=
78{
79 {3, NPC_LEFT_HEAD},
80 {3, NPC_RIGHT_HEAD},
81 {4, NPC_LEFT_HEAD},
82 {5, NPC_LEFT_HEAD},
83};
84
86{
87 {4, NPC_RIGHT_HEAD},
88 {6, NPC_LEFT_HEAD},
89 {5, NPC_RIGHT_HEAD},
90 {6, NPC_RIGHT_HEAD},
91};
92
94{
95 {7, NPC_LEFT_HEAD},
96 {7, NPC_RIGHT_HEAD},
97 {8, NPC_LEFT_HEAD},
98 {9, NPC_LEFT_HEAD},
99};
100
101static Yell Killing[]=
102{
103 {10, NPC_LEFT_HEAD},
104 {8, NPC_RIGHT_HEAD},
105};
106
108{
109 {9, NPC_RIGHT_HEAD},
110 {11, NPC_LEFT_HEAD},
111};
112
113// ########################################################
114// Warbringer_Omrogg
115// ########################################################
116
118{
119 public:
120 boss_warbringer_omrogg() : CreatureScript("boss_warbringer_omrogg") { }
121
123 {
125 {
126 LeftHeadGUID = 0;
127 RightHeadGUID = 0;
128 }
129
131 {
132 if (Unit* LeftHead = Unit::GetUnit(*me, LeftHeadGUID))
133 {
134 LeftHead->setDeathState(DeathState::JUST_DIED);
135 LeftHeadGUID = 0;
136 }
137
138 if (Unit* RightHead = Unit::GetUnit(*me, RightHeadGUID))
139 {
140 RightHead->setDeathState(DeathState::JUST_DIED);
141 RightHeadGUID = 0;
142 }
143
144 AggroYell = false;
145 ThreatYell = false;
146 ThreatYell2 = false;
147 KillingYell = false;
148
149 Delay_Timer = 4000;
150 BlastWave_Timer = 0;
151 BlastCount = 0;
152 Fear_Timer = 8000;
153 BurningMaul_Timer = 25000;
154 ThunderClap_Timer = 15000;
155 ResetThreat_Timer = 30000;
156
157 if (instance)
158 instance->SetData(DATA_OMROGG, NOT_STARTED); //End boss can use this later. O'mrogg must be defeated(DONE) or he will come to aid.
159 }
160
162 {
165
166 if (!LeftHead || !RightHead)
167 return;
168
169 ithreat = rand()%4;
170
171 Creature* source = (LeftHead->GetEntry() == Threat[ithreat].creature ? LeftHead : RightHead);
172
173 source->AI()->Talk(Threat[ithreat].id);
174
175 Delay_Timer = 3500;
176 ThreatYell = true;
177 }
178
179 void EnterCombat(Unit* /*who*/) OVERRIDE
180 {
181 me->SummonCreature(NPC_LEFT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType::TEMPSUMMON_DEAD_DESPAWN, 0);
182 me->SummonCreature(NPC_RIGHT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType::TEMPSUMMON_DEAD_DESPAWN, 0);
183
185 {
186 iaggro = rand()%3;
187
188 LeftHead->AI()->Talk(GoCombat[iaggro].id);
189
190 Delay_Timer = 3500;
191 AggroYell = true;
192 }
193
194 if (instance)
195 instance->SetBossState(DATA_OMROGG, IN_PROGRESS);
196 }
197
199 {
200 if (summoned->GetEntry() == NPC_LEFT_HEAD)
201 LeftHeadGUID = summoned->GetGUID();
202
203 if (summoned->GetEntry() == NPC_RIGHT_HEAD)
204 RightHeadGUID = summoned->GetGUID();
205
206 //summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
207 //summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
208 summoned->SetVisible(false);
209 }
210
211 void KilledUnit(Unit* /*victim*/) OVERRIDE
212 {
215
216 if (!LeftHead || !RightHead)
217 return;
218
219 ikilling = rand()%2;
220
221 Creature* source = (LeftHead->GetEntry() == Killing[ikilling].creature ? LeftHead : RightHead);
222
223 switch (ikilling)
224 {
225 case 0:
226 source->AI()->Talk(Killing[ikilling].id);
227 Delay_Timer = 3500;
228 KillingYell = true;
229 break;
230 case 1:
231 source->AI()->Talk(Killing[ikilling].id);
232 KillingYell = false;
233 break;
234 }
235 }
236
237 void JustDied(Unit* /*killer*/) OVERRIDE
238 {
241
242 if (!LeftHead || !RightHead)
243 return;
244
245 LeftHead->AI()->Talk(YELL_DIE_L);
246
247 RightHead->AI()->SetData(SETDATA_DATA, SETDATA_YELL);
248
249 if (instance)
250 instance->SetBossState(DATA_OMROGG, DONE);
251 }
252
254 {
255 if (Delay_Timer <= diff)
256 {
257 Delay_Timer = 3500;
258
261
262 if (!LeftHead || !RightHead)
263 return;
264
265 if (AggroYell)
266 {
267 RightHead->AI()->Talk(GoCombatDelay[iaggro].id);
268 AggroYell = false;
269 }
270
271 if (ThreatYell2)
272 {
273 Creature* source = (LeftHead->GetEntry() == ThreatDelay2[ithreat].creature ? LeftHead : RightHead);
274
275 source->AI()->Talk(ThreatDelay2[ithreat].id);
276 ThreatYell2 = false;
277 }
278
279 if (ThreatYell)
280 {
281 Creature* source = (LeftHead->GetEntry() == ThreatDelay1[ithreat].creature ? LeftHead : RightHead);
282
283 source->AI()->Talk(ThreatDelay1[ithreat].id);
284 ThreatYell = false;
285 ThreatYell2 = true;
286 }
287
288 if (KillingYell)
289 {
290 Creature* source = (LeftHead->GetEntry() == KillingDelay[ikilling].creature ? LeftHead : RightHead);
291
292 source->AI()->Talk(KillingDelay[ikilling].id);
293 KillingYell = false;
294 }
295 } else Delay_Timer -= diff;
296
297 if (!UpdateVictim())
298 return;
299
300 if (BlastCount && BlastWave_Timer <= diff)
301 {
303 BlastWave_Timer = 5000;
304 ++BlastCount;
305
306 if (BlastCount == 3)
307 BlastCount = 0;
308 }
309 else
310 BlastWave_Timer -= diff;
311
312 if (BurningMaul_Timer <= diff)
313 {
316 BurningMaul_Timer = 40000;
317 BlastWave_Timer = 16000;
318 BlastCount = 1;
319 }
320 else
321 BurningMaul_Timer -= diff;
322
323 if (ResetThreat_Timer <= diff)
324 {
325 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
326 {
329 me->AddThreat(target, 0.0f);
330 }
331 ResetThreat_Timer = 25000+rand()%15000;
332 }
333 else
334 ResetThreat_Timer -= diff;
335
336 if (Fear_Timer <= diff)
337 {
339 Fear_Timer = 15000+rand()%20000;
340 }
341 else
342 Fear_Timer -= diff;
343
344 if (ThunderClap_Timer <= diff)
345 {
347 ThunderClap_Timer = 15000+rand()%15000;
348 }
349 else
350 ThunderClap_Timer -= diff;
351
353 }
354
355 private:
361
366
374 };
375
377 {
378 return new boss_warbringer_omroggAI(creature);
379 }
380};
381
382// ########################################################
383// Omrogg Heads
384// ########################################################
385
387{
388 public:
389 npc_omrogg_heads() : CreatureScript("npc_omrogg_heads") { }
390
392 {
394 {
395 instance = creature->GetInstanceScript();
396 }
397
398 void Reset() OVERRIDE { }
399
400 void EnterCombat(Unit* /*who*/) OVERRIDE { }
401
402 void SetData(uint32 data, uint32 value) OVERRIDE
403 {
404 if (data == SETDATA_DATA && value == SETDATA_YELL)
405 {
406 events.ScheduleEvent(EVENT_DEATH_YELL, 4000);
407 }
408 }
409
411 {
412 events.Update(diff);
413
414 if (events.ExecuteEvent() == EVENT_DEATH_YELL)
415 {
417 me->setDeathState(DeathState::JUST_DIED);
418 }
419 }
420
421 private:
424 };
425
427 {
428 return new npc_omrogg_headsAI(creature);
429 }
430};
431
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_DEAD_DESPAWN
Definition Object.h:74
@ JUST_DIED
Definition Unit.h:504
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
Creatures
@ EMOTE_ENRAGE
@ SPELL_FEAR
@ SPELL_THUNDERCLAP
@ H_SPELL_BURNING_MAUL
static Yell GoCombatDelay[]
void AddSC_boss_warbringer_omrogg()
static Yell ThreatDelay2[]
static Yell KillingDelay[]
static Yell ThreatDelay1[]
static Yell Killing[]
static Yell Threat[]
static Yell GoCombat[]
InstanceScript *const instance
BossAI(Creature *creature, uint32 bossId)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureAI * AI() const
Definition Creature.h:483
CreatureScript(const char *name)
uint32 GetEntry() const
Definition Object.h:125
virtual void SetData(uint32, uint32)
Definition UnitAI.h:128
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
Definition Unit.h:1367
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_OMROGG
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SetData(uint32 data, uint32 value) OVERRIDE