TrinityCore
boss_archaedas.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: boss_archaedas
20SD%Complete: 100
21SDComment: Archaedas is activated when 1 person (was 3, changed in 3.0.8) clicks on his altar.
22Every 10 seconds he will awaken one of his minions along the wall.
23At 66%, he will awaken the 6 Guardians.
24At 33%, he will awaken the Vault Walkers
25On his death the vault door opens.
26EndScriptData */
27
28#include "ScriptMgr.h"
29#include "GameObject.h"
30#include "GameObjectAI.h"
31#include "InstanceScript.h"
32#include "ObjectAccessor.h"
33#include "Player.h"
34#include "ScriptedCreature.h"
35#include "SpellInfo.h"
36#include "uldaman.h"
37
38enum Says
39{
43 SAY_KILL = 3
44};
45
47{
58
59};
60
62{
63 public:
64
66 : CreatureScript("boss_archaedas")
67 {
68 }
69
70 struct boss_archaedasAI : public BossAI
71 {
73 {
74 Initialize();
75 }
76
78 {
79 uiTremorTimer = 60000;
80 iAwakenTimer = 0;
81 uiWallMinionTimer = 10000;
82
83 bWakingUp = false;
84 bGuardiansAwake = false;
85 bVaultWalkersAwake = false;
86 }
87
92
95
96 void Reset() override
97 {
98 _Reset();
99 Initialize();
100
101 instance->SetData(0, 5); // respawn any dead minions
103 me->SetUninteractible(true);
106 }
107
108 void ActivateMinion(ObjectGuid uiGuid, bool flag)
109 {
110 Unit* minion = ObjectAccessor::GetUnit(*me, uiGuid);
111
112 if (minion && minion->IsAlive())
113 {
114 DoCast(minion, SPELL_AWAKEN_VAULT_WALKER, flag);
115 minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN, true);
116 minion->SetUninteractible(false);
117 minion->SetControlled(false, UNIT_STATE_ROOT);
120 }
121 }
122
123 void JustEngagedWith(Unit* who) override
124 {
125 _JustEngagedWith(who);
127 me->SetUninteractible(false);
129 }
130
131 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
132 {
133 // Being woken up from the altar, start the awaken sequence
134 if (spellInfo->Id == SPELL_ARCHAEDAS_AWAKEN)
135 {
137 iAwakenTimer = 4000;
138 bWakingUp = true;
139 }
140 }
141
142 void KilledUnit(Unit* /*victim*/) override
143 {
144 Talk(SAY_KILL);
145 }
146
147 void UpdateAI(uint32 uiDiff) override
148 {
149 // we're still doing awaken animation
150 if (bWakingUp && iAwakenTimer >= 0)
151 {
152 iAwakenTimer -= uiDiff;
153 return; // dont do anything until we are done
154 } else if (bWakingUp && iAwakenTimer <= 0)
155 {
156 bWakingUp = false;
158 return; // dont want to continue until we finish the AttackStart method
159 }
160
161 //Return since we have no target
162 if (!UpdateVictim())
163 return;
164
165 // wake a wall minion
166 if (uiWallMinionTimer <= uiDiff)
167 {
169
170 uiWallMinionTimer = 10000;
171 } else uiWallMinionTimer -= uiDiff;
172
173 //If we are <66 summon the guardians
174 if (!bGuardiansAwake && !HealthAbovePct(66))
175 {
176 ActivateMinion(instance->GetGuidData(5), true); // EarthenGuardian1
177 ActivateMinion(instance->GetGuidData(6), true); // EarthenGuardian2
178 ActivateMinion(instance->GetGuidData(7), true); // EarthenGuardian3
179 ActivateMinion(instance->GetGuidData(8), true); // EarthenGuardian4
180 ActivateMinion(instance->GetGuidData(9), true); // EarthenGuardian5
181 ActivateMinion(instance->GetGuidData(10), false); // EarthenGuardian6
183 bGuardiansAwake = true;
184 }
185
186 //If we are <33 summon the vault walkers
188 {
189 ActivateMinion(instance->GetGuidData(1), true); // VaultWalker1
190 ActivateMinion(instance->GetGuidData(2), true); // VaultWalker2
191 ActivateMinion(instance->GetGuidData(3), true); // VaultWalker3
192 ActivateMinion(instance->GetGuidData(4), false); // VaultWalker4
194 bVaultWalkersAwake = true;
195 }
196
197 if (uiTremorTimer <= uiDiff)
198 {
199 //Cast
201
202 //45 seconds until we should cast this agian
203 uiTremorTimer = 45000;
204 } else uiTremorTimer -= uiDiff;
205 }
206
207 void JustDied (Unit* /*killer*/) override
208 {
209 _JustDied();
210 instance->SetData(DATA_MINIONS, SPECIAL); // deactivate his minions
211 }
212 };
213
214 CreatureAI* GetAI(Creature* creature) const override
215 {
216 return GetUldamanAI<boss_archaedasAI>(creature);
217 }
218};
219
220/* ScriptData
221SDName: npc_archaedas_minions
222SD%Complete: 100
223SDComment: These mobs are initially frozen until Archaedas awakens them
224one at a time.
225EndScriptData */
226
228{
229 public:
230
232 : CreatureScript("npc_archaedas_minions")
233 {
234 }
235
237 {
239 {
240 Initialize();
242 }
243
245 {
246 uiArcing_Timer = 3000;
247 iAwakenTimer = 0;
248
249 bWakingUp = false;
250 bAmIAwake = false;
251 }
252
256
259
260 void Reset() override
261 {
262 Initialize();
263
264 me->SetFaction(35);
265 me->SetUninteractible(true);
269 }
270
271 void JustEngagedWith(Unit* /*who*/) override
272 {
275 me->SetUninteractible(false);
277 bAmIAwake = true;
278 }
279
280 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
281 {
282 // time to wake up, start animation
283 if (spellInfo->Id == SPELL_ARCHAEDAS_AWAKEN)
284 {
285 iAwakenTimer = 5000;
286 bWakingUp = true;
287 }
288 }
289
290 void MoveInLineOfSight(Unit* who) override
291
292 {
293 if (bAmIAwake)
295 }
296
297 void UpdateAI(uint32 uiDiff) override
298 {
299 // we're still in the awaken animation
300 if (bWakingUp && iAwakenTimer >= 0)
301 {
302 iAwakenTimer -= uiDiff;
303 return; // dont do anything until we are done
304 } else if (bWakingUp && iAwakenTimer <= 0)
305 {
306 bWakingUp = false;
307 bAmIAwake = true;
308 AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0))); // whoWokeArchaedasGUID
309 return; // dont want to continue until we finish the AttackStart method
310 }
311
312 //Return since we have no target
313 if (!UpdateVictim())
314 return;
315 }
316 };
317
318 CreatureAI* GetAI(Creature* creature) const override
319 {
320 return GetUldamanAI<npc_archaedas_minionsAI>(creature);
321 }
322};
323
324/* ScriptData
325SDName: npc_stonekeepers
326SD%Complete: 100
327SDComment: After activating the altar of the keepers, the stone keepers will
328wake up one by one.
329EndScriptData */
330
332{
333 public:
334
336 : CreatureScript("npc_stonekeepers")
337 {
338 }
339
341 {
343 {
345 }
346
348
349 void Reset() override
350 {
352 me->SetUninteractible(true);
356 }
357
358 void JustEngagedWith(Unit* /*who*/) override
359 {
361 me->SetUninteractible(false);
363 }
364
365 void UpdateAI(uint32 /*diff*/) override
366 {
367 //Return since we have no target
368 if (!UpdateVictim())
369 return;
370 }
371
372 void JustDied(Unit* /*killer*/) override
373 {
375 instance->SetData(DATA_STONE_KEEPERS, IN_PROGRESS); // activate next stonekeeper
376 }
377 };
378
379 CreatureAI* GetAI(Creature* creature) const override
380 {
381 return GetUldamanAI<npc_stonekeepersAI>(creature);
382 }
383};
384
385/* ScriptData
386SDName: go_altar_archaedas
387SD%Complete: 100
388SDComment: Needs 1 person to activate the Archaedas script
389SDCategory: Uldaman
390EndScriptData */
391
393{
394 public:
395 go_altar_of_archaedas() : GameObjectScript("go_altar_of_archaedas") { }
396
398 {
399 go_altar_of_archaedasAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
400
402
403 bool OnGossipHello(Player* player) override
404 {
405 player->CastSpell(player, SPELL_BOSS_OBJECT_VISUAL, false);
406
407 instance->SetGuidData(0, player->GetGUID()); // activate archaedas
408 return false;
409 }
410 };
411
412 GameObjectAI* GetAI(GameObject* go) const override
413 {
414 return GetUldamanAI<go_altar_of_archaedasAI>(go);
415 }
416};
417
418//This is the actual function called only once durring InitScripts()
419//It must define all handled functions that are to be run in this script
421{
422 new boss_archaedas();
424 new npc_stonekeepers();
426}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ SPECIAL
Spells
Definition: PlayerAI.cpp:32
@ FACTION_FRIENDLY
@ FACTION_MONSTER
@ UNIT_STATE_ROOT
Definition: Unit.h:265
@ SAY_AGGRO
@ SAY_SUMMON_GUARDIANS
@ SAY_KILL
@ SAY_SUMMON_VAULT_WALKERS
void AddSC_boss_archaedas()
@ SPELL_FREEZE_ANIM
@ SPELL_MINION_FREEZE_ANIM
@ SPELL_AWAKEN_EARTHEN_GUARDIAN
@ SPELL_SUB_BOSS_AGGRO
@ SPELL_BOSS_OBJECT_VISUAL
@ SPELL_BOSS_AGGRO
@ SPELL_AWAKEN_VAULT_WALKER
@ SPELL_GROUND_TREMOR
@ SPELL_ARCHAEDAS_AWAKEN
@ SPELL_SELF_DESTRUCT
Says
InstanceScript *const instance
void _JustEngagedWith(Unit *who)
void _JustDied()
virtual void MoveInLineOfSight(Unit *)
Definition: CreatureAI.cpp:122
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
virtual ObjectGuid GetGuidData(uint32 type) const override
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
uint32 const Id
Definition: SpellInfo.h:325
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:10911
void SetFaction(uint32 faction) override
Definition: Unit.h:859
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
bool IsAlive() const
Definition: Unit.h:1164
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
void RemoveAllAuras()
Definition: Unit.cpp:4242
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
virtual void SetGuidData(uint32, ObjectGuid)
Definition: ZoneScript.h:84
CreatureAI * GetAI(Creature *creature) const override
GameObjectAI * GetAI(GameObject *go) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
bool HealthAbovePct(uint32 pct) const
boss_archaedasAI(Creature *creature)
void KilledUnit(Unit *) override
void JustEngagedWith(Unit *who) override
void ActivateMinion(ObjectGuid uiGuid, bool flag)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void UpdateAI(uint32 uiDiff) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
@ BOSS_ARCHAEDAS
Definition: uldaman.h:34
@ DATA_MINIONS
Definition: uldaman.h:45
@ DATA_STONE_KEEPERS
Definition: uldaman.h:44