TrinityCore
boss_moroes.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_Moroes
20SD%Complete: 95
21SDComment:
22SDCategory: Karazhan
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "Containers.h"
27#include "karazhan.h"
28#include "InstanceScript.h"
29#include "ObjectAccessor.h"
30#include "ScriptedCreature.h"
31#include "TemporarySummon.h"
32
34{
38 SAY_DEATH = 3
39};
40
42{
43 SPELL_VANISH = 29448,
45 SPELL_BLIND = 34694,
46 SPELL_GOUGE = 29425,
47 SPELL_FRENZY = 37023,
48
49 // Adds
52 SPELL_SWPAIN = 34441,
54
58
63
68
72
76 SPELL_SHIELDWALL = 29390
77};
78
80{
81 {-10991.0f, -1884.33f, 81.73f, 0.614315f},
82 {-10989.4f, -1885.88f, 81.73f, 0.904913f},
83 {-10978.1f, -1887.07f, 81.73f, 2.035550f},
84 {-10975.9f, -1885.81f, 81.73f, 2.253890f},
85};
86
87const uint32 Adds[6]=
88{
89 17007,
90 19872,
91 19873,
92 19874,
93 19875,
94 19876,
95};
96
98{
99public:
100 boss_moroes() : CreatureScript("boss_moroes") { }
101
102 CreatureAI* GetAI(Creature* creature) const override
103 {
104 return GetKarazhanAI<boss_moroesAI>(creature);
105 }
106
107 struct boss_moroesAI : public ScriptedAI
108 {
109 boss_moroesAI(Creature* creature) : ScriptedAI(creature)
110 {
111 Initialize();
112 memset(AddId, 0, sizeof(AddId));
113
114 instance = creature->GetInstanceScript();
115 }
116
118 {
119 Vanish_Timer = 30000;
120 Blind_Timer = 35000;
121 Gouge_Timer = 23000;
122 Wait_Timer = 0;
123 CheckAdds_Timer = 5000;
124
125 Enrage = false;
126 InVanish = false;
127 }
128
130
132
139
141 bool Enrage;
142
143 void Reset() override
144 {
145 Initialize();
146 if (me->IsAlive())
147 SpawnAdds();
148
150 }
151
153 {
155
157 }
158
159 void JustEngagedWith(Unit* /*who*/) override
160 {
161 StartEvent();
162
164 AddsAttack();
166 }
167
168 void KilledUnit(Unit* /*victim*/) override
169 {
170 Talk(SAY_KILL);
171 }
172
173 void JustDied(Unit* /*killer*/) override
174 {
176
178
179 DeSpawnAdds();
180
181 //remove aura from spell Garrote when Moroes dies
183 }
184
186 {
187 DeSpawnAdds();
188
189 if (isAddlistEmpty())
190 {
191 std::list<uint32> AddList;
192
193 for (uint8 i = 0; i < 6; ++i)
194 AddList.push_back(Adds[i]);
195
197
198 uint8 i = 0;
199 for (std::list<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end() && i < 4; ++itr, ++i)
200 {
201 uint32 entry = *itr;
202
203 if (Creature* creature = me->SummonCreature(entry, Locations[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10s))
204 {
205 AddGUID[i] = creature->GetGUID();
206 AddId[i] = entry;
207 }
208 }
209 }
210 else
211 {
212 for (uint8 i = 0; i < 4; ++i)
213 {
215 AddGUID[i] = creature->GetGUID();
216 }
217 }
218 }
219
221 {
222 for (uint8 i = 0; i < 4; ++i)
223 if (AddId[i] == 0)
224 return true;
225
226 return false;
227 }
228
230 {
231 for (uint8 i = 0; i < 4; ++i)
232 {
233 if (!AddGUID[i].IsEmpty())
234 {
236 temp->DespawnOrUnsummon();
237 }
238 }
239 }
240
242 {
243 for (uint8 i = 0; i < 4; ++i)
244 {
245 if (!AddGUID[i].IsEmpty())
246 {
248 if (temp && temp->IsAlive())
249 {
250 temp->AI()->AttackStart(me->GetVictim());
251 DoZoneInCombat(temp);
252 } else
254 }
255 }
256 }
257
258 void UpdateAI(uint32 diff) override
259 {
260 if (!UpdateVictim())
261 return;
262
263 if (!Enrage && HealthBelowPct(30))
264 {
266 Enrage = true;
267 }
268
269 if (CheckAdds_Timer <= diff)
270 {
271 for (uint8 i = 0; i < 4; ++i)
272 {
273 if (!AddGUID[i].IsEmpty())
274 {
276 if (temp && temp->IsAlive())
277 if (!temp->GetVictim())
278 temp->AI()->AttackStart(me->GetVictim());
279 }
280 }
281 CheckAdds_Timer = 5000;
282 } else CheckAdds_Timer -= diff;
283
284 if (!Enrage)
285 {
286 //Cast Vanish, then Garrote random victim
287 if (Vanish_Timer <= diff)
288 {
290 me->SetCanMelee(false);
291 InVanish = true;
292 Vanish_Timer = 30000;
293 Wait_Timer = 5000;
294 } else Vanish_Timer -= diff;
295
296 if (Gouge_Timer <= diff)
297 {
299 Gouge_Timer = 40000;
300 } else Gouge_Timer -= diff;
301
302 if (Blind_Timer <= diff)
303 {
304 if (Unit* target = SelectTarget(SelectTargetMethod::MinDistance, 0, 0.0f, true, false))
305 DoCast(target, SPELL_BLIND);
306 Blind_Timer = 40000;
307 } else Blind_Timer -= diff;
308 }
309
310 if (InVanish)
311 {
312 if (Wait_Timer <= diff)
313 {
315
316 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
317 target->CastSpell(target, SPELL_GARROTE, true);
318
319 InVanish = false;
320 me->SetCanMelee(true);
321 } else Wait_Timer -= diff;
322 }
323 }
324 };
325};
326
328{
330
332
334 {
335 instance = creature->GetInstanceScript();
336 }
337
338 void Reset() override
339 {
341 }
342
344 {
346 {
347 for (uint8 i = 0; i < 4; ++i)
348 {
349 ObjectGuid GUID = ENSURE_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i];
350 if (!GUID.IsEmpty())
351 GuestGUID[i] = GUID;
352 }
353 }
354 }
355
357 {
358 ObjectGuid TempGUID = GuestGUID[rand32() % 4];
359 if (!TempGUID.IsEmpty())
360 {
361 Unit* unit = ObjectAccessor::GetUnit(*me, TempGUID);
362 if (unit && unit->IsAlive())
363 return unit;
364 }
365
366 return me;
367 }
368
369 void UpdateAI(uint32 /*diff*/) override
370 {
373 }
374};
375
377{
378public:
379 boss_baroness_dorothea_millstipe() : CreatureScript("boss_baroness_dorothea_millstipe") { }
380
381 CreatureAI* GetAI(Creature* creature) const override
382 {
383 return GetKarazhanAI<boss_baroness_dorothea_millstipeAI>(creature);
384 }
385
387 {
388 //Shadow Priest
390 {
391 Initialize();
392 }
393
395 {
396 ManaBurn_Timer = 7000;
397 MindFlay_Timer = 1000;
399 }
400
404
405 void Reset() override
406 {
407 Initialize();
408
409 DoCast(me, SPELL_SHADOWFORM, true);
410
412 }
413
414 void UpdateAI(uint32 diff) override
415 {
416 if (!UpdateVictim())
417 return;
418
420
421 if (MindFlay_Timer <= diff)
422 {
424 MindFlay_Timer = 12000; // 3 sec channeled
425 } else MindFlay_Timer -= diff;
426
427 if (ManaBurn_Timer <= diff)
428 {
429 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
430 if (target->GetPowerType() == POWER_MANA)
431 DoCast(target, SPELL_MANABURN);
432 ManaBurn_Timer = 5000; // 3 sec cast
433 } else ManaBurn_Timer -= diff;
434
435 if (ShadowWordPain_Timer <= diff)
436 {
437 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
438 {
439 DoCast(target, SPELL_SWPAIN);
441 }
442 } else ShadowWordPain_Timer -= diff;
443 }
444 };
445};
446
448{
449public:
450 boss_baron_rafe_dreuger() : CreatureScript("boss_baron_rafe_dreuger") { }
451
452 CreatureAI* GetAI(Creature* creature) const override
453 {
454 return GetKarazhanAI<boss_baron_rafe_dreugerAI>(creature);
455 }
456
458 {
459 //Retr Pally
461 {
462 Initialize();
463 }
464
466 {
468 SealOfCommand_Timer = 7000;
470 }
471
475
476 void Reset() override
477 {
478 Initialize();
479
481 }
482
483 void UpdateAI(uint32 diff) override
484 {
485 if (!UpdateVictim())
486 return;
487
489
490 if (SealOfCommand_Timer <= diff)
491 {
493 SealOfCommand_Timer = 32000;
495 } else SealOfCommand_Timer -= diff;
496
497 if (JudgementOfCommand_Timer <= diff)
498 {
501 } else JudgementOfCommand_Timer -= diff;
502
503 if (HammerOfJustice_Timer <= diff)
504 {
506 HammerOfJustice_Timer = 12000;
507 } else HammerOfJustice_Timer -= diff;
508 }
509 };
510};
511
513{
514public:
515 boss_lady_catriona_von_indi() : CreatureScript("boss_lady_catriona_von_indi") { }
516
517 CreatureAI* GetAI(Creature* creature) const override
518 {
519 return GetKarazhanAI<boss_lady_catriona_von_indiAI>(creature);
520 }
521
523 {
524 //Holy Priest
526 {
527 Initialize();
528 }
529
531 {
532 DispelMagic_Timer = 11000;
533 GreaterHeal_Timer = 1500;
534 HolyFire_Timer = 5000;
536 }
537
542
543 void Reset() override
544 {
545 Initialize();
546
547 AcquireGUID();
548
550 }
551
552 void UpdateAI(uint32 diff) override
553 {
554 if (!UpdateVictim())
555 return;
556
558
559 if (PowerWordShield_Timer <= diff)
560 {
562 PowerWordShield_Timer = 15000;
563 } else PowerWordShield_Timer -= diff;
564
565 if (GreaterHeal_Timer <= diff)
566 {
567 Unit* target = SelectGuestTarget();
568
569 DoCast(target, SPELL_GREATERHEAL);
570 GreaterHeal_Timer = 17000;
571 } else GreaterHeal_Timer -= diff;
572
573 if (HolyFire_Timer <= diff)
574 {
576 HolyFire_Timer = 22000;
577 } else HolyFire_Timer -= diff;
578
579 if (DispelMagic_Timer <= diff)
580 {
581 if (Unit* target = RAND(SelectGuestTarget(), SelectTarget(SelectTargetMethod::Random, 0, 100, true)))
582 DoCast(target, SPELL_DISPELMAGIC);
583
584 DispelMagic_Timer = 25000;
585 } else DispelMagic_Timer -= diff;
586 }
587 };
588};
589
591{
592public:
593 boss_lady_keira_berrybuck() : CreatureScript("boss_lady_keira_berrybuck") { }
594
595 CreatureAI* GetAI(Creature* creature) const override
596 {
597 return GetKarazhanAI<boss_lady_keira_berrybuckAI>(creature);
598 }
599
601 {
602 //Holy Pally
604 {
605 Initialize();
606 }
607
609 {
610 Cleanse_Timer = 13000;
611 GreaterBless_Timer = 1000;
612 HolyLight_Timer = 7000;
613 DivineShield_Timer = 31000;
614 }
615
620
621 void Reset() override
622 {
623 Initialize();
624
625 AcquireGUID();
626
628 }
629
630 void UpdateAI(uint32 diff) override
631 {
632 if (!UpdateVictim())
633 return;
634
636
637 if (DivineShield_Timer <= diff)
638 {
640 DivineShield_Timer = 31000;
641 } else DivineShield_Timer -= diff;
642
643 if (HolyLight_Timer <= diff)
644 {
645 Unit* target = SelectGuestTarget();
646
647 DoCast(target, SPELL_HOLYLIGHT);
648 HolyLight_Timer = 10000;
649 } else HolyLight_Timer -= diff;
650
651 if (GreaterBless_Timer <= diff)
652 {
653 Unit* target = SelectGuestTarget();
654
656
657 GreaterBless_Timer = 50000;
658 } else GreaterBless_Timer -= diff;
659
660 if (Cleanse_Timer <= diff)
661 {
662 Unit* target = SelectGuestTarget();
663
664 DoCast(target, SPELL_CLEANSE);
665
666 Cleanse_Timer = 10000;
667 } else Cleanse_Timer -= diff;
668 }
669 };
670};
671
673{
674public:
675 boss_lord_robin_daris() : CreatureScript("boss_lord_robin_daris") { }
676
677 CreatureAI* GetAI(Creature* creature) const override
678 {
679 return GetKarazhanAI<boss_lord_robin_darisAI>(creature);
680 }
681
683 {
684 //Arms Warr
686 {
687 Initialize();
688 }
689
691 {
692 Hamstring_Timer = 7000;
693 MortalStrike_Timer = 10000;
694 WhirlWind_Timer = 21000;
695 }
696
700
701 void Reset() override
702 {
703 Initialize();
704
706 }
707
708 void UpdateAI(uint32 diff) override
709 {
710 if (!UpdateVictim())
711 return;
712
714
715 if (Hamstring_Timer <= diff)
716 {
718 Hamstring_Timer = 12000;
719 } else Hamstring_Timer -= diff;
720
721 if (MortalStrike_Timer <= diff)
722 {
724 MortalStrike_Timer = 18000;
725 } else MortalStrike_Timer -= diff;
726
727 if (WhirlWind_Timer <= diff)
728 {
730 WhirlWind_Timer = 21000;
731 } else WhirlWind_Timer -= diff;
732 }
733 };
734};
735
737{
738public:
739 boss_lord_crispin_ference() : CreatureScript("boss_lord_crispin_ference") { }
740
741 CreatureAI* GetAI(Creature* creature) const override
742 {
743 return GetKarazhanAI<boss_lord_crispin_ferenceAI>(creature);
744 }
745
747 {
748 //Arms Warr
750 {
751 Initialize();
752 }
753
755 {
756 Disarm_Timer = 6000;
757 HeroicStrike_Timer = 10000;
758 ShieldBash_Timer = 8000;
759 ShieldWall_Timer = 4000;
760 }
761
766
767 void Reset() override
768 {
769 Initialize();
770
772 }
773
774 void UpdateAI(uint32 diff) override
775 {
776 if (!UpdateVictim())
777 return;
778
780
781 if (Disarm_Timer <= diff)
782 {
784 Disarm_Timer = 12000;
785 } else Disarm_Timer -= diff;
786
787 if (HeroicStrike_Timer <= diff)
788 {
790 HeroicStrike_Timer = 10000;
791 } else HeroicStrike_Timer -= diff;
792
793 if (ShieldBash_Timer <= diff)
794 {
796 ShieldBash_Timer = 13000;
797 } else ShieldBash_Timer -= diff;
798
799 if (ShieldWall_Timer <= diff)
800 {
802 ShieldWall_Timer = 21000;
803 } else ShieldWall_Timer -= diff;
804 }
805 };
806};
807
809{
810 new boss_moroes();
817}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
@ POWER_MANA
#define ENSURE_AI(a, b)
Definition: UnitAI.h:29
@ SAY_DEATH
Definition: boss_moroes.cpp:38
@ SAY_AGGRO
Definition: boss_moroes.cpp:35
@ SAY_SPECIAL
Definition: boss_moroes.cpp:36
@ SAY_KILL
Definition: boss_moroes.cpp:37
void AddSC_boss_moroes()
Position const Locations[4]
Definition: boss_moroes.cpp:79
@ SPELL_HAMSTRING
Definition: boss_moroes.cpp:69
@ SPELL_SEALOFCOMMAND
Definition: boss_moroes.cpp:57
@ SPELL_SHADOWFORM
Definition: boss_moroes.cpp:53
@ SPELL_MORTALSTRIKE
Definition: boss_moroes.cpp:70
@ SPELL_CLEANSE
Definition: boss_moroes.cpp:64
@ SPELL_HAMMEROFJUSTICE
Definition: boss_moroes.cpp:55
@ SPELL_PWSHIELD
Definition: boss_moroes.cpp:62
@ SPELL_DISPELMAGIC
Definition: boss_moroes.cpp:59
@ SPELL_BLIND
Definition: boss_moroes.cpp:45
@ SPELL_SHIELDBASH
Definition: boss_moroes.cpp:75
@ SPELL_MANABURN
Definition: boss_moroes.cpp:50
@ SPELL_GREATERBLESSOFMIGHT
Definition: boss_moroes.cpp:65
@ SPELL_GREATERHEAL
Definition: boss_moroes.cpp:60
@ SPELL_DIVINESHIELD
Definition: boss_moroes.cpp:67
@ SPELL_MINDFLY
Definition: boss_moroes.cpp:51
@ SPELL_VANISH
Definition: boss_moroes.cpp:43
@ SPELL_FRENZY
Definition: boss_moroes.cpp:47
@ SPELL_SHIELDWALL
Definition: boss_moroes.cpp:76
@ SPELL_HOLYLIGHT
Definition: boss_moroes.cpp:66
@ SPELL_JUDGEMENTOFCOMMAND
Definition: boss_moroes.cpp:56
@ SPELL_HOLYFIRE
Definition: boss_moroes.cpp:61
@ SPELL_GOUGE
Definition: boss_moroes.cpp:46
@ SPELL_WHIRLWIND
Definition: boss_moroes.cpp:71
@ SPELL_GARROTE
Definition: boss_moroes.cpp:44
@ SPELL_DISARM
Definition: boss_moroes.cpp:73
@ SPELL_HEROICSTRIKE
Definition: boss_moroes.cpp:74
@ SPELL_SWPAIN
Definition: boss_moroes.cpp:52
Yells
void DoZoneInCombat()
Definition: CreatureAI.h:161
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
void SetCanMelee(bool canMelee, bool fleeFromMelee=false)
Definition: Creature.cpp:2822
CreatureAI * AI() const
Definition: Creature.h:214
virtual bool SetBossState(uint32 id, EncounterState state)
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
bool IsEmpty() const
Definition: ObjectGuid.h:319
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
bool IsAlive() const
Definition: Unit.h:1164
Unit * GetVictim() const
Definition: Unit.h:715
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
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
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_MOROES
Definition: karazhan.h:31
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void RandomResize(C &container, std::size_t requestedSize)
Definition: Containers.h:67
bool HealthBelowPct(uint32 pct) const
void JustEngagedWith(Unit *) override
InstanceScript * instance
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *) override
boss_moroesAI(Creature *creature)
void JustDied(Unit *) override
Unit * SelectGuestTarget()
InstanceScript * instance
ObjectGuid GuestGUID[4]
boss_moroes_guestAI(Creature *creature)
void UpdateAI(uint32) override
void Reset() override