TrinityCore
boss_rend_blackhand.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_spire.h"
20#include "GameObject.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "Player.h"
24#include "ScriptedCreature.h"
25
27{
28 SPELL_WHIRLWIND = 13736, // sniffed
29 SPELL_CLEAVE = 15284,
32 SPELL_KNOCKDOWN = 13360 // On spawn during Gyth fight
33};
34
35enum Says
36{
37 // Rend Blackhand
41 // Victor Nefarius
52};
53
54enum Adds
55{
59};
60
61enum Misc
62{
63 NEFARIUS_PATH_1 = 11037360,
64 NEFARIUS_PATH_2 = 11037368,
65 NEFARIUS_PATH_3 = 11037376,
66 REND_PATH_1 = 11037440,
67 REND_PATH_2 = 11037448,
68};
69
70/*
71struct Wave
72{
73 uint32 entry;
74 float x_pos;
75 float y_pos;
76 float z_pos;
77 float o_pos;
78};
79
80static Wave Wave2[]= // 22 sec
81{
82 { 10447, 209.8637f, -428.2729f, 110.9877f, 0.6632251f },
83 { 10442, 209.3122f, -430.8724f, 110.9814f, 2.9147f },
84 { 10442, 211.3309f, -425.9111f, 111.0006f, 1.727876f }
85};
86
87static Wave Wave3[]= // 60 sec
88{
89 { 10742, 208.6493f, -424.5787f, 110.9872f, 5.8294f },
90 { 10447, 203.9482f, -428.9446f, 110.982f, 4.677482f },
91 { 10442, 203.3441f, -426.8668f, 110.9772f, 4.712389f },
92 { 10442, 206.3079f, -424.7509f, 110.9943f, 4.08407f }
93};
94
95static Wave Wave4[]= // 49 sec
96{
97 { 10742, 212.3541f, -412.6826f, 111.0352f, 5.88176f },
98 { 10447, 212.5754f, -410.2841f, 111.0296f, 2.740167f },
99 { 10442, 212.3449f, -414.8659f, 111.0348f, 2.356194f },
100 { 10442, 210.6568f, -412.1552f, 111.0124f, 0.9773844f }
101};
102
103static Wave Wave5[]= // 60 sec
104{
105 { 10742, 210.2188f, -410.6686f, 111.0211f, 5.8294f },
106 { 10447, 209.4078f, -414.13f, 111.0264f, 4.677482f },
107 { 10442, 208.0858f, -409.3145f, 111.0118f, 4.642576f },
108 { 10442, 207.9811f, -413.0728f, 111.0098f, 5.288348f },
109 { 10442, 208.0854f, -412.1505f, 111.0057f, 4.08407f }
110};
111
112static Wave Wave6[]= // 27 sec
113{
114 { 10742, 213.9138f, -426.512f, 111.0013f, 3.316126f },
115 { 10447, 213.7121f, -429.8102f, 110.9888f, 1.413717f },
116 { 10447, 213.7157f, -424.4268f, 111.009f, 3.001966f },
117 { 10442, 210.8935f, -423.913f, 111.0125f, 5.969026f },
118 { 10442, 212.2642f, -430.7648f, 110.9807f, 5.934119f }
119};
120
121static constexpr Position GythLoc = { 211.762f, -397.5885f, 111.1817f, 4.747295f };
122static constexpr Position Teleport1Loc = { 194.2993f, -474.0814f, 121.4505f, 6.27093f };
123static constexpr Position Teleport2Loc = { 216.485f, -434.93f, 110.888f, 6.27093f };
124*/
125
127{
160};
161
163{
165 {
166 gythEvent = false;
169 }
170
171 void Reset() override
172 {
173 _Reset();
174 gythEvent = false;
177 }
178
179 void JustEngagedWith(Unit* who) override
180 {
185 }
186
187 void IsSummonedBy(WorldObject* /*summoner*/) override
188 {
189 me->SetImmuneToPC(false);
191 }
192
193 void JustDied(Unit* /*killer*/) override
194 {
195 _JustDied();
196 if (Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 75.0f, true))
197 victor->AI()->SetData(1, 2);
198 }
199
200 void SetData(uint32 type, uint32 data) override
201 {
202 if (type == AREATRIGGER && data == AREATRIGGER_BLACKROCK_STADIUM)
203 {
204 if (!gythEvent)
205 {
206 gythEvent = true;
207
208 if (Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 5.0f, true))
209 victorGUID = victor->GetGUID();
210
211 if (GameObject* portcullis = me->FindNearestGameObject(GO_DR_PORTCULLIS, 50.0f))
212 portcullisGUID = portcullis->GetGUID();
213
216 }
217 }
218 }
219
220 void MovementInform(uint32 type, uint32 id) override
221 {
222 if (type == WAYPOINT_MOTION_TYPE)
223 {
224 switch (id)
225 {
226 case 5:
228 break;
229 case 11:
230 if (Creature* gyth = me->FindNearestCreature(NPC_GYTH, 10.0f, true))
231 gyth->AI()->SetData(1, 1);
232 me->DespawnOrUnsummon(1s, 7_days);
233 break;
234 }
235 }
236 }
237
238 void UpdateAI(uint32 diff) override
239 {
240 if (gythEvent)
241 {
242 events.Update(diff);
243
244 while (uint32 eventId = events.ExecuteEvent())
245 {
246 switch (eventId)
247 {
248 case EVENT_START_1:
250 victor->AI()->Talk(SAY_NEFARIUS_0);
252 break;
253 case EVENT_START_2:
256 victor->HandleEmoteCommand(EMOTE_ONESHOT_POINT);
258 break;
259 case EVENT_START_3:
261 victor->AI()->Talk(SAY_NEFARIUS_1);
265 break;
268 {
269 victor->SetFacingToObject(me);
270 victor->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
271 }
272 break;
275 if (Unit* player = victor->SelectNearestPlayer(60.0f))
276 victor->SetFacingToObject(player);
277 break;
280 victor->SetFacingTo(1.518436f);
281 break;
283 me->SetFacingTo(1.658063f);
284 break;
286 me->SetFacingTo(1.500983f);
287 break;
290 victor->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION);
291 break;
294 break;
298 victor->AI()->Talk(SAY_NEFARIUS_2);
304 break;
308 victor->AI()->Talk(SAY_NEFARIUS_3);
312 break;
316 victor->AI()->Talk(SAY_NEFARIUS_4);
320 break;
327 break;
331 victor->AI()->Talk(SAY_NEFARIUS_5);
335 break;
339 victor->AI()->Talk(SAY_NEFARIUS_6);
342 break;
345 victor->AI()->Talk(SAY_NEFARIUS_7);
349 break;
352 victor->AI()->Talk(SAY_NEFARIUS_8);
355 break;
358 victor->GetMotionMaster()->MovePath(NEFARIUS_PATH_1, true);
359 break;
360 case EVENT_PATH_REND:
362 break;
363 case EVENT_TELEPORT_1:
364 me->NearTeleportTo(194.2993f, -474.0814f, 121.4505f, -0.01225555f);
366 break;
367 case EVENT_TELEPORT_2:
368 me->NearTeleportTo(216.485f, -434.93f, 110.888f, -0.01225555f);
369 me->SummonCreature(NPC_GYTH, 211.762f, -397.5885f, 111.1817f, 4.747295f);
370 break;
371 case EVENT_WAVE_1:
373 portcullis->UseDoorOrButton();
374 // move wave
375 break;
376 case EVENT_WAVE_2:
377 // spawn wave
379 portcullis->UseDoorOrButton();
380 // move wave
381 break;
382 case EVENT_WAVE_3:
383 // spawn wave
385 portcullis->UseDoorOrButton();
386 // move wave
387 break;
388 case EVENT_WAVE_4:
389 // spawn wave
391 portcullis->UseDoorOrButton();
392 // move wave
393 break;
394 case EVENT_WAVE_5:
395 // spawn wave
397 portcullis->UseDoorOrButton();
398 // move wave
399 break;
400 case EVENT_WAVE_6:
401 // spawn wave
403 portcullis->UseDoorOrButton();
404 // move wave
405 break;
406 default:
407 break;
408 }
409 }
410 }
411
412 if (!UpdateVictim())
413 return;
414
415 events.Update(diff);
416
418 return;
419
420 while (uint32 eventId = events.ExecuteEvent())
421 {
422 switch (eventId)
423 {
424 case EVENT_WHIRLWIND:
427 break;
428 case EVENT_CLEAVE:
431 break;
435 break;
436 }
437
439 return;
440 }
441 }
442
443 private:
447};
448
450{
452}
uint32_t uint32
Definition: Define.h:142
@ WAYPOINT_MOTION_TYPE
Spells
Definition: PlayerAI.cpp:32
@ EMOTE_ONESHOT_POINT
@ EMOTE_ONESHOT_QUESTION
@ EMOTE_ONESHOT_ROAR
@ EMOTE_ONESHOT_TALK
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ AREATRIGGER
@ AREATRIGGER_BLACKROCK_STADIUM
#define RegisterBlackrockSpireCreatureAI(ai_name)
@ GO_DR_PORTCULLIS
@ NPC_GYTH
@ NPC_LORD_VICTOR_NEFARIUS
@ DATA_WARCHIEF_REND_BLACKHAND
Says
void AddSC_boss_rend_blackhand()
@ EMOTE_BLACKHAND_DISMOUNT
@ SAY_NEFARIUS_0
@ SAY_NEFARIUS_4
@ SAY_NEFARIUS_6
@ SAY_NEFARIUS_3
@ SAY_NEFARIUS_9
@ SAY_NEFARIUS_5
@ SAY_NEFARIUS_7
@ SAY_BLACKHAND_1
@ SAY_NEFARIUS_1
@ SAY_BLACKHAND_2
@ SAY_NEFARIUS_8
@ SAY_NEFARIUS_2
@ NPC_CHROMATIC_WHELP
@ NPC_BLACKHAND_DRAGON_HANDLER
@ NPC_CHROMATIC_DRAGONSPAWN
@ NEFARIUS_PATH_2
@ REND_PATH_1
@ NEFARIUS_PATH_3
@ REND_PATH_2
@ NEFARIUS_PATH_1
@ SPELL_CLEAVE
@ SPELL_MORTAL_STRIKE
@ SPELL_FRENZY
@ SPELL_KNOCKDOWN
@ SPELL_WHIRLWIND
@ EVENT_WAVES_TEXT_2
@ EVENT_START_4
@ EVENT_WAVE_1
@ EVENT_WAVES_TEXT_3
@ EVENT_PATH_REND
@ EVENT_START_1
@ EVENT_TELEPORT_1
@ EVENT_WAVES_COMPLETE_TEXT_2
@ EVENT_WHIRLWIND
@ EVENT_WAVE_2
@ EVENT_TURN_TO_REND
@ EVENT_WAVE_4
@ EVENT_WAVES_TEXT_1
@ EVENT_TURN_TO_FACING_1
@ EVENT_START_2
@ EVENT_WAVE_5
@ EVENT_PATH_NEFARIUS
@ EVENT_TURN_TO_FACING_3
@ EVENT_WAVES_EMOTE_2
@ EVENT_TELEPORT_2
@ EVENT_WAVES_TEXT_5
@ EVENT_START_3
@ EVENT_WAVES_TEXT_4
@ EVENT_TURN_TO_FACING_2
@ EVENT_CLEAVE
@ EVENT_WAVES_COMPLETE_TEXT_3
@ EVENT_WAVE_6
@ EVENT_WAVES_EMOTE_1
@ EVENT_MORTAL_STRIKE
@ EVENT_WAVES_COMPLETE_TEXT_1
@ EVENT_TURN_TO_PLAYER
@ EVENT_WAVE_3
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
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
void SetImmuneToPC(bool apply) override
Definition: Creature.h:170
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
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 MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, bool generatePath=true)
void Clear()
Definition: ObjectGuid.h:286
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void NearTeleportTo(Position const &pos, bool casting=false)
Definition: Unit.cpp:12327
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
Player * SelectNearestPlayer(float range) const
Definition: Object.cpp:2210
GameObject * FindNearestGameObject(uint32 entry, float range, bool spawnedOnly=true) const
Definition: Object.cpp:2170
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
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void JustDied(Unit *) override
boss_rend_blackhand(Creature *creature)
void IsSummonedBy(WorldObject *) override
void JustEngagedWith(Unit *who) override
void SetData(uint32 type, uint32 data) override
void MovementInform(uint32 type, uint32 id) override
void UpdateAI(uint32 diff) override