TrinityCore
arcatraz.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/* ScriptData
19SDName: Arcatraz
20SD%Complete: 60
21SDComment: Warden Mellichar, event controller for Skyriss event. Millhouse Manastorm. @todo make better combatAI for Millhouse.
22SDCategory: Tempest Keep, The Arcatraz
23EndScriptData */
24
25/* ContentData
26npc_millhouse_manastorm
27npc_warden_mellichar
28EndContentData */
29
30#include "ScriptMgr.h"
31#include "arcatraz.h"
32#include "InstanceScript.h"
33#include "MotionMaster.h"
34#include "ScriptedCreature.h"
35
36/*#####
37# npc_millhouse_manastorm
38#####*/
39
41{
54};
55
57{
67};
68
70{
71 npc_millhouse_manastorm(Creature* creature) : ScriptedAI(creature), Init(false)
72 {
73 Initialize();
74 instance = creature->GetInstanceScript();
75 }
76
78 {
80 LowHp = false;
81 Phase = 1;
82
83 Pyroblast_Timer = 1000;
84 Fireball_Timer = 2500;
85 }
86
88
91 bool Init;
92 bool LowHp;
93
96
97 void Reset() override
98 {
99 Initialize();
100
102 {
103 Init = true;
104 me->SetImmuneToNPC(false);
105 }
106
109 }
110
111 void AttackStart(Unit* who) override
112 {
113 if (me->Attack(who, true))
114 {
115 AddThreat(who, 0.0f);
116 me->SetInCombatWith(who);
117 who->SetInCombatWith(me);
118 me->GetMotionMaster()->MoveChase(who, 25.0f);
119 }
120 }
121
122 void KilledUnit(Unit* who) override
123 {
124 if (who->GetTypeId() == TYPEID_PLAYER)
125 Talk(SAY_KILL);
126 }
127
128 void JustDied(Unit* /*killer*/) override
129 {
131
132 /*for questId 10886 (heroic mode only)
133 if (instance->GetBossState(DATA_HARBINGER_SKYRISS) != DONE)
134 ->FailQuest();*/
135 }
136
137 void UpdateAI(uint32 diff) override
138 {
139 if (!Init)
140 {
141 if (EventProgress_Timer <= diff)
142 {
143 if (Phase < 8)
144 {
145 switch (Phase)
146 {
147 case 1:
149 EventProgress_Timer = 18000;
150 break;
151 case 2:
153 EventProgress_Timer = 18000;
154 break;
155 case 3:
158 EventProgress_Timer = 7000;
159 break;
160 case 4:
163 EventProgress_Timer = 7000;
164 break;
165 case 5:
168 EventProgress_Timer = 7000;
169 break;
170 case 6:
172 EventProgress_Timer = 6000;
173 break;
174 case 7:
176 Init = true;
177 me->SetImmuneToNPC(false);
178 break;
179 }
180 ++Phase;
181 }
182 }
183 else
184 EventProgress_Timer -= diff;
185 }
186
187 if (!UpdateVictim())
188 return;
189 if (!LowHp && HealthBelowPct(20))
190 {
192 LowHp = true;
193 }
194
195 if (Pyroblast_Timer <= diff)
196 {
197 if (me->IsNonMeleeSpellCast(false))
198 return;
199
200 Talk(SAY_PYRO);
201
203 Pyroblast_Timer = 40000;
204 }
205 else
206 Pyroblast_Timer -=diff;
207
208 if (Fireball_Timer <= diff)
209 {
211 Fireball_Timer = 4000;
212 }
213 else
214 Fireball_Timer -=diff;
215 }
216};
217/*#####
218# npc_warden_mellichar
219#####*/
220
222{
231};
232
234{
235 //phase 2(acid mobs)
238 //phase 3
240 //phase 4(acid mobs)
243 //phase 5(acid mobs)
246 //phase 6
248};
249
251{
252 //TARGET_SCRIPT
259};
260
262{
264 {
265 Initialize();
266 instance = creature->GetInstanceScript();
267 }
268
270 {
271 IsRunning = false;
272 CanSpawn = false;
273
274 EventProgress_Timer = 22000;
275 Phase = 1;
276 }
277
279
282
285
286 void Reset() override
287 {
288 Initialize();
289
292
294 }
295
296 void AttackStart(Unit* /*who*/) override { }
297
298 void MoveInLineOfSight(Unit* who) override
299 {
300 if (IsRunning)
301 return;
302
303 if (!me->GetVictim() && me->CanCreatureAttack(who))
304 {
306 return;
307 if (who->GetTypeId() != TYPEID_PLAYER)
308 return;
309
310 float attackRadius = me->GetAttackDistance(who)/10;
311 if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who))
312 JustEngagedWith(who);
313 }
314 }
315
316 void JustEngagedWith(Unit* /*who*/) override
317 {
320
323 IsRunning = true;
324 }
325
326 void JustSummoned(Creature* summon) override
327 {
328 DoZoneInCombat(summon);
329 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
330 summon->AI()->AttackStart(target);
331 }
332
334 {
335 if (Phase == 7 && instance->GetData(DATA_WARDEN_4) == DONE)
336 return true;
337 if (Phase == 6 && instance->GetData(DATA_WARDEN_3) == DONE)
338 return true;
339 if (Phase == 5 && instance->GetData(DATA_WARDEN_2) == DONE)
340 return true;
341 if (Phase == 4)
342 return true;
343 if (Phase == 3 && instance->GetData(DATA_WARDEN_1) == DONE)
344 return true;
346 return true;
348 return true;
349
350 return false;
351 }
352
354 {
357
358 switch (Phase)
359 {
360 case 2:
364 break;
365 case 3:
368 break;
369 case 5:
372 break;
373 case 6:
376 break;
377 case 7:
379 break;
380 }
381 CanSpawn = true;
382 }
383
384 void UpdateAI(uint32 diff) override
385 {
386 if (!IsRunning)
387 return;
388
389 if (EventProgress_Timer <= diff)
390 {
392 {
393 Reset();
394 return;
395 }
396
397 if (CanSpawn)
398 {
399 //continue beam omega pod, unless we are about to summon skyriss
400 if (Phase != 7)
402
403 switch (Phase)
404 {
405 case 2:
406 switch (urand(0, 1))
407 {
408 case 0:
409 me->SummonCreature(ENTRY_TRICKSTER, 472.231f, -150.86f, 42.6573f, 3.10669f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // random pos
410 break;
411 case 1:
412 me->SummonCreature(ENTRY_PH_HUNTER, 472.231f, -150.86f, 42.6573f, 3.10669f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // random pos
413 break;
414 }
415 break;
416 case 3:
417 me->SummonCreature(ENTRY_MILLHOUSE, 417.242f, -149.795f, 42.6548f, 0.191986f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // static pos
418 break;
419 case 4:
421 break;
422 case 5:
423 switch (urand(0, 1))
424 {
425 case 0:
426 me->SummonCreature(ENTRY_AKKIRIS, 420.851f, -174.337f, 42.6655f, 0.122173f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // random pos
427 break;
428 case 1:
429 me->SummonCreature(ENTRY_SULFURON, 420.851f, -174.337f, 42.6655f, 0.122173f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // random pos
430 break;
431 }
432 break;
433 case 6:
434 switch (urand(0, 1))
435 {
436 case 0:
437 me->SummonCreature(ENTRY_TW_DRAK, 470.364f, -174.656f, 42.6753f, 3.59538f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // random pos
438 break;
439 case 1:
440 me->SummonCreature(ENTRY_BL_DRAK, 470.364f, -174.656f, 42.6753f, 3.59538f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // random pos
441 break;
442 }
443 break;
444 case 7:
445 me->SummonCreature(ENTRY_SKYRISS, 446.086f, -182.506f, 44.0852f, 1.5708f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10min); // static pos
447 break;
448 }
449 CanSpawn = false;
450 ++Phase;
451 }
452 if (CanProgress())
453 {
454 switch (Phase)
455 {
456 case 1:
458 EventProgress_Timer = 10000;
459 ++Phase;
460 break;
461 case 2:
464 EventProgress_Timer = 7000;
465 break;
466 case 3:
469 EventProgress_Timer = 10000;
470 break;
471 case 4:
473 EventProgress_Timer = 15000;
474 break;
475 case 5:
478 EventProgress_Timer = 15000;
479 break;
480 case 6:
483 EventProgress_Timer = 15000;
484 break;
485 case 7:
487 EventProgress_Timer = 15000;
488 break;
489 }
490 }
491 }
492 else
493 EventProgress_Timer -= diff;
494 }
495};
496
498{
501}
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:52
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ FAIL
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition: ObjectDefines.h:63
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ SPELL_AURA_DUMMY
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:145
void AddSC_arcatraz()
Definition: arcatraz.cpp:497
WardenSpells
Definition: arcatraz.cpp:251
@ SPELL_TARGET_GAMMA
Definition: arcatraz.cpp:256
@ SPELL_TARGET_BETA
Definition: arcatraz.cpp:254
@ SPELL_TARGET_DELTA
Definition: arcatraz.cpp:255
@ SPELL_BUBBLE_VISUAL
Definition: arcatraz.cpp:258
@ SPELL_TARGET_OMEGA
Definition: arcatraz.cpp:257
@ SPELL_TARGET_ALPHA
Definition: arcatraz.cpp:253
WardenSays
Definition: arcatraz.cpp:222
@ YELL_INTRO2
Definition: arcatraz.cpp:224
@ YELL_INTRO1
Definition: arcatraz.cpp:223
@ YELL_RELEASE2B
Definition: arcatraz.cpp:227
@ YELL_WELCOME
Definition: arcatraz.cpp:230
@ YELL_RELEASE4
Definition: arcatraz.cpp:229
@ YELL_RELEASE1
Definition: arcatraz.cpp:225
@ YELL_RELEASE2A
Definition: arcatraz.cpp:226
@ YELL_RELEASE3
Definition: arcatraz.cpp:228
WardenUnits
Definition: arcatraz.cpp:234
@ ENTRY_TRICKSTER
Definition: arcatraz.cpp:236
@ ENTRY_SULFURON
Definition: arcatraz.cpp:242
@ ENTRY_AKKIRIS
Definition: arcatraz.cpp:241
@ ENTRY_MILLHOUSE
Definition: arcatraz.cpp:239
@ ENTRY_SKYRISS
Definition: arcatraz.cpp:247
@ ENTRY_PH_HUNTER
Definition: arcatraz.cpp:237
@ ENTRY_BL_DRAK
Definition: arcatraz.cpp:245
@ ENTRY_TW_DRAK
Definition: arcatraz.cpp:244
MillhouseSays
Definition: arcatraz.cpp:41
@ SAY_DEATH
Definition: arcatraz.cpp:52
@ SAY_INTRO_2
Definition: arcatraz.cpp:43
@ SAY_PYRO
Definition: arcatraz.cpp:49
@ SAY_BUFFS
Definition: arcatraz.cpp:45
@ SAY_INTRO_1
Definition: arcatraz.cpp:42
@ SAY_WATER
Definition: arcatraz.cpp:44
@ SAY_ICEBLOCK
Definition: arcatraz.cpp:50
@ SAY_KILL
Definition: arcatraz.cpp:48
@ SAY_READY
Definition: arcatraz.cpp:47
@ SAY_LOWHP
Definition: arcatraz.cpp:51
@ SAY_COMPLETE
Definition: arcatraz.cpp:53
@ SAY_DRINK
Definition: arcatraz.cpp:46
MillhouseSpells
Definition: arcatraz.cpp:57
@ SPELL_FROSTBOLT
Definition: arcatraz.cpp:65
@ SPELL_ICE_ARMOR
Definition: arcatraz.cpp:60
@ SPELL_CONJURE_WATER
Definition: arcatraz.cpp:58
@ SPELL_ARCANE_INTELLECT
Definition: arcatraz.cpp:59
@ SPELL_FIREBALL
Definition: arcatraz.cpp:64
@ SPELL_CONE_OF_COLD
Definition: arcatraz.cpp:62
@ SPELL_PYROBLAST
Definition: arcatraz.cpp:66
@ SPELL_FIRE_BLAST
Definition: arcatraz.cpp:63
@ SPELL_ARCANE_MISSILES
Definition: arcatraz.cpp:61
#define RegisterArcatrazCreatureAI(ai_name)
Definition: arcatraz.h:79
@ DATA_WARDEN_4
Definition: arcatraz.h:41
@ DATA_WARDENS_SHIELD
Definition: arcatraz.h:44
@ DATA_WARDEN_2
Definition: arcatraz.h:39
@ DATA_WARDEN_3
Definition: arcatraz.h:40
@ DATA_HARBINGER_SKYRISS
Definition: arcatraz.h:34
@ DATA_WARDEN_1
Definition: arcatraz.h:38
@ DATA_WARDEN_5
Definition: arcatraz.h:42
void DoZoneInCombat()
Definition: CreatureAI.h:161
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
float GetAttackDistance(Unit const *player) const
Definition: Creature.cpp:2153
bool CanFly() const override
Definition: Creature.h:147
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2686
void SetImmuneToNPC(bool apply) override
Definition: Creature.h:173
CreatureAI * AI() const
Definition: Creature.h:214
virtual bool SetBossState(uint32 id, EncounterState state)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
TypeID GetTypeId() const
Definition: Object.h:173
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3812
void SetInCombatWith(Unit *enemy, bool addSecondUnitSuppressed=false)
Definition: Unit.h:1045
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3059
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:5670
Unit * GetVictim() const
Definition: Unit.h:715
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
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
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition: Object.cpp:1181
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
float GetDistanceZ(WorldObject const *obj) const
Definition: Object.cpp:1048
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
bool HealthBelowPct(uint32 pct) const
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
npc_millhouse_manastorm(Creature *creature)
Definition: arcatraz.cpp:71
void KilledUnit(Unit *who) override
Definition: arcatraz.cpp:122
void UpdateAI(uint32 diff) override
Definition: arcatraz.cpp:137
void Reset() override
Definition: arcatraz.cpp:97
void AttackStart(Unit *who) override
== Triggered Actions Requested ==================
Definition: arcatraz.cpp:111
InstanceScript * instance
Definition: arcatraz.cpp:87
void JustDied(Unit *) override
Definition: arcatraz.cpp:128
void MoveInLineOfSight(Unit *who) override
Definition: arcatraz.cpp:298
void JustSummoned(Creature *summon) override
Definition: arcatraz.cpp:326
npc_warden_mellichar(Creature *creature)
Definition: arcatraz.cpp:263
uint32 EventProgress_Timer
Definition: arcatraz.cpp:283
void UpdateAI(uint32 diff) override
Definition: arcatraz.cpp:384
InstanceScript * instance
Definition: arcatraz.cpp:278
void JustEngagedWith(Unit *) override
Definition: arcatraz.cpp:316
void Reset() override
Definition: arcatraz.cpp:286
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
Definition: arcatraz.cpp:296