TrinityCore
boss_warbringer_omrogg.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/* ScriptData
19SDName: Boss_Warbringer_Omrogg
20SD%Complete: 85
21SDComment: Heroic enabled. Spell timing may need additional tweaks
22SDCategory: Hellfire Citadel, Shattered Halls
23EndScriptData */
24
25/* ContentData
26npc_omrogg_heads
27boss_warbringer_omrogg
28EndContentData */
29
30#include "ScriptMgr.h"
31#include "InstanceScript.h"
32#include "ObjectAccessor.h"
33#include "ScriptedCreature.h"
34#include "shattered_halls.h"
35
37{
41};
42
44{
46 SPELL_FEAR = 30584,
48
51};
52
54{
56 NPC_RIGHT_HEAD = 19524
57};
58
60{
62 SETDATA_YELL = 1
63};
64
66{
67 // Omrogg Heads
69};
70
71struct Yell
72{
75};
76
77static Yell GoCombat[]=
78{
79 {0, NPC_LEFT_HEAD},
80 {1, NPC_LEFT_HEAD},
81 {2, NPC_LEFT_HEAD},
82};
83
85{
86 {0, NPC_RIGHT_HEAD},
87 {1, NPC_RIGHT_HEAD},
88 {2, NPC_RIGHT_HEAD},
89};
90
91static Yell Threat[]=
92{
93 {3, NPC_LEFT_HEAD},
94 {3, NPC_RIGHT_HEAD},
95 {4, NPC_LEFT_HEAD},
96 {5, NPC_LEFT_HEAD},
97};
98
100{
101 {4, NPC_RIGHT_HEAD},
102 {6, NPC_LEFT_HEAD},
103 {5, NPC_RIGHT_HEAD},
104 {6, NPC_RIGHT_HEAD},
105};
106
108{
109 {7, NPC_LEFT_HEAD},
110 {7, NPC_RIGHT_HEAD},
111 {8, NPC_LEFT_HEAD},
112 {9, NPC_LEFT_HEAD},
113};
114
115static Yell Killing[]=
116{
117 {10, NPC_LEFT_HEAD},
118 {8, NPC_RIGHT_HEAD},
119};
120
122{
123 {9, NPC_RIGHT_HEAD},
124 {11, NPC_LEFT_HEAD},
125};
126
127// ########################################################
128// Warbringer_Omrogg
129// ########################################################
130
132{
133 public:
134 boss_warbringer_omrogg() : CreatureScript("boss_warbringer_omrogg") { }
135
137 {
139 {
140 Initialize();
141 iaggro = 0;
142 ithreat = 0;
143 ikilling = 0;
144 }
145
147 {
148 AggroYell = false;
149 ThreatYell = false;
150 ThreatYell2 = false;
151 KillingYell = false;
152
153 Delay_Timer = 4000;
154 BlastWave_Timer = 0;
155 BlastCount = 0;
156 Fear_Timer = 8000;
157 BurningMaul_Timer = 25000;
158 ThunderClap_Timer = 15000;
159 ResetThreat_Timer = 30000;
160 }
161
162 void Reset() override
163 {
164 _Reset();
165 if (Unit* LeftHead = ObjectAccessor::GetUnit(*me, LeftHeadGUID))
166 {
167 LeftHead->setDeathState(JUST_DIED);
169 }
170
171 if (Unit* RightHead = ObjectAccessor::GetUnit(*me, RightHeadGUID))
172 {
173 RightHead->setDeathState(JUST_DIED);
175 }
176
177 Initialize();
178
179 instance->SetData(DATA_OMROGG, NOT_STARTED); //End boss can use this later. O'mrogg must be defeated(DONE) or he will come to aid.
180 }
181
183 {
186
187 if (!LeftHead || !RightHead)
188 return;
189
190 ithreat = rand32() % 4;
191
192 Creature* source = (LeftHead->GetEntry() == Threat[ithreat].creature ? LeftHead : RightHead);
193
194 source->AI()->Talk(Threat[ithreat].id);
195
196 Delay_Timer = 3500;
197 ThreatYell = true;
198 }
199
200 void JustEngagedWith(Unit* /*who*/) override
201 {
202 me->SummonCreature(NPC_LEFT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN);
203 me->SummonCreature(NPC_RIGHT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN);
204
206 {
207 iaggro = rand32() % 3;
208
209 LeftHead->AI()->Talk(GoCombat[iaggro].id);
210
211 Delay_Timer = 3500;
212 AggroYell = true;
213 }
214
216 }
217
218 void JustSummoned(Creature* summoned) override
219 {
220 if (summoned->GetEntry() == NPC_LEFT_HEAD)
221 LeftHeadGUID = summoned->GetGUID();
222
223 if (summoned->GetEntry() == NPC_RIGHT_HEAD)
224 RightHeadGUID = summoned->GetGUID();
225
226 //summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
227 //summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE);
228 summoned->SetVisible(false);
229 }
230
231 void KilledUnit(Unit* /*victim*/) override
232 {
235
236 if (!LeftHead || !RightHead)
237 return;
238
239 ikilling = rand32() % 2;
240
241 Creature* source = (LeftHead->GetEntry() == Killing[ikilling].creature ? LeftHead : RightHead);
242
243 switch (ikilling)
244 {
245 case 0:
246 source->AI()->Talk(Killing[ikilling].id);
247 Delay_Timer = 3500;
248 KillingYell = true;
249 break;
250 case 1:
251 source->AI()->Talk(Killing[ikilling].id);
252 KillingYell = false;
253 break;
254 }
255 }
256
257 void JustDied(Unit* /*killer*/) override
258 {
261
262 _JustDied();
263
264 if (!LeftHead || !RightHead)
265 return;
266
267 LeftHead->AI()->Talk(YELL_DIE_L);
268
269 RightHead->AI()->SetData(SETDATA_DATA, SETDATA_YELL);
270 }
271
272 void UpdateAI(uint32 diff) override
273 {
274 if (Delay_Timer <= diff)
275 {
276 Delay_Timer = 3500;
277
280
281 if (!LeftHead || !RightHead)
282 return;
283
284 if (AggroYell)
285 {
286 RightHead->AI()->Talk(GoCombatDelay[iaggro].id);
287 AggroYell = false;
288 }
289
290 if (ThreatYell2)
291 {
292 Creature* source = (LeftHead->GetEntry() == ThreatDelay2[ithreat].creature ? LeftHead : RightHead);
293
294 source->AI()->Talk(ThreatDelay2[ithreat].id);
295 ThreatYell2 = false;
296 }
297
298 if (ThreatYell)
299 {
300 Creature* source = (LeftHead->GetEntry() == ThreatDelay1[ithreat].creature ? LeftHead : RightHead);
301
302 source->AI()->Talk(ThreatDelay1[ithreat].id);
303 ThreatYell = false;
304 ThreatYell2 = true;
305 }
306
307 if (KillingYell)
308 {
309 Creature* source = (LeftHead->GetEntry() == KillingDelay[ikilling].creature ? LeftHead : RightHead);
310
311 source->AI()->Talk(KillingDelay[ikilling].id);
312 KillingYell = false;
313 }
314 } else Delay_Timer -= diff;
315
316 if (!UpdateVictim())
317 return;
318
319 if (BlastCount && BlastWave_Timer <= diff)
320 {
322 BlastWave_Timer = 5000;
323 ++BlastCount;
324
325 if (BlastCount == 3)
326 BlastCount = 0;
327 }
328 else
329 BlastWave_Timer -= diff;
330
331 if (BurningMaul_Timer <= diff)
332 {
335 BurningMaul_Timer = 40000;
336 BlastWave_Timer = 16000;
337 BlastCount = 1;
338 }
339 else
340 BurningMaul_Timer -= diff;
341
342 if (ResetThreat_Timer <= diff)
343 {
345 {
348 AddThreat(target, 0.0f);
349 }
350 ResetThreat_Timer = 25000 + rand32() % 15000;
351 }
352 else
353 ResetThreat_Timer -= diff;
354
355 if (Fear_Timer <= diff)
356 {
358 Fear_Timer = 15000 + rand32() % 20000;
359 }
360 else
361 Fear_Timer -= diff;
362
363 if (ThunderClap_Timer <= diff)
364 {
366 ThunderClap_Timer = 15000 + rand32() % 15000;
367 }
368 else
369 ThunderClap_Timer -= diff;
370 }
371
372 private:
378
383
391 };
392
393 CreatureAI* GetAI(Creature* creature) const override
394 {
395 return GetShatteredHallsAI<boss_warbringer_omroggAI>(creature);
396 }
397};
398
399// ########################################################
400// Omrogg Heads
401// ########################################################
402
404{
405 public:
406 npc_omrogg_heads() : CreatureScript("npc_omrogg_heads") { }
407
409 {
411 {
412 instance = creature->GetInstanceScript();
413 }
414
415 void Reset() override { }
416
417 void JustEngagedWith(Unit* /*who*/) override { }
418
419 void SetData(uint32 data, uint32 value) override
420 {
421 if (data == SETDATA_DATA && value == SETDATA_YELL)
422 {
424 }
425 }
426
427 void UpdateAI(uint32 diff) override
428 {
429 events.Update(diff);
430
432 {
435 }
436 }
437
438 private:
441 };
442
443 CreatureAI* GetAI(Creature* creature) const override
444 {
445 return GetShatteredHallsAI<npc_omrogg_headsAI>(creature);
446 }
447};
448
450{
452 new npc_omrogg_heads();
453}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ NOT_STARTED
@ TEMPSUMMON_DEAD_DESPAWN
Definition: ObjectDefines.h:69
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
@ JUST_DIED
Definition: Unit.h:247
Yells
@ H_SPELL_BURNING_MAUL
@ SPELL_BLAST_WAVE
@ SPELL_THUNDERCLAP
@ 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[]
@ EVENT_DEATH_YELL
InstanceScript *const instance
void _JustDied()
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
void setDeathState(DeathState s) override
Definition: Creature.cpp:2197
CreatureAI * AI() const
Definition: Creature.h:214
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
virtual bool SetBossState(uint32 id, EncounterState state)
void Clear()
Definition: ObjectGuid.h:286
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
virtual void SetData(uint32, uint32)
Definition: UnitAI.h:74
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetVisible(bool x)
Definition: Unit.cpp:8351
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ DATA_OMROGG
void ResetThreatList(Unit *who=nullptr)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void SetData(uint32 data, uint32 value) override