Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_grandmaster_vorpil.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/*
7Name: Boss_Grandmaster_Vorpil
8%Complete: 100
9Category: Auchindoun, Shadow Labyrinth
10*/
11
12#include "ScriptMgr.h"
13#include "ScriptedCreature.h"
14#include "shadow_labyrinth.h"
15#include "Player.h"
16
48
49Position const VorpilPosition = { -252.8820f, -264.3030f, 17.1f, 0.0f };
50
51float VoidPortalCoords[5][3] =
52{
53 {-283.5894f, -239.5718f, 12.7f},
54 {-306.5853f, -258.4539f, 12.7f},
55 {-295.8789f, -269.0899f, 12.7f},
56 {-209.3401f, -262.7564f, 17.1f},
57 {-261.4533f, -297.3298f, 17.1f}
58};
59
67
69{
70 public:
71 boss_grandmaster_vorpil() : CreatureScript("boss_grandmaster_vorpil") { }
72
74 {
76 {
77 _intro = false;
78 }
79
81 {
82 _Reset();
83 _helpYell = false;
84 }
85
87 {
88 for (uint8 i = 0; i < 5; ++i)
89 if (Creature* portal = me->SummonCreature(NPC_VOID_PORTAL, VoidPortalCoords[i][0], VoidPortalCoords[i][1], VoidPortalCoords[i][2], 0, TempSummonType::TEMPSUMMON_CORPSE_DESPAWN, 3000000))
90 portal->CastSpell(portal, SPELL_VOID_PORTAL_VISUAL, true);
91
92 events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 5000);
93 }
94
96 {
97 uint8 pos = std::rand() % 4;
99 if (!_helpYell)
100 {
101 Talk(SAY_HELP);
102 _helpYell = true;
103 }
104 }
105
107 {
108 if (who->GetTypeId() == TypeID::TYPEID_PLAYER)
109 Talk(SAY_SLAY);
110 }
111
112 void JustDied(Unit* /*killer*/) OVERRIDE
113 {
114 _JustDied();
116 }
117
118 void EnterCombat(Unit* /*who*/) OVERRIDE
119 {
120 _EnterCombat();
121 events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, std::rand() % 14000 + 7000);
122 if (IsHeroic())
123 events.ScheduleEvent(EVENT_BANISH, 17000);
124 events.ScheduleEvent(EVENT_DRAW_SHADOWS, 45000);
125 events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 90000);
126
129 }
130
132 {
134
135 if (!_intro && me->IsWithinLOSInMap(who) && me->IsWithinDistInMap(who, 100) && me->IsValidAttackTarget(who))
136 {
138 _intro = true;
139 }
140 }
141
143 {
144 if (!UpdateVictim())
145 return;
146
147 events.Update(diff);
148
149 if (me->HasUnitState(UNIT_STATE_CASTING))
150 return;
151
152 while (uint32 eventId = events.ExecuteEvent())
153 {
154 switch (eventId)
155 {
158 events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, std::rand() % 30000 + 15000);
159 break;
160 case EVENT_BANISH:
161 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, false))
162 DoCast(target, SPELL_BANISH);
163 events.ScheduleEvent(EVENT_BANISH, 16000);
164 break;
166 {
167 Map* map = me->GetMap();
168 Map::PlayerList const &PlayerList = map->GetPlayers();
169 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
170 if (Player* i_pl = i->GetSource())
171 if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH))
172 i_pl->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
173
174 me->SetPosition(VorpilPosition);
177 events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, 6000);
178 events.ScheduleEvent(EVENT_DRAW_SHADOWS, 30000);
179 break;
180 }
183 events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 10000);
184 // enrage at 20%
185 if (HealthBelowPct(20))
186 events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 5000);
187 break;
188 }
189 }
190
192 }
193
194 private:
195 bool _intro;
197 };
198
200 {
202 }
203};
204
206{
207 public:
208 npc_voidtraveler() : CreatureScript("npc_voidtraveler") { }
209
211 {
213 {
214 _instance = creature->GetInstanceScript();
215 }
216
218 {
219 _moveTimer = 0;
220 _sacrificed = false;
221 }
222
223 void EnterCombat(Unit* /*who*/) OVERRIDE { }
224
226 {
227 if (_moveTimer <= diff)
228 {
230 if (!Vorpil)
231 return;
232
233 if (_sacrificed)
234 {
237 me->Kill(me);
238 return;
239 }
240 me->GetMotionMaster()->MoveFollow(Vorpil, 0, 0);
241 if (me->IsWithinDist(Vorpil, 3))
242 {
243 DoCast(me, SPELL_SACRIFICE, false);
244 _sacrificed = true;
245 _moveTimer = 500;
246 return;
247 }
248 _moveTimer = 1000;
249 }
250 else
251 _moveTimer -= diff;
252 }
253
254 private:
258 };
259
261 {
263 }
264};
265
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_CORPSE_DESPAWN
Definition Object.h:72
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition Object.h:73
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:831
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SAY_SLAY
@ SAY_INTRO
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_SHADOW_NOVA
@ H_SPELL_RAIN_OF_FIRE
@ SPELL_RAIN_OF_FIRE
float VoidPortalCoords[5][3]
@ SPELL_VOID_PORTAL_VISUAL
@ SPELL_SUMMON_VOID_TRAVELER_D
@ SPELL_EMPOWERING_SHADOWS
@ H_SPELL_EMPOWERING_SHADOWS
@ SPELL_SUMMON_VOID_TRAVELER_C
@ SPELL_SUMMON_VOID_TRAVELER_E
@ SPELL_SUMMON_VOID_TRAVELER_A
@ SPELL_SHADOWBOLT_VOLLEY
@ SPELL_SUMMON_VOID_TRAVELER_B
@ EVENT_SHADOWBOLT_VOLLEY
@ EVENT_SUMMON_TRAVELER
void AddSC_boss_grandmaster_vorpil()
Position const VorpilPosition
@ SPELL_BANISH
@ SPELL_SHADOWBOLT_VOLLEY
@ SPELL_EMPOWERING_SHADOWS
@ EVENT_SHADOWBOLT_VOLLEY
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
virtual void MoveInLineOfSight(Unit *)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
Definition Map.h:238
MapRefManager PlayerList
Definition Map.h:406
PlayerList const & GetPlayers() const
Definition Map.h:407
iterator end()
iterator begin()
LinkedListHead::Iterator< MapReference const > const_iterator
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 DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
AI * GetShadowLabyrinthAI(Creature *creature)
@ DATA_GRANDMASTER_VORPIL
bool IsHeroic() const
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
const T & DUNGEON_MODE(const T &normal5, const T &heroic5) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================