TrinityCore
boss_high_king_maulgar.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_High_King_Maulgar
20SD%Complete: 90
21SDComment: Correct timers, after whirlwind melee attack bug, prayer of healing
22SDCategory: Gruul's Lair
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "gruuls_lair.h"
27#include "InstanceScript.h"
28#include "MotionMaster.h"
29#include "ObjectAccessor.h"
30#include "ScriptedCreature.h"
31
33{
39
40 // High King Maulgar
45 SPELL_ROAR = 16508,
46 SPELL_FLURRY = 33232,
48
49 // Olm the Summoner
53
54 // Kiggler the Craed
59
60 // Blindeye the Seer
62 SPELL_HEAL = 33144,
64
65 // Krosh Firehand
69
71};
72
74{
75public:
76 boss_high_king_maulgar() : CreatureScript("boss_high_king_maulgar") { }
77
79 {
81 {
82 Initialize();
83 instance = creature->GetInstanceScript();
84 }
85
87 {
88 ArcingSmash_Timer = 10000;
89 MightyBlow_Timer = 40000;
90 Whirlwind_Timer = 30000;
92 Roar_Timer = 0;
93
94 Phase2 = false;
95 }
96
98
104
105 bool Phase2;
106
107 void Reset() override
108 {
109 Initialize();
110
111 DoCast(me, SPELL_DUAL_WIELD, false);
112
114 }
115
116 void KilledUnit(Unit* /*victim*/) override
117 {
118 Talk(SAY_SLAY);
119 }
120
121 void JustDied(Unit* /*killer*/) override
122 {
124
126 }
127
128 void DoAction(int32 actionId) override
129 {
130 if (actionId == ACTION_ADD_DEATH)
132 }
133
134 void JustEngagedWith(Unit* /*who*/) override
135 {
139 }
140
141 void UpdateAI(uint32 diff) override
142 {
143 if (!UpdateVictim())
144 return;
145
146 //ArcingSmash_Timer
147 if (ArcingSmash_Timer <= diff)
148 {
150 ArcingSmash_Timer = 10000;
151 } else ArcingSmash_Timer -= diff;
152
153 //Whirlwind_Timer
154 if (Whirlwind_Timer <= diff)
155 {
157 Whirlwind_Timer = 55000;
158 } else Whirlwind_Timer -= diff;
159
160 //MightyBlow_Timer
161 if (MightyBlow_Timer <= diff)
162 {
164 MightyBlow_Timer = 30000 + rand32() % 10000;
165 } else MightyBlow_Timer -= diff;
166
167 //Entering Phase 2
168 if (!Phase2 && HealthBelowPct(50))
169 {
170 Phase2 = true;
172
173 DoCast(me, SPELL_DUAL_WIELD, true);
174 me->SetVirtualItem(0, 0);
175 me->SetVirtualItem(1, 0);
176 }
177
178 if (Phase2)
179 {
180 //Charging_Timer
181 if (Charging_Timer <= diff)
182 {
184 {
185 AttackStart(target);
186 DoCast(target, SPELL_BERSERKER_C);
187 }
188 Charging_Timer = 20000;
189 } else Charging_Timer -= diff;
190
191 //Intimidating Roar
192 if (Roar_Timer <= diff)
193 {
195 Roar_Timer = 40000 + (rand32() % 10000);
196 } else Roar_Timer -= diff;
197 }
198 }
199 };
200
201 CreatureAI* GetAI(Creature* creature) const override
202 {
203 return GetGruulsLairAI<boss_high_king_maulgarAI>(creature);
204 }
205};
206
208{
209public:
210 boss_olm_the_summoner() : CreatureScript("boss_olm_the_summoner") { }
211
213 {
215 {
216 Initialize();
217 instance = creature->GetInstanceScript();
218 }
219
221 {
222 DarkDecay_Timer = 10000;
223 Summon_Timer = 15000;
224 DeathCoil_Timer = 20000;
225 }
226
230
232
233 void Reset() override
234 {
235 Initialize();
236
238 }
239
240 void AttackStart(Unit* who) override
241 {
242 if (!who)
243 return;
244
245 if (me->Attack(who, true))
246 {
247 AddThreat(who, 0.0f);
248 me->SetInCombatWith(who);
249 who->SetInCombatWith(me);
250
251 me->GetMotionMaster()->MoveChase(who, 30.0f);
252 }
253 }
254
255 void JustEngagedWith(Unit* /*who*/) override
256 {
259 }
260
261 void JustDied(Unit* /*killer*/) override
262 {
264 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
265
267 }
268
269 void UpdateAI(uint32 diff) override
270 {
271 if (!UpdateVictim())
272 return;
273
274 //DarkDecay_Timer
275 if (DarkDecay_Timer <= diff)
276 {
278 DarkDecay_Timer = 20000;
279 } else DarkDecay_Timer -= diff;
280
281 //Summon_Timer
282 if (Summon_Timer <= diff)
283 {
285 Summon_Timer = 30000;
286 } else Summon_Timer -= diff;
287
288 //DeathCoil Timer /need correct timer
289 if (DeathCoil_Timer <= diff)
290 {
292 DoCast(target, SPELL_DEATH_COIL);
293 DeathCoil_Timer = 20000;
294 } else DeathCoil_Timer -= diff;
295 }
296 };
297
298 CreatureAI* GetAI(Creature* creature) const override
299 {
300 return GetGruulsLairAI<boss_olm_the_summonerAI>(creature);
301 }
302};
303
304//Kiggler The Crazed AI
306{
307public:
308 boss_kiggler_the_crazed() : CreatureScript("boss_kiggler_the_crazed") { }
309
311 {
313 {
314 Initialize();
315 instance = creature->GetInstanceScript();
316 }
317
319 {
321 LightningBolt_Timer = 10000;
322 ArcaneShock_Timer = 20000;
323 ArcaneExplosion_Timer = 30000;
324 }
325
330
332
333 void Reset() override
334 {
335 Initialize();
336
338 }
339
340 void JustEngagedWith(Unit* /*who*/) override
341 {
344 }
345
346 void JustDied(Unit* /*killer*/) override
347 {
349 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
350
352 }
353
354 void UpdateAI(uint32 diff) override
355 {
356 if (!UpdateVictim())
357 return;
358
359 //GreaterPolymorph_Timer
360 if (GreaterPolymorph_Timer <= diff)
361 {
364
365 GreaterPolymorph_Timer = urand(15000, 20000);
366 } else GreaterPolymorph_Timer -= diff;
367
368 //LightningBolt_Timer
369 if (LightningBolt_Timer <= diff)
370 {
372 LightningBolt_Timer = 15000;
373 } else LightningBolt_Timer -= diff;
374
375 //ArcaneShock_Timer
376 if (ArcaneShock_Timer <= diff)
377 {
379 ArcaneShock_Timer = 20000;
380 } else ArcaneShock_Timer -= diff;
381
382 //ArcaneExplosion_Timer
383 if (ArcaneExplosion_Timer <= diff)
384 {
386 ArcaneExplosion_Timer = 30000;
387 } else ArcaneExplosion_Timer -= diff;
388 }
389 };
390
391 CreatureAI* GetAI(Creature* creature) const override
392 {
393 return GetGruulsLairAI<boss_kiggler_the_crazedAI>(creature);
394 }
395};
396
398{
399public:
400 boss_blindeye_the_seer() : CreatureScript("boss_blindeye_the_seer") { }
401
403 {
405 {
406 Initialize();
407 instance = creature->GetInstanceScript();
408 }
409
411 {
413 Heal_Timer = urand(25000, 40000);
414 PrayerofHealing_Timer = urand(45000, 55000);
415 }
416
420
422
423 void Reset() override
424 {
425 Initialize();
426
428 }
429
430 void JustEngagedWith(Unit* /*who*/) override
431 {
434 }
435
436 void JustDied(Unit* /*killer*/) override
437 {
439 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
440
442 }
443
444 void UpdateAI(uint32 diff) override
445 {
446 if (!UpdateVictim())
447 return;
448
449 //GreaterPowerWordShield_Timer
451 {
454 } else GreaterPowerWordShield_Timer -= diff;
455
456 //Heal_Timer
457 if (Heal_Timer <= diff)
458 {
460 Heal_Timer = urand(15000, 40000);
461 } else Heal_Timer -= diff;
462
463 //PrayerofHealing_Timer
464 if (PrayerofHealing_Timer <= diff)
465 {
467 PrayerofHealing_Timer = urand(35000, 50000);
468 } else PrayerofHealing_Timer -= diff;
469 }
470 };
471
472 CreatureAI* GetAI(Creature* creature) const override
473 {
474 return GetGruulsLairAI<boss_blindeye_the_seerAI>(creature);
475 }
476};
477
479{
480public:
481 boss_krosh_firehand() : CreatureScript("boss_krosh_firehand") { }
482
484 {
486 {
487 Initialize();
488 instance = creature->GetInstanceScript();
489 }
490
492 {
494 SpellShield_Timer = 5000;
495 BlastWave_Timer = 20000;
496 }
497
501
503
504 void Reset() override
505 {
506 Initialize();
507
509 }
510
511 void JustEngagedWith(Unit* /*who*/) override
512 {
515 }
516
517 void JustDied(Unit* /*killer*/) override
518 {
520 maulgar->AI()->DoAction(ACTION_ADD_DEATH);
521
523 }
524
525 void UpdateAI(uint32 diff) override
526 {
527 if (!UpdateVictim())
528 return;
529
530 //GreaterFireball_Timer
531 if (GreaterFireball_Timer < diff || me->IsWithinDist(me->GetVictim(), 30))
532 {
535 } else GreaterFireball_Timer -= diff;
536
537 //SpellShield_Timer
538 if (SpellShield_Timer <= diff)
539 {
542 SpellShield_Timer = 30000;
543 } else SpellShield_Timer -= diff;
544
545 //BlastWave_Timer
546 if (BlastWave_Timer <= diff)
547 {
548 std::vector<Unit*> target_list;
549 for (auto* ref : me->GetThreatManager().GetUnsortedThreatList())
550 {
551 Unit* target = ref->GetVictim();
552 if (target && target->IsWithinDist(me, 15, false)) // 15 yard radius minimum
553 target_list.push_back(target);
554 }
555 Unit* target = nullptr;
556 if (!target_list.empty())
557 target = *(target_list.begin() + rand32() % target_list.size());
558
560 DoCast(target, SPELL_BLAST_WAVE);
561 BlastWave_Timer = 60000;
562 } else BlastWave_Timer -= diff;
563 }
564 };
565
566 CreatureAI* GetAI(Creature* creature) const override
567 {
568 return GetGruulsLairAI<boss_krosh_firehandAI>(creature);
569 }
570};
571
573{
579}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
uint32 rand32()
Definition: Random.cpp:70
@ SPELL_DEATH_COIL
@ SPELL_GREATER_POLYMORPH
@ SPELL_SUMMON_WFH
@ SPELL_BERSERKER_C
@ ACTION_ADD_DEATH
@ SPELL_SPELLSHIELD
@ SPELL_GREATER_PW_SHIELD
@ SPELL_DUAL_WIELD
@ SPELL_ARCANE_EXPLOSION
@ SPELL_ARCANE_SHOCK
@ SPELL_BLAST_WAVE
@ SPELL_LIGHTNING_BOLT
@ SPELL_GREATER_FIREBALL
@ SPELL_ARCING_SMASH
@ SPELL_MIGHTY_BLOW
@ SPELL_DARK_DECAY
void AddSC_boss_high_king_maulgar()
void DoZoneInCombat()
Definition: CreatureAI.h:161
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
virtual bool SetBossState(uint32 id, EncounterState state)
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
Trinity::IteratorPair< ThreatListIterator, std::nullptr_t > GetUnsortedThreatList() const
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
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 SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
Definition: Unit.cpp:13604
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
void SetInCombatWith(Unit *enemy, bool addSecondUnitSuppressed=false)
Definition: Unit.h:1045
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:5670
Unit * GetVictim() const
Definition: Unit.h:715
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1142
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
@ DATA_MAULGAR
Definition: gruuls_lair.h:31
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
bool HealthBelowPct(uint32 pct) const
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void AttackStart(Unit *who) override
== Triggered Actions Requested ==================