TrinityCore
blackrock_caverns.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#include "ScriptMgr.h"
19#include "blackrock_caverns.h"
20#include "ScriptedCreature.h"
21#include "SpellAuras.h"
22#include "SpellScript.h"
23#include "TemporarySummon.h"
24
25/*#####
26# npc_fire_cyclone
27#####*/
28
30{
33};
34
36{
37 public: npc_fire_cyclone() : CreatureScript("npc_fire_cyclone") { }
38
40 {
41 npc_fire_cycloneAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
42
43 void Reset() override
44 {
45 _events.Reset();
47 }
48
49 void UpdateAI(uint32 diff) override
50 {
51 _events.Update(diff);
52
53 while (uint32 eventId = _events.ExecuteEvent())
54 {
55 switch (eventId)
56 {
60 break;
61 default:
62 break;
63 }
64 }
65 }
66
67 private:
70 };
71
72 CreatureAI* GetAI(Creature* creature) const override
73 {
74 return GetBlackrockCavernsAI<npc_fire_cycloneAI>(creature);
75 }
76};
77
78/*#####
79# npc_twilight_flame_caller
80#####*/
81
83{
92};
93
95{
96 { 162.5990f, 1085.321f, 201.1190f, 0.0f },
97 { 170.5469f, 1063.403f, 201.1409f, 0.0f },
98 { 191.2326f, 1100.160f, 201.1071f, 0.0f },
99 { 228.0816f, 1106.000f, 201.1292f, 0.0f },
100 { 252.8351f, 1095.127f, 201.1436f, 0.0f },
101 { 253.6476f, 1070.226f, 201.1344f, 0.0f }
102};
103
105{
106public: npc_twilight_flame_caller() : CreatureScript("npc_twilight_flame_caller") { }
107
109 {
110 npc_twilight_flame_callerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summons(me)
111 {
112 Initialize();
113 }
114
116 {
117 _combatPhase = false;
118 }
119
120 void Reset() override
121 {
122 Initialize();
125
126 if (me->GetPositionX() > 172 && me->GetPositionX() < 173 && me->GetPositionY() > 1086 && me->GetPositionY() < 1087)
127 {
132 }
133 if (me->GetPositionX() > 247 && me->GetPositionX() < 248 && me->GetPositionY() > 1081 && me->GetPositionY() < 1082)
134 {
139 }
140
142 }
143
144 void JustSummoned(Creature* summoned) override
145 {
146 _summons.Summon(summoned);
147 }
148
149 void JustDied(Unit* /*killer*/) override
150 {
152 }
153
154 void JustEngagedWith(Unit* /*who*/) override
155 {
156 _events.Reset();
157 _combatPhase = true;
160 }
161
162 void UpdateAI(uint32 diff) override
163 {
164 _events.Update(diff);
165
166 if (!_combatPhase)
167 {
168 while (uint32 eventId = _events.ExecuteEvent())
169 {
170 switch (eventId)
171 {
172 case EVENT_CHANNEL:
173 if (me->GetGUID() == _flamecaller1GUID)
175 if (me->GetGUID() == _flamecaller2GUID)
178 break;
179 default:
180 break;
181 }
182 }
183 return;
184 }
185
186 if (!UpdateVictim())
187 return;
188
189 while (uint32 eventId = _events.ExecuteEvent())
190 {
191 switch (eventId)
192 {
193 case EVENT_BLAST_WAVE:
196 break;
200 break;
201 default:
202 break;
203 }
204 }
205 }
206
207 private:
214 };
215
216 CreatureAI* GetAI(Creature* creature) const override
217 {
218 return GetBlackrockCavernsAI<npc_twilight_flame_callerAI>(creature);
219 }
220};
221
222/*#####
223# npc_twilight_torturer
224#####*/
225
227{
237
239{
240 public: npc_twilight_torturer() : CreatureScript("npc_twilight_torturer") { }
241
243 {
244 npc_twilight_torturerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
245 {
246 Initialize();
247 }
248
250 {
251 _combatPhase = false;
252 }
253
254 void Reset() override
255 {
256 Initialize();
257 if (!me->GetWaypointPathId())
259 }
260
261 void JustEngagedWith(Unit* /*who*/) override
262 {
263 _events.Reset();
264 _combatPhase = true;
268 }
269
270 void UpdateAI(uint32 diff) override
271 {
272 _events.Update(diff);
273
274 if (!_combatPhase)
275 {
276 while (uint32 eventId = _events.ExecuteEvent())
277 {
278 switch (eventId)
279 {
283 break;
284 default:
285 break;
286 }
287 }
288 return;
289 }
290
291 if (!UpdateVictim())
292 return;
293
294 while (uint32 eventId = _events.ExecuteEvent())
295 {
296 switch (eventId)
297 {
301 break;
302 case EVENT_SHACKLES:
305 break;
309 break;
310 default:
311 break;
312 }
313 }
314 }
315
316 private:
320 };
321
322 CreatureAI* GetAI(Creature* creature) const override
323 {
324 return GetBlackrockCavernsAI<npc_twilight_torturerAI>(creature);
325 }
326};
327
328/*#####
329# npc_twilight_sadist
330#####*/
331
333{
343
345{
346 public: npc_twilight_sadist() : CreatureScript("npc_twilight_sadist") { }
347
349 {
350 npc_twilight_sadistAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
351
352 void Reset() override
353 {
354 _combatPhase = false;
355 if (!me->GetWaypointPathId())
357 }
358
359 void JustEngagedWith(Unit* /*who*/) override
360 {
361 _events.Reset();
362 _combatPhase = true;
367 }
368
369 void UpdateAI(uint32 diff) override
370 {
371 _events.Update(diff);
372
373 if (!_combatPhase)
374 {
375 while (uint32 eventId = _events.ExecuteEvent())
376 {
377 switch (eventId)
378 {
382 break;
383 default:
384 break;
385 }
386 }
387 return;
388 }
389
390 if (!UpdateVictim())
391 return;
392
393 while (uint32 eventId = _events.ExecuteEvent())
394 {
395 switch (eventId)
396 {
400 break;
401 case EVENT_SHACKLES:
404 break;
408 break;
409 default:
410 break;
411 }
412 }
413 }
414
415 private:
418 bool _combatPhase = false;
419 };
420
421 CreatureAI* GetAI(Creature* creature) const override
422 {
423 return GetBlackrockCavernsAI<npc_twilight_sadistAI>(creature);
424 }
425};
426
427/*#####
428# npc_mad_prisoner
429#####*/
430
432{
438 EVENT_ENRAGE = 15
440
442{
443 public: npc_mad_prisoner() : CreatureScript("npc_mad_prisoner") { }
444
446 {
447 npc_mad_prisonerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
448
449 void Reset() override { }
450
451 void JustEngagedWith(Unit* /*who*/) override
452 {
453 _events.Reset();
457 }
458
459 void UpdateAI(uint32 diff) override
460 {
461 if (!UpdateVictim())
462 return;
463
464 _events.Update(diff);
465
466 while (uint32 eventId = _events.ExecuteEvent())
467 {
468 switch (eventId)
469 {
470 case EVENT_HEAD_CRACK:
473 break;
477 break;
478 case EVENT_ENRAGE:
481 break;
482 default:
483 break;
484 }
485 }
486 }
487
488 private:
491 };
492
493 CreatureAI* GetAI(Creature* creature) const override
494 {
495 return GetBlackrockCavernsAI<npc_mad_prisonerAI>(creature);
496 }
497};
498
499/*#####
500# npc_crazed_mage
501#####*/
502
504{
507 EVENT_ENRAGE2 = 18
509
511{
512 public: npc_crazed_mage() : CreatureScript("npc_crazed_mage") { }
513
515 {
516 npc_crazed_mageAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
517
518 void Reset() override { }
519
520 void JustEngagedWith(Unit* /*who*/) override
521 {
522 _events.Reset();
526 }
527
528 void UpdateAI(uint32 diff) override
529 {
530 if (!UpdateVictim())
531 return;
532
533 _events.Update(diff);
534
535 while (uint32 eventId = _events.ExecuteEvent())
536 {
537 switch (eventId)
538 {
542 break;
546 break;
547 case EVENT_ENRAGE2:
550 break;
551 default:
552 break;
553 }
554 }
555 }
556
557 private:
560 };
561
562 CreatureAI* GetAI(Creature* creature) const override
563 {
564 return GetBlackrockCavernsAI<npc_crazed_mageAI>(creature);
565 }
566};
567
568/*#####
569# npc_raz_the_crazed
570#####*/
571
573{
586
588{
589 public: npc_raz_the_crazed() : CreatureScript("npc_raz_the_crazed") { }
590
592 {
593 npc_raz_the_crazedAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
594
595 void Reset() override { }
596
597 void JustEngagedWith(Unit* /*who*/) override
598 {
599 _events.Reset();
601 }
602
603 void IsSummonedBy(WorldObject* summoner) override
604 {
605 if (summoner->GetEntry() == NPC_ROMOGG_BONECRUSHER)
606 {
607 me->SetDisableGravity(true);
610 }
611 }
612
613 void SetData(uint32 id, uint32 data) override
614 {
615 if (id == TYPE_RAZ && data == DATA_ROMOGG_DEAD)
616 {
618 me->SetDisableGravity(false);
621 }
622 }
623
624 void UpdateAI(uint32 diff) override
625 {
626 _events.Update(diff);
627
628 while (uint32 eventId = _events.ExecuteEvent())
629 {
630 switch (eventId)
631 {
635 break;
638 break;
642 break;
643 default:
644 break;
645 }
646 }
647 }
648
649 private:
652 };
653
654 CreatureAI* GetAI(Creature* creature) const override
655 {
656 return GetBlackrockCavernsAI<npc_raz_the_crazedAI>(creature);
657 }
658};
659
660/*#####
661# npc_chains_of_woe
662#####*/
663
665{
671 MODEL_INVISIBLE = 38330
673
675{
676 public: npc_chains_of_woe() : CreatureScript("npc_chains_of_woe") { }
677
679 {
680 npc_chains_of_woeAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
681
682 void IsSummonedBy(WorldObject* /*summoner*/) override
683 {
687 }
688
689 private:
691 };
692
693 CreatureAI* GetAI(Creature* creature) const override
694 {
695 return GetBlackrockCavernsAI<npc_chains_of_woeAI>(creature);
696 }
697};
698
699/*#####
700# spell_chains_of_woe_1
701#####*/
702
704{
705 public: spell_chains_of_woe_1() : SpellScriptLoader("spell_chains_of_woe_1") { }
706
708 {
709 bool Validate(SpellInfo const* /*spellInfo*/) override
710 {
712 }
713
715 {
716 if (GetHitUnit()->GetTypeId() == TYPEID_PLAYER)
718 }
719
720 void Register() override
721 {
723 }
724 };
725
726 SpellScript* GetSpellScript() const override
727 {
729 }
730};
731
732/*#####
733# spell_chains_of_woe_4
734#####*/
735
737{
738 public: spell_chains_of_woe_4() : SpellScriptLoader("spell_chains_of_woe_4") { }
739
741 {
742 bool Validate(SpellInfo const* /*spellInfo*/) override
743 {
745 }
746
748 {
749 if (GetHitUnit()->GetTypeId() == TYPEID_PLAYER)
751 }
752
753 void Register() override
754 {
756 }
757 };
758
759 SpellScript* GetSpellScript() const override
760 {
762 }
763};
764
765/*#####
766# spell_nether_dragon_essence_1
767#####*/
768
770{
776
778{
779 public: spell_nether_dragon_essence_1() : SpellScriptLoader("spell_nether_dragon_essence_1") { }
780
782 {
783 bool Validate(SpellInfo const* /*spellInfo*/) override
784 {
785 return ValidateSpellInfo(
786 {
790 });
791 }
792
793 void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
794 {
795 if (Unit* caster = GetCaster())
797 }
798
799 void Register() override
800 {
802 }
803 };
804
805 AuraScript* GetAuraScript() const override
806 {
808 }
809};
810
811/*#####
812# spell_nether_dragon_essence_2
813#####*/
814
816{
817 public:
818 spell_nether_dragon_essence_2() : SpellScriptLoader("spell_nether_dragon_essence_2") { }
819
821 {
823 {
824 Position offset = { frand(-35.0f, 35.0f), frand(-25.0f, 25.0f), 0.0f, 0.0f };
825
826 switch (GetSpellInfo()->Id)
827 {
829 offset.m_positionZ = 25.0f;
830 break;
832 offset.m_positionZ = 17.0f;
833 break;
835 offset.m_positionZ = 33.0f;
836 break;
837 }
838
839 dest.RelocateOffset(offset);
840 }
841
842 void Register() override
843 {
845 }
846 };
847
848 SpellScript* GetSpellScript() const override
849 {
851 }
852};
853
855{
856 // Creature Scripts
857 new npc_fire_cyclone();
861 new npc_mad_prisoner();
862 new npc_crazed_mage();
863 new npc_raz_the_crazed();
864 new npc_chains_of_woe();
865 // Spell Scripts
870}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_CORPSE_DESPAWN
Definition: ObjectDefines.h:67
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
float frand(float min, float max)
Definition: Random.cpp:55
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_DEST_CASTER_RANDOM
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define SpellDestinationTargetSelectFn(F, I, N)
Definition: SpellScript.h:874
NetherDragonEssence
@ SPELL_NETHER_DRAGON_ESSENCE_3
@ SPELL_NETHER_DRAGON_ESSENCE_2
@ SPELL_NETHER_DRAGON_ESSENCE_1
@ SPELL_NETHER_DRAGON_ESSENCE_4
@ EVENT_FIRE_CYCLONE_AURA
@ SPELL_FIRE_CYCLONE_AURA
TwilightFlameCaller
@ SPELL_FIRE_CHANNELING_1
@ EVENT_CALL_FLAMES
@ EVENT_CHANNEL
@ SPELL_BLAST_WAVE
@ SPELL_CALL_FLAMES
@ EVENT_BLAST_WAVE
@ SPELL_FIRE_CHANNELING_2
@ NPC_FIRE_CYCLONE
@ EVENT_HEAD_CRACK2
@ EVENT_INFECTED_WOUND2
@ EVENT_ENRAGE2
Position const SummonPos[6]
@ EVENT_INFECTED_WOUND
@ SPELL_ENRAGE
@ EVENT_ENRAGE
@ EVENT_HEAD_CRACK
@ SPELL_HEAD_CRACK
@ SPELL_INFECTED_WOUND
@ SAY_SMASH
@ EVENT_AGGO_NEARBY_TARGETS
@ SPELL_SHADOW_PRISON
@ SPELL_FURIOUS_SWIPE
@ TYPE_RAZ
@ EVENT_START_FIRST_PATH
@ SPELL_AGGRO_NEARBY_TARGETS
@ SPELL_LEAP_FROM_BRIDGE
@ DATA_ROMOGG_DEAD
@ EVENT_FURIOUS_SWIPE
@ SPELL_LEAP_FROM_CAGE
TwilightTorturer
@ SPELL_SHACKLES
@ EVENT_RED_HOT_POKER
@ SPELL_WILD_BEATDOWN
@ EVENT_INFLICT_PAIN_TT
@ SPELL_RED_HOT_POKER
@ SPELL_INFLICT_PAIN
@ EVENT_WILD_BEATDOWN
@ EVENT_SHACKLES
@ MODEL_INVISIBLE
@ SPELL_CHAINS_OF_WOE_5
@ SPELL_CHAINS_OF_WOE_3
@ SPELL_CHAINS_OF_WOE_1
@ SPELL_CHAINS_OF_WOE_2
@ SPELL_CHAINS_OF_WOE_4
TwilightSadist
@ EVENT_SINISTER_STRIKE
@ SPELL_SINISTER_STRIKE
@ EVENT_HEAT_SEEKER_BLADE
@ EVENT_SHORT_THROW
@ SPELL_SHORT_THROW
@ SPELL_HEAT_SEEKER_BLADE
@ SPELL_INFLICT_PAIN_1
@ EVENT_INFLICT_PAIN_TS
void AddSC_blackrock_caverns()
@ NPC_ROMOGG_BONECRUSHER
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetCaster() const
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
uint32 GetWaypointPathId() const
Definition: Creature.h:381
void SetDisplayId(uint32 displayId, bool setNative=false) override
Definition: Creature.cpp:3402
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
void Reset()
Definition: EventMap.cpp:21
void Clear()
Definition: ObjectGuid.h:286
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Definition: SpellScript.h:873
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
SpellInfo const * GetSpellInfo() const
void Summon(Creature const *summon)
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
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
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
AuraScript * GetAuraScript() const override
SpellScript * GetSpellScript() const override
constexpr float GetPositionX() const
Definition: Position.h:76
float m_positionZ
Definition: Position.h:55
constexpr float GetPositionY() const
Definition: Position.h:77
void RelocateOffset(Position const &offset)
Definition: Spell.cpp:122
void IsSummonedBy(WorldObject *) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
void IsSummonedBy(WorldObject *summoner) override
void SetData(uint32 id, uint32 data) override