Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_archaedas.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: boss_archaedas
8SD%Complete: 100
9SDComment: Archaedas is activated when 1 person (was 3, changed in 3.0.8) clicks on his altar.
10Every 10 seconds he will awaken one of his minions along the wall.
11At 66%, he will awaken the 6 Guardians.
12At 33%, he will awaken the Vault Walkers
13On his death the vault door opens.
14EndScriptData */
15
16#include "ScriptMgr.h"
17#include "ScriptedCreature.h"
18#include "uldaman.h"
19#include "Player.h"
20
28
40
42{
43public:
44 boss_archaedas() : CreatureScript("boss_archaedas") { }
45
47 {
48 boss_archaedasAI(Creature* creature) : ScriptedAI(creature)
49 {
50 instance = me->GetInstanceScript();
51 }
52
57
61
63 {
64 uiTremorTimer = 60000;
65 iAwakenTimer = 0;
66 uiWallMinionTimer = 10000;
67
68 bWakingUp = false;
69 bGuardiansAwake = false;
70 bVaultWalkersAwake = false;
71
72 if (instance)
73 instance->SetData(0, 5); // respawn any dead minions
74 me->setFaction(35);
77 }
78
79 void ActivateMinion(uint64 uiGuid, bool flag)
80 {
81 Unit* minion = Unit::GetUnit(*me, uiGuid);
82
83 if (minion && minion->IsAlive())
84 {
85 DoCast(minion, SPELL_AWAKEN_VAULT_WALKER, flag);
86 minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN, true);
89 minion->setFaction(14);
90 }
91 }
92
93 void EnterCombat(Unit* /*who*/) OVERRIDE
94 {
95 me->setFaction(14);
98 }
99
100 void SpellHit(Unit* /*caster*/, const SpellInfo* spell) OVERRIDE
101 {
102 // Being woken up from the altar, start the awaken sequence
103 if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
104 {
106 iAwakenTimer = 4000;
107 bWakingUp = true;
108 }
109 }
110
111 void KilledUnit(Unit* /*victim*/) OVERRIDE
112 {
113 Talk(SAY_KILL);
114 }
115
117 {
118 if (!instance)
119 return;
120 // we're still doing awaken animation
121 if (bWakingUp && iAwakenTimer >= 0)
122 {
123 iAwakenTimer -= uiDiff;
124 return; // dont do anything until we are done
125 } else if (bWakingUp && iAwakenTimer <= 0)
126 {
127 bWakingUp = false;
128 AttackStart(Unit::GetUnit(*me, instance->GetData64(0)));
129 return; // dont want to continue until we finish the AttackStart method
130 }
131
132 //Return since we have no target
133 if (!UpdateVictim())
134 return;
135
136 // wake a wall minion
137 if (uiWallMinionTimer <= uiDiff)
138 {
140
141 uiWallMinionTimer = 10000;
142 } else uiWallMinionTimer -= uiDiff;
143
144 //If we are <66 summon the guardians
145 if (!bGuardiansAwake && !HealthAbovePct(66))
146 {
147 ActivateMinion(instance->GetData64(5), true); // EarthenGuardian1
148 ActivateMinion(instance->GetData64(6), true); // EarthenGuardian2
149 ActivateMinion(instance->GetData64(7), true); // EarthenGuardian3
150 ActivateMinion(instance->GetData64(8), true); // EarthenGuardian4
151 ActivateMinion(instance->GetData64(9), true); // EarthenGuardian5
152 ActivateMinion(instance->GetData64(10), false); // EarthenGuardian6
154 bGuardiansAwake = true;
155 }
156
157 //If we are <33 summon the vault walkers
159 {
160 ActivateMinion(instance->GetData64(1), true); // VaultWalker1
161 ActivateMinion(instance->GetData64(2), true); // VaultWalker2
162 ActivateMinion(instance->GetData64(3), true); // VaultWalker3
163 ActivateMinion(instance->GetData64(4), false); // VaultWalker4
165 bVaultWalkersAwake = true;
166 }
167
168 if (uiTremorTimer <= uiDiff)
169 {
170 //Cast
172
173 //45 seconds until we should cast this agian
174 uiTremorTimer = 45000;
175 } else uiTremorTimer -= uiDiff;
176
178 }
179
180 void JustDied (Unit* /*killer*/) OVERRIDE
181 {
182 if (instance)
183 {
184 instance->SetData(DATA_ANCIENT_DOOR, DONE); // open the vault door
185 instance->SetData(DATA_MINIONS, SPECIAL); // deactivate his minions
186 }
187 }
188 };
189
191 {
192 return new boss_archaedasAI(creature);
193 }
194};
195
196/* ScriptData
197SDName: npc_archaedas_minions
198SD%Complete: 100
199SDComment: These mobs are initially frozen until Archaedas awakens them
200one at a time.
201EndScriptData */
202
204{
205public:
206 npc_archaedas_minions() : CreatureScript("npc_archaedas_minions") { }
207
209 {
211 {
212 instance = me->GetInstanceScript();
213 }
214
218
221
223 {
224 uiArcing_Timer = 3000;
225 iAwakenTimer = 0;
226
227 bWakingUp = false;
228 bAmIAwake = false;
229
230 me->setFaction(35);
233 me->RemoveAllAuras();
234 }
235
236 void EnterCombat(Unit* /*who*/) OVERRIDE
237 {
238 me->setFaction (14);
239 me->RemoveAllAuras();
242 bAmIAwake = true;
243 }
244
245 void SpellHit(Unit * /*caster*/, const SpellInfo* spell) OVERRIDE
246 {
247 // time to wake up, start animation
248 if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
249 {
250 iAwakenTimer = 5000;
251 bWakingUp = true;
252 }
253 }
254
256
257 {
258 if (bAmIAwake)
260 }
261
263 {
264 // we're still in the awaken animation
265 if (bWakingUp && iAwakenTimer >= 0)
266 {
267 iAwakenTimer -= uiDiff;
268 return; // dont do anything until we are done
269 } else if (bWakingUp && iAwakenTimer <= 0)
270 {
271 bWakingUp = false;
272 bAmIAwake = true;
273 // AttackStart(Unit::GetUnit(*me, instance->GetData64(0))); // whoWokeArchaedasGUID
274 return; // dont want to continue until we finish the AttackStart method
275 }
276
277 //Return since we have no target
278 if (!UpdateVictim())
279 return;
280
282 }
283 };
284
286 {
287 return new npc_archaedas_minionsAI(creature);
288 }
289};
290
291/* ScriptData
292SDName: npc_stonekeepers
293SD%Complete: 100
294SDComment: After activating the altar of the keepers, the stone keepers will
295wake up one by one.
296EndScriptData */
297
299{
300public:
301 npc_stonekeepers() : CreatureScript("npc_stonekeepers") { }
302
304 {
306 {
307 instance = me->GetInstanceScript();
308 }
309
311
313 {
314 me->setFaction(35);
317 me->RemoveAllAuras();
318 }
319
320 void EnterCombat(Unit* /*who*/) OVERRIDE
321 {
322 me->setFaction(14);
325 }
326
327 void UpdateAI(uint32 /*diff*/) OVERRIDE
328 {
329 //Return since we have no target
330 if (!UpdateVictim())
331 return;
332
334 }
335
336 void JustDied(Unit* /*attacker*/) OVERRIDE
337 {
339 if (instance)
340 instance->SetData(DATA_STONE_KEEPERS, IN_PROGRESS); // activate next stonekeeper
341 }
342 };
343
345 {
346 return new npc_stonekeepersAI(creature);
347 }
348};
349
350/* ScriptData
351SDName: go_altar_archaedas
352SD%Complete: 100
353SDComment: Needs 1 person to activate the Archaedas script
354SDCategory: Uldaman
355EndScriptData */
356
358{
359public:
360 go_altar_of_archaedas() : GameObjectScript("go_altar_of_archaedas") { }
361
363 {
364 InstanceScript* instance = player->GetInstanceScript();
365 if (!instance)
366 return false;
367
368 player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false);
369
370 instance->SetData64(0, player->GetGUID()); // activate archaedas
371 return false;
372 }
373};
374
375//This is the actual function called only once durring InitScripts()
376//It must define all handled functions that are to be run in this script
378{
379 new boss_archaedas();
381 new npc_stonekeepers();
383}
384
std::int32_t int32
Definition Define.h:73
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
@ SPECIAL
#define sSpellMgr
Definition SpellMgr.h:744
@ UNIT_FLAG_DISABLE_MOVE
Definition Unit.h:627
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ UNIT_FIELD_FLAGS
@ SAY_AGGRO
@ SAY_SUMMON_GUARDIANS
@ SAY_KILL
@ SAY_SUMMON_VAULT_WALKERS
void AddSC_boss_archaedas()
@ 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
#define SAY_AGGRO
#define SAY_KILL
virtual void MoveInLineOfSight(Unit *)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
GameObjectScript(const char *name)
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:1280
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
void setFaction(uint32 faction)
Definition Unit.h:1699
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
bool IsAlive() const
Definition Unit.h:2032
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
virtual void SetData64(uint32, uint64)
Definition ZoneScript.h:33
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, GameObject *) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthAbovePct(uint32 pct) const
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void ActivateMinion(uint64 uiGuid, bool flag)
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void SpellHit(Unit *, const SpellInfo *spell) OVERRIDE
void SpellHit(Unit *, const SpellInfo *spell) OVERRIDE
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
@ DATA_ANCIENT_DOOR
Definition uldaman.h:14
@ DATA_MINIONS
Definition uldaman.h:17
@ DATA_STONE_KEEPERS
Definition uldaman.h:16