Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_magus_telestra.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#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "nexus.h"
9
23
25{
29};
30
39
45
46const Position CenterOfRoom = {504.80f, 89.07f, -16.12f, 6.27f};
47
49{
50public:
51 boss_magus_telestra() : CreatureScript("boss_magus_telestra") { }
52
54 {
55 return new boss_magus_telestraAI(creature);
56 }
57
59 {
61 {
62 instance = creature->GetInstanceScript();
63 }
64
66
70
75
81
84 time_t time[3];
85
87 {
88 Phase = 0;
89 //These times are probably wrong
93 uiCooldown = 0;
94
98
99 for (uint8 n = 0; n < 3; ++n)
100 time[n] = 0;
101
103 bIsWaitingToAppear = false;
104
106 me->SetVisible(true);
107
108 if (instance)
110 }
111
112 void EnterCombat(Unit* /*who*/) OVERRIDE
113 {
115
116 if (instance)
118 }
119
120 void JustDied(Unit* /*killer*/) OVERRIDE
121 {
123
124 if (instance)
126 }
127
128 void KilledUnit(Unit* /*victim*/) OVERRIDE
129 {
130 Talk(SAY_KILL);
131 }
132
134 {
135 if (action == ACTION_MAGUS_DEAD)
136 {
137 uint8 i = 0;
138 while (time[i] != 0)
139 ++i;
140
141 time[i] = sWorld->GetGameTime();
142 if (i == 2 && (time[2] - time[1] < 5) && (time[1] - time[0] < 5))
144 }
145 }
146
148 {
149 if (type == DATA_SPLIT_PERSONALITY)
150 return splitPersonality;
151
152 return 0;
153 }
154
156 {
157 if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS))
158 {
159 switch (entry)
160 {
161 case NPC_FIRE_MAGUS:
162 {
163 Summoned->CastSpell(Summoned, SPELL_FIRE_MAGUS_VISUAL, false);
164 break;
165 }
166 case NPC_FROST_MAGUS:
167 {
168 Summoned->CastSpell(Summoned, SPELL_FROST_MAGUS_VISUAL, false);
169 break;
170 }
171 case NPC_ARCANE_MAGUS:
172 {
173 Summoned->CastSpell(Summoned, SPELL_ARCANE_MAGUS_VISUAL, false);
174 break;
175 }
176 }
177 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
178 Summoned->AI()->AttackStart(target);
179 return Summoned->GetGUID();
180 }
181 return 0;
182 }
183
185 {
186 if (summon->IsAlive())
187 return;
188
189 if (summon->GetGUID() == uiFireMagusGUID)
190 {
191 me->AI()->DoAction(ACTION_MAGUS_DEAD);
192 bFireMagusDead = true;
193 }
194 else if (summon->GetGUID() == uiFrostMagusGUID)
195 {
196 me->AI()->DoAction(ACTION_MAGUS_DEAD);
197 bFrostMagusDead = true;
198 }
199 else if (summon->GetGUID() == uiArcaneMagusGUID)
200 {
201 me->AI()->DoAction(ACTION_MAGUS_DEAD);
202 bArcaneMagusDead = true;
203 }
204 }
205
207 {
208 //Return since we have no target
209 if (!UpdateVictim())
210 return;
211
213 {
214 me->StopMoving();
215 me->AttackStop();
216 if (uiIsWaitingToAppearTimer <= diff)
217 {
219 bIsWaitingToAppear = false;
220 } else uiIsWaitingToAppearTimer -= diff;
221 return;
222 }
223
224 if ((Phase == 1) ||(Phase == 3))
225 {
227 {
228 for (uint8 n = 0; n < 3; ++n)
229 time[n] = 0;
230 me->GetMotionMaster()->Clear();
231 me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
233 me->SetVisible(true);
234 if (Phase == 1)
235 Phase = 2;
236 if (Phase == 3)
237 Phase = 4;
238 uiFireMagusGUID = 0;
241 bIsWaitingToAppear = true;
244 }
245 else
246 return;
247 }
248
249 if ((Phase == 0) && HealthBelowPct(50))
250 {
251 Phase = 1;
252 me->CastStop();
253 me->RemoveAllAuras();
254 me->SetVisible(false);
259 bFireMagusDead = false;
260 bFrostMagusDead = false;
261 bArcaneMagusDead = false;
263 return;
264 }
265
266 if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
267 {
268 Phase = 3;
269 me->CastStop();
270 me->RemoveAllAuras();
271 me->SetVisible(false);
276 bFireMagusDead = false;
277 bFrostMagusDead = false;
278 bArcaneMagusDead = false;
280 return;
281 }
282
283 if (uiCooldown)
284 {
285 if (uiCooldown <= diff)
286 uiCooldown = 0;
287 else
288 {
289 uiCooldown -= diff;
290 return;
291 }
292 }
293
294 if (uiIceNovaTimer <= diff)
295 {
296 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
297 {
298 DoCast(target, SPELL_ICE_NOVA, false);
299 uiCooldown = 1500;
300 }
302 } else uiIceNovaTimer -= diff;
303
304 if (uiGravityWellTimer <= diff)
305 {
306 if (Unit* target = me->GetVictim())
307 {
308 DoCast(target, SPELL_GRAVITY_WELL);
310 }
312 } else uiGravityWellTimer -= diff;
313
314 if (uiFireBombTimer <= diff)
315 {
316 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
317 {
318 DoCast(target, SPELL_FIREBOMB, false);
320 }
322 } else uiFireBombTimer -=diff;
323
325 }
326 };
327};
328
330{
331 public:
332 achievement_split_personality() : AchievementCriteriaScript("achievement_split_personality") { }
333
334 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
335 {
336 if (!target)
337 return false;
338
339 if (Creature* Telestra = target->ToCreature())
340 if (Telestra->AI()->GetData(DATA_SPLIT_PERSONALITY) == 2)
341 return true;
342
343 return false;
344 }
345};
346
@ IN_MILLISECONDS
Definition Common.h:125
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
Creatures
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
@ SAY_SPLIT
@ NPC_FROST_MAGUS
@ NPC_FIRE_MAGUS
@ NPC_ARCANE_MAGUS
@ DATA_SPLIT_PERSONALITY
@ ACTION_MAGUS_DEAD
@ SPELL_ICE_NOVA
@ SPELL_TELESTRA_BACK
@ H_SPELL_FIREBOMB
@ SPELL_FIREBOMB
@ SPELL_GRAVITY_WELL
@ SPELL_ARCANE_MAGUS_VISUAL
@ H_SPELL_ICE_NOVA
@ SPELL_FROST_MAGUS_VISUAL
@ SPELL_FIRE_MAGUS_VISUAL
void AddSC_boss_magus_telestra()
const Position CenterOfRoom
AchievementCriteriaScript(const char *name)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
Creature * ToCreature()
Definition Object.h:207
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
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
#define sWorld
Definition World.h:910
@ DATA_MAGUS_TELESTRA_EVENT
Definition nexus.h:11
bool IsHeroic() const
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
uint32 GetData(uint32 type) const OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SummonedCreatureDespawn(Creature *summon) OVERRIDE