Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
arcatraz.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/* ScriptData
7SDName: Arcatraz
8SD%Complete: 60
9SDComment: Warden Mellichar, event controller for Skyriss event. Millhouse Manastorm. @todo make better combatAI for Millhouse.
10SDCategory: Tempest Keep, The Arcatraz
11EndScriptData */
12
13/* ContentData
14npc_millhouse_manastorm
15npc_warden_mellichar
16npc_zerekethvoidzone
17EndContentData */
18
19#include "ScriptMgr.h"
20#include "ScriptedCreature.h"
21#include "arcatraz.h"
22
23/*#####
24# npc_millhouse_manastorm
25#####*/
26
42
55
57{
58 public:
59 npc_millhouse_manastorm() : CreatureScript("npc_millhouse_manastorm") { }
60
62 {
64 {
65 instance = creature->GetInstanceScript();
66 }
67
69
72 bool Init;
73 bool LowHp;
74
77
79 {
81 LowHp = false;
82 Init = false;
83 Phase = 1;
84
85 Pyroblast_Timer = 1000;
86 Fireball_Timer = 2500;
87
88 if (instance)
89 {
90 if (instance->GetData(TYPE_WARDEN_2) == DONE)
91 Init = true;
92
93 if (instance->GetData(TYPE_HARBINGERSKYRISS) == DONE)
95 }
96 }
97
99 {
100 if (me->Attack(who, true))
101 {
102 me->AddThreat(who, 0.0f);
103 me->SetInCombatWith(who);
104 who->SetInCombatWith(me);
105 me->GetMotionMaster()->MoveChase(who, 25.0f);
106 }
107 }
108
109 void EnterCombat(Unit* /*who*/)OVERRIDE { }
110
111 void KilledUnit(Unit* /*victim*/) OVERRIDE
112 {
113 Talk(SAY_KILL);
114 }
115
116 void JustDied(Unit* /*killer*/) OVERRIDE
117 {
119
120 /*for questId 10886 (heroic mode only)
121 if (instance && instance->GetData(TYPE_HARBINGERSKYRISS) != DONE)
122 ->FailQuest();*/
123 }
124
126 {
127 if (!Init)
128 {
129 if (EventProgress_Timer <= diff)
130 {
131 if (Phase < 8)
132 {
133 switch (Phase)
134 {
135 case 1:
137 EventProgress_Timer = 18000;
138 break;
139 case 2:
141 EventProgress_Timer = 18000;
142 break;
143 case 3:
146 EventProgress_Timer = 7000;
147 break;
148 case 4:
151 EventProgress_Timer = 7000;
152 break;
153 case 5:
156 EventProgress_Timer = 7000;
157 break;
158 case 6:
160 EventProgress_Timer = 6000;
161 break;
162 case 7:
163 if (instance)
164 instance->SetData(TYPE_WARDEN_2, DONE);
165 Init = true;
166 break;
167 }
168 ++Phase;
169 }
170 }
171 else
172 EventProgress_Timer -= diff;
173 }
174
175 if (!UpdateVictim())
176 return;
177 if (!LowHp && HealthBelowPct(20))
178 {
180 LowHp = true;
181 }
182
183 if (Pyroblast_Timer <= diff)
184 {
185 if (me->IsNonMeleeSpellCasted(false))
186 return;
187
188 Talk(SAY_PYRO);
189
191 Pyroblast_Timer = 40000;
192 }
193 else
194 Pyroblast_Timer -=diff;
195
196 if (Fireball_Timer <= diff)
197 {
199 Fireball_Timer = 4000;
200 }
201 else
202 Fireball_Timer -=diff;
203
205 }
206 };
207
209 {
210 return new npc_millhouse_manastormAI(creature);
211 }
212};
213/*#####
214# npc_warden_mellichar
215#####*/
216
228
230{
231 //phase 2(acid mobs)
234 //phase 3
236 //phase 4(acid mobs)
239 //phase 5(acid mobs)
242 //phase 6
244};
245
256
258{
259 public:
260 npc_warden_mellichar() : CreatureScript("npc_warden_mellichar") { }
261
263 {
265 {
266 instance = creature->GetInstanceScript();
267 }
268
270
273
276
278 {
279 IsRunning = false;
280 CanSpawn = false;
281
282 EventProgress_Timer = 22000;
283 Phase = 1;
284
287
288 if (instance)
290 }
291
292 void AttackStart(Unit* /*who*/) OVERRIDE { }
293
295
296 {
297 if (IsRunning)
298 return;
299
300 if (!me->GetVictim() && me->CanCreatureAttack(who))
301 {
302 if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
303 return;
304 if (who->GetTypeId() != TypeID::TYPEID_PLAYER)
305 return;
306
307 float attackRadius = me->GetAttackDistance(who)/10;
308 if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who))
309 EnterCombat(who);
310 }
311 }
312
313 void EnterCombat(Unit* /*who*/) OVERRIDE
314 {
317
318 if (instance)
319 {
321 instance->HandleGameObject(instance->GetData64(DATA_SPHERE_SHIELD), false);
322 IsRunning = true;
323 }
324 }
325
327 {
328 if (instance)
329 {
330 if (Phase == 7 && instance->GetData(TYPE_WARDEN_4) == DONE)
331 return true;
332 if (Phase == 6 && instance->GetData(TYPE_WARDEN_3) == DONE)
333 return true;
334 if (Phase == 5 && instance->GetData(TYPE_WARDEN_2) == DONE)
335 return true;
336 if (Phase == 4)
337 return true;
338 if (Phase == 3 && instance->GetData(TYPE_WARDEN_1) == DONE)
339 return true;
340 if (Phase == 2 && instance->GetData(TYPE_HARBINGERSKYRISS) == IN_PROGRESS)
341 return true;
342 if (Phase == 1 && instance->GetData(TYPE_HARBINGERSKYRISS) == IN_PROGRESS)
343 return true;
344 return false;
345 }
346 return false;
347 }
348
350 {
351 if (instance)
352 {
353 me->InterruptNonMeleeSpells(true);
354 me->RemoveAurasByType(SPELL_AURA_DUMMY);
355
356 switch (Phase)
357 {
358 case 2:
361 instance->HandleGameObject(instance->GetData64(DATA_SPHERE_SHIELD), false);
362 break;
363 case 3:
366 break;
367 case 5:
370 break;
371 case 6:
374 break;
375 case 7:
377 break;
378 }
379 CanSpawn = true;
380 }
381 }
382
384 {
385 if (!IsRunning)
386 return;
387
388 if (EventProgress_Timer <= diff)
389 {
390 if (instance)
391 {
392 if (instance->GetData(TYPE_HARBINGERSKYRISS) == FAIL)
393 {
394 Reset();
395 return;
396 }
397 }
398
399 if (CanSpawn)
400 {
401 //continue beam omega pod, unless we are about to summon skyriss
402 if (Phase != 7)
404
405 switch (Phase)
406 {
407 case 2:
408 switch (std::rand() % 1)
409 {
410 case 0:
411 me->SummonCreature(ENTRY_TRICKSTER, 478.326f, -148.505f, 42.56f, 3.19f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
412 break;
413 case 1:
414 me->SummonCreature(ENTRY_PH_HUNTER, 478.326f, -148.505f, 42.56f, 3.19f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
415 break;
416 }
417 break;
418 case 3:
419 me->SummonCreature(ENTRY_MILLHOUSE, 413.292f, -148.378f, 42.56f, 6.27f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
420 break;
421 case 4:
423 break;
424 case 5:
425 switch (std::rand() % 1)
426 {
427 case 0:
428 me->SummonCreature(ENTRY_AKKIRIS, 420.179f, -174.396f, 42.58f, 0.02f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
429 break;
430 case 1:
431 me->SummonCreature(ENTRY_SULFURON, 420.179f, -174.396f, 42.58f, 0.02f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
432 break;
433 }
434 break;
435 case 6:
436 switch (std::rand() % 1)
437 {
438 case 0:
439 me->SummonCreature(ENTRY_TW_DRAK, 471.795f, -174.58f, 42.58f, 3.06f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
440 break;
441 case 1:
442 me->SummonCreature(ENTRY_BL_DRAK, 471.795f, -174.58f, 42.58f, 3.06f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
443 break;
444 }
445 break;
446 case 7:
447 me->SummonCreature(ENTRY_SKYRISS, 445.763f, -191.639f, 44.64f, 1.60f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
449 break;
450 }
451 CanSpawn = false;
452 ++Phase;
453 }
454 if (CanProgress())
455 {
456 switch (Phase)
457 {
458 case 1:
460 EventProgress_Timer = 10000;
461 ++Phase;
462 break;
463 case 2:
466 EventProgress_Timer = 7000;
467 break;
468 case 3:
471 EventProgress_Timer = 10000;
472 break;
473 case 4:
475 EventProgress_Timer = 15000;
476 break;
477 case 5:
480 EventProgress_Timer = 15000;
481 break;
482 case 6:
485 EventProgress_Timer = 15000;
486 break;
487 case 7:
489 EventProgress_Timer = 15000;
490 break;
491 }
492 }
493 }
494 else
495 EventProgress_Timer -= diff;
496 }
497 };
498
500 {
501 return new npc_warden_mellicharAI(creature);
502 }
503};
504
505/*#####
506# npc_zerekethvoidzone (this script probably not needed in future -> `creature_template_addon`.`auras`='36120 0')
507#####*/
508
513
515{
516 public:
517 npc_zerekethvoidzone() : CreatureScript("npc_zerekethvoidzone") { }
518
520 {
521 npc_zerekethvoidzoneAI(Creature* creature) : ScriptedAI(creature) { }
522
524 {
525 me->SetUInt32Value(UNIT_FIELD_NPC_FLAGS, 0);
526 me->setFaction(16);
528
530 }
531
532 void EnterCombat(Unit* /*who*/) OVERRIDE { }
533 };
534
536 {
537 return new npc_zerekethvoidzoneAI(creature);
538 }
539};
540
542{
546}
#define CREATURE_Z_ATTACK_RANGE
Definition Creature.h:422
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ FAIL
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition Object.h:68
@ SPELL_AURA_DUMMY
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_FLAGS
void AddSC_arcatraz()
Definition arcatraz.cpp:541
WardenSpells
Definition arcatraz.cpp:247
@ SPELL_TARGET_GAMMA
Definition arcatraz.cpp:252
@ SPELL_TARGET_BETA
Definition arcatraz.cpp:250
@ SPELL_TARGET_DELTA
Definition arcatraz.cpp:251
@ SPELL_BUBBLE_VISUAL
Definition arcatraz.cpp:254
@ SPELL_TARGET_OMEGA
Definition arcatraz.cpp:253
@ SPELL_TARGET_ALPHA
Definition arcatraz.cpp:249
WardenSays
Definition arcatraz.cpp:218
@ YELL_INTRO2
Definition arcatraz.cpp:220
@ YELL_INTRO1
Definition arcatraz.cpp:219
@ YELL_RELEASE2B
Definition arcatraz.cpp:223
@ YELL_WELCOME
Definition arcatraz.cpp:226
@ YELL_RELEASE4
Definition arcatraz.cpp:225
@ YELL_RELEASE1
Definition arcatraz.cpp:221
@ YELL_RELEASE2A
Definition arcatraz.cpp:222
@ YELL_RELEASE3
Definition arcatraz.cpp:224
ZerekethSpell
Definition arcatraz.cpp:510
@ SPELL_VOID_ZONE_DAMAGE
Definition arcatraz.cpp:511
WardenUnits
Definition arcatraz.cpp:230
@ ENTRY_TRICKSTER
Definition arcatraz.cpp:232
@ ENTRY_SULFURON
Definition arcatraz.cpp:238
@ ENTRY_AKKIRIS
Definition arcatraz.cpp:237
@ ENTRY_MILLHOUSE
Definition arcatraz.cpp:235
@ ENTRY_SKYRISS
Definition arcatraz.cpp:243
@ ENTRY_PH_HUNTER
Definition arcatraz.cpp:233
@ ENTRY_BL_DRAK
Definition arcatraz.cpp:241
@ ENTRY_TW_DRAK
Definition arcatraz.cpp:240
MillhouseSays
Definition arcatraz.cpp:28
@ SAY_DEATH
Definition arcatraz.cpp:39
@ SAY_INTRO_2
Definition arcatraz.cpp:30
@ SAY_PYRO
Definition arcatraz.cpp:36
@ SAY_BUFFS
Definition arcatraz.cpp:32
@ SAY_INTRO_1
Definition arcatraz.cpp:29
@ SAY_WATER
Definition arcatraz.cpp:31
@ SAY_ICEBLOCK
Definition arcatraz.cpp:37
@ SAY_KILL
Definition arcatraz.cpp:35
@ SAY_READY
Definition arcatraz.cpp:34
@ SAY_LOWHP
Definition arcatraz.cpp:38
@ SAY_COMPLETE
Definition arcatraz.cpp:40
@ SAY_DRINK
Definition arcatraz.cpp:33
MillhouseSpells
Definition arcatraz.cpp:44
@ SPELL_ICE_ARMOR
Definition arcatraz.cpp:47
@ SPELL_CONJURE_WATER
Definition arcatraz.cpp:45
@ SPELL_ARCANE_INTELLECT
Definition arcatraz.cpp:46
@ SPELL_FIREBALL
Definition arcatraz.cpp:51
@ SPELL_PYROBLAST
Definition arcatraz.cpp:53
@ TYPE_WARDEN_5
Definition arcatraz.h:19
@ TYPE_WARDEN_1
Definition arcatraz.h:15
@ DATA_SPHERE_SHIELD
Definition arcatraz.h:22
@ TYPE_HARBINGERSKYRISS
Definition arcatraz.h:14
@ TYPE_WARDEN_4
Definition arcatraz.h:18
@ TYPE_WARDEN_3
Definition arcatraz.h:17
@ TYPE_WARDEN_2
Definition arcatraz.h:16
@ SPELL_FROSTBOLT
@ SPELL_FIREBALL
@ SPELL_CONE_OF_COLD
#define SAY_DEATH
#define SAY_KILL
@ SPELL_ARCANE_MISSILES
@ SPELL_FIRE_BLAST
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition arcatraz.cpp:208
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition arcatraz.cpp:499
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition arcatraz.cpp:535
#define SAY_READY
Definition karazhan.cpp:54
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition arcatraz.cpp:125
void MoveInLineOfSight(Unit *who) OVERRIDE
Definition arcatraz.cpp:294
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition arcatraz.cpp:383