Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_high_king_maulgar.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_High_King_Maulgar
8SD%Complete: 90
9SDComment: Correct timers, after whirlwind melee attack bug, prayer of healing
10SDCategory: Gruul's Lair
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "gruuls_lair.h"
16
18{
24
25 // High King Maulgar
30 SPELL_ROAR = 16508,
31 SPELL_FLURRY = 33232,
33
34 // Olm the Summoner
38
39 // Kiggler the Craed
44
45 // Blindeye the Seer
47 SPELL_HEAL = 33144,
49
50 // Krosh Firehand
54
56};
57
59{
60public:
61 boss_high_king_maulgar() : CreatureScript("boss_high_king_maulgar") { }
62
64 {
66 {
67 instance = creature->GetInstanceScript();
72 Roar_Timer = 0;
73 Phase2 = false;
74 }
75
77 {
78 ArcingSmash_Timer = 10000;
79 MightyBlow_Timer = 40000;
80 Whirlwind_Timer = 30000;
82 Roar_Timer = 0;
83
84 DoCast(me, SPELL_DUAL_WIELD, false);
85
86 Phase2 = false;
87
88 instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
89 }
90
91 void KilledUnit(Unit* /*victim*/) OVERRIDE
92 {
94 }
95
96 void JustDied(Unit* /*killer*/) OVERRIDE
97 {
99
100 instance->SetBossState(DATA_MAULGAR, DONE);
101 }
102
103 void DoAction(int32 actionId) OVERRIDE
104 {
105 if (actionId == ACTION_ADD_DEATH)
107 }
108
109 void EnterCombat(Unit* /*who*/) OVERRIDE
110 {
112 instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
114 }
115
117 {
118 if (!UpdateVictim())
119 return;
120
121 //ArcingSmash_Timer
122 if (ArcingSmash_Timer <= diff)
123 {
125 ArcingSmash_Timer = 10000;
126 } else ArcingSmash_Timer -= diff;
127
128 //Whirlwind_Timer
129 if (Whirlwind_Timer <= diff)
130 {
132 Whirlwind_Timer = 55000;
133 } else Whirlwind_Timer -= diff;
134
135 //MightyBlow_Timer
136 if (MightyBlow_Timer <= diff)
137 {
139 MightyBlow_Timer = 30000+rand()%10000;
140 } else MightyBlow_Timer -= diff;
141
142 //Entering Phase 2
143 if (!Phase2 && HealthBelowPct(50))
144 {
145 Phase2 = true;
147
148 DoCast(me, SPELL_DUAL_WIELD, true);
149 me->SetUInt32Value(UNIT_FIELD_VIRTUAL_ITEM_ID, 0);
150 me->SetUInt32Value(UNIT_FIELD_VIRTUAL_ITEM_ID+1, 0);
151 }
152
153 if (Phase2)
154 {
155 //Charging_Timer
156 if (Charging_Timer <= diff)
157 {
158 Unit* target = NULL;
160 if (target)
161 {
162 AttackStart(target);
163 DoCast(target, SPELL_BERSERKER_C);
164 }
165 Charging_Timer = 20000;
166 } else Charging_Timer -= diff;
167
168 //Intimidating Roar
169 if (Roar_Timer <= diff)
170 {
172 Roar_Timer = 40000+(rand()%10000);
173 } else Roar_Timer -= diff;
174 }
175
177 }
178
179 private:
186 bool Phase2;
187 };
188
190 {
192 }
193};
194
196{
197public:
198 boss_olm_the_summoner() : CreatureScript("boss_olm_the_summoner") { }
199
201 {
203 {
204 instance = creature->GetInstanceScript();
205 DarkDecay_Timer = 0;
206 Summon_Timer = 0;
207 DeathCoil_Timer = 0;
208 }
209
211 {
212 DarkDecay_Timer = 10000;
213 Summon_Timer = 15000;
214 DeathCoil_Timer = 20000;
215
216 instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
217 }
218
220 {
221 if (!who)
222 return;
223
224 if (me->Attack(who, true))
225 {
226 me->AddThreat(who, 0.0f);
227 me->SetInCombatWith(who);
228 who->SetInCombatWith(me);
229
230 me->GetMotionMaster()->MoveChase(who, 30.0f);
231 }
232 }
233
234 void EnterCombat(Unit* /*who*/) OVERRIDE
235 {
237 instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
238 }
239
240 void JustDied(Unit* /*killer*/) OVERRIDE
241 {
242 if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
243 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
244
245 instance->SetBossState(DATA_MAULGAR, DONE);
246 }
247
249 {
250 if (!UpdateVictim())
251 return;
252
253 //DarkDecay_Timer
254 if (DarkDecay_Timer <= diff)
255 {
257 DarkDecay_Timer = 20000;
258 } else DarkDecay_Timer -= diff;
259
260 //Summon_Timer
261 if (Summon_Timer <= diff)
262 {
264 Summon_Timer = 30000;
265 } else Summon_Timer -= diff;
266
267 //DeathCoil Timer /need correct timer
268 if (DeathCoil_Timer <= diff)
269 {
270 Unit* target = NULL;
272 if (target)
273 DoCast(target, SPELL_DEATH_COIL);
274 DeathCoil_Timer = 20000;
275 } else DeathCoil_Timer -= diff;
276
278 }
279
280 private:
285 };
286
288 {
290 }
291};
292
293//Kiggler The Crazed AI
295{
296public:
297 boss_kiggler_the_crazed() : CreatureScript("boss_kiggler_the_crazed") { }
298
300 {
309
311 {
313 LightningBolt_Timer = 10000;
314 ArcaneShock_Timer = 20000;
315 ArcaneExplosion_Timer = 30000;
316
317 instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
318 }
319
320 void EnterCombat(Unit* /*who*/) OVERRIDE
321 {
323 instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
324 }
325
326 void JustDied(Unit* /*killer*/) OVERRIDE
327 {
328 if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
329 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
330
331 instance->SetBossState(DATA_MAULGAR, DONE);
332 }
333
335 {
336 if (!UpdateVictim())
337 return;
338
339 //GreaterPolymorph_Timer
340 if (GreaterPolymorph_Timer <= diff)
341 {
342 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
344
345 GreaterPolymorph_Timer = std::rand() % 20000 + 15000;
346 } else GreaterPolymorph_Timer -= diff;
347
348 //LightningBolt_Timer
349 if (LightningBolt_Timer <= diff)
350 {
352 LightningBolt_Timer = 15000;
353 } else LightningBolt_Timer -= diff;
354
355 //ArcaneShock_Timer
356 if (ArcaneShock_Timer <= diff)
357 {
359 ArcaneShock_Timer = 20000;
360 } else ArcaneShock_Timer -= diff;
361
362 //ArcaneExplosion_Timer
363 if (ArcaneExplosion_Timer <= diff)
364 {
366 ArcaneExplosion_Timer = 30000;
367 } else ArcaneExplosion_Timer -= diff;
368
370 }
371
372 private:
378 };
379
381 {
383 }
384};
385
387{
388public:
389 boss_blindeye_the_seer() : CreatureScript("boss_blindeye_the_seer") { }
390
392 {
394 {
395 instance = creature->GetInstanceScript();
397 Heal_Timer = 0;
399 }
400
402 {
404 Heal_Timer = std::rand() % 40000 + 25000;
405 PrayerofHealing_Timer = std::rand() % 55000 + 45000;
406
407 instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
408 }
409
410 void EnterCombat(Unit* /*who*/) OVERRIDE
411 {
413 instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
414 }
415
416 void JustDied(Unit* /*killer*/) OVERRIDE
417 {
418 if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
419 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
420
421 instance->SetBossState(DATA_MAULGAR, DONE);
422 }
423
425 {
426 if (!UpdateVictim())
427 return;
428
429 //GreaterPowerWordShield_Timer
431 {
434 } else GreaterPowerWordShield_Timer -= diff;
435
436 //Heal_Timer
437 if (Heal_Timer <= diff)
438 {
440 Heal_Timer = std::rand() % 40000 + 15000;
441 } else Heal_Timer -= diff;
442
443 //PrayerofHealing_Timer
444 if (PrayerofHealing_Timer <= diff)
445 {
447 PrayerofHealing_Timer = std::rand() % 50000 + 35000;
448 } else PrayerofHealing_Timer -= diff;
449
451 }
452
453 private:
458 };
459
461 {
463 }
464};
465
467{
468public:
469 boss_krosh_firehand() : CreatureScript("boss_krosh_firehand") { }
470
472 {
474 {
475 instance = creature->GetInstanceScript();
478 BlastWave_Timer = 0;
479 }
480
482 {
484 SpellShield_Timer = 5000;
485 BlastWave_Timer = 20000;
486
487 instance->SetBossState(DATA_MAULGAR, NOT_STARTED);
488 }
489
490 void EnterCombat(Unit* /*who*/) OVERRIDE
491 {
493 instance->SetBossState(DATA_MAULGAR, IN_PROGRESS);
494 }
495
496 void JustDied(Unit* /*killer*/) OVERRIDE
497 {
498 if (Creature* maulgar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MAULGAR)))
499 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
500
501 instance->SetBossState(DATA_MAULGAR, DONE);
502 }
503
505 {
506 if (!UpdateVictim())
507 return;
508
509 //GreaterFireball_Timer
510 if (GreaterFireball_Timer < diff || me->IsWithinDist(me->GetVictim(), 30))
511 {
514 } else GreaterFireball_Timer -= diff;
515
516 //SpellShield_Timer
517 if (SpellShield_Timer <= diff)
518 {
519 me->InterruptNonMeleeSpells(false);
521 SpellShield_Timer = 30000;
522 } else SpellShield_Timer -= diff;
523
524 //BlastWave_Timer
525 if (BlastWave_Timer <= diff)
526 {
527 Unit* target = NULL;
528 std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
529 std::vector<Unit*> target_list;
530 for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
531 {
532 target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
533 //15 yard radius minimum
534 if (target && target->IsWithinDist(me, 15, false))
535 target_list.push_back(target);
536 target = NULL;
537 }
538 if (!target_list.empty())
539 target = *(target_list.begin()+rand()%target_list.size());
540
541 me->InterruptNonMeleeSpells(false);
542 DoCast(target, SPELL_BLAST_WAVE);
543 BlastWave_Timer = 60000;
544 } else BlastWave_Timer -= diff;
545 }
546
547 private:
552 };
553
555 {
557 }
558};
559
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_VIRTUAL_ITEM_ID
@ SPELL_WHIRLWIND
@ SAY_SLAY
@ SPELL_ARCANE_EXPLOSION
@ SPELL_DUAL_WIELD
#define SAY_DEATH
#define SAY_AGGRO
@ SAY_ENRAGE
@ SPELL_LIGHTNING_BOLT
@ SPELL_GREATER_POLYMORPH
@ SPELL_GREATER_PW_SHIELD
@ SPELL_ARCANE_EXPLOSION
@ SPELL_LIGHTNING_BOLT
@ SPELL_GREATER_FIREBALL
void AddSC_boss_high_king_maulgar()
@ SPELL_FLURRY
Definition boss_muru.cpp:41
@ SPELL_ARCANE_SHOCK
@ SPELL_ARCING_SMASH
@ SPELL_DEATH_COIL
Definition chapter1.cpp:34
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
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
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition Object.cpp:1730
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
AI * GetGruulsLairAI(Creature *creature)
Definition gruuls_lair.h:36
@ DATA_MAULGAR
Definition gruuls_lair.h:16
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================