TrinityCore
Loading...
Searching...
No Matches
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/*
19 * Combat timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "InstanceScript.h"
24#include "ScriptedCreature.h"
25#include "SpellInfo.h"
26#include "uldaman.h"
27
36
38{
39 // Archaedas - Intro
42
43 // Archaedas - Combat
49
50 // Minions - Shared
51 SPELL_STONED = 10255,
54
55 // Earthen Hallshaper
57
58 // Earthen Guardian
60
61 // Vault Warder
62 SPELL_TRAMPLE = 5568
63};
64
77
84
90
91// 2748 - Archaedas
92struct boss_archaedas : public BossAI
93{
95
96 void JustAppeared() override
97 {
98 me->SetUninteractible(true);
99 me->SetImmuneToAll(true);
101 }
102
103 void Reset() override
104 {
105 _Reset();
107 _introStarted = false;
108 }
109
110 void JustEngagedWith(Unit* who) override
111 {
113
116
117 std::vector<Creature*> vaultWarders;
118 GetCreatureListWithOptionsInGrid(vaultWarders, me, 100.0f, { .StringId = "VaultWarderOutside" });
119 for (Creature* vaultWarder : vaultWarders)
120 vaultWarder->AI()->DoAction(ACTION_ACTIVATE_VAULT_WARDERS);
121 }
122
123 void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
124 {
125 if (_phase < PHASE_HEALTH_66 && me->HealthBelowPctDamaged(66, damage))
126 {
127 _phase++;
129 }
130
131 if (_phase < PHASE_HEALTH_33 && me->HealthBelowPctDamaged(33, damage))
132 {
133 _phase++;
135 }
136 }
137
138 void DoAction(int32 action) override
139 {
140 if (action == ACTION_ARCHAEDAS_AWAKEN && me->IsAlive() && !_introStarted)
142 }
143
144 void JustReachedHome() override
145 {
147 me->SetUninteractible(true);
148 me->SetImmuneToAll(true);
150 }
151
157
158 void KilledUnit(Unit* /*victim*/) override
159 {
160 Talk(SAY_SLAY);
161 }
162
163 void JustDied(Unit* /*killer*/) override
164 {
165 _JustDied();
167 }
168
170 {
171 events.Update(diff);
172
173 while (uint32 eventId = events.ExecuteEvent())
174 {
175 switch (eventId)
176 {
177 case EVENT_INTRO_1:
178 _introStarted = true;
181 break;
182 case EVENT_INTRO_2:
185 break;
186 case EVENT_INTRO_3:
190 break;
191 case EVENT_INTRO_4:
192 me->SetUninteractible(false);
193 me->SetImmuneToAll(false);
195 break;
196 default:
197 break;
198 }
199 }
200 }
201
202 void UpdateAI(uint32 diff) override
203 {
204 if (!UpdateVictim())
205 {
207 return;
208 }
209
210 events.Update(diff);
211
213 return;
214
215 while (uint32 eventId = events.ExecuteEvent())
216 {
217 switch (eventId)
218 {
221 events.Repeat(20s, 30s);
222 break;
225 events.Repeat(10s);
226 break;
230 break;
234 break;
235 default:
236 break;
237 }
238
240 return;
241 }
242 }
243
244private:
247};
248
249// 7077 - Earthen Hallshaper
250// 7309 - Earthen Custodian
252{
254
255 void Reset() override
256 {
257 me->SetUninteractible(true);
258 me->SetImmuneToAll(true);
260 }
261
262 void JustEngagedWith(Unit* /*who*/) override
263 {
265 {
266 _scheduler.Schedule(15s, 25s, [this](TaskContext& task)
267 {
269 task.Repeat(30s, 45s);
270 });
271 }
272 }
273
274 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
275 {
276 switch (spellInfo->Id)
277 {
281 break;
283 _scheduler.Schedule(3s, [this](TaskContext& task)
284 {
285 switch (task.GetRepeatCounter())
286 {
287 case 0:
288 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
289 task.Repeat(4s);
290 break;
291 case 1:
292 me->RemoveAurasDueToSpell(SPELL_STONED);
293 me->SetUninteractible(false);
294 me->SetImmuneToAll(false);
295 DoZoneInCombat();
296 break;
297 default:
298 break;
299 }
300 });
301 break;
302 default:
303 break;
304 }
305 }
306
307 void UpdateAI(uint32 diff) override
308 {
309 _scheduler.Update(diff);
310
311 UpdateVictim();
312 }
313
314private:
316};
317
318// 7076 - Earthen Guardian
320{
321 npc_earthen_guardian(Creature* creature) : ScriptedAI(creature) { }
322
323 void Reset() override
324 {
325 me->SetUninteractible(true);
326 me->SetImmuneToAll(true);
328 }
329
330 void JustEngagedWith(Unit* /*who*/) override
331 {
332 _scheduler.Schedule(15s, 25s, [this](TaskContext& task)
333 {
335 task.Repeat(15s, 25s);
336 });
337 }
338
339 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
340 {
341 switch (spellInfo->Id)
342 {
346 break;
348 _scheduler.Schedule(7s, [this](TaskContext& task)
349 {
350 switch (task.GetRepeatCounter())
351 {
352 case 0:
353 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
354 task.Repeat(4s);
355 break;
356 case 1:
357 me->RemoveAurasDueToSpell(SPELL_STONED);
358 me->SetUninteractible(false);
359 me->SetImmuneToAll(false);
360 DoZoneInCombat();
361 break;
362 default:
363 break;
364 }
365 });
366 break;
367 default:
368 break;
369 }
370 }
371
372 void UpdateAI(uint32 diff) override
373 {
374 _scheduler.Update(diff);
375
376 UpdateVictim();
377 }
378
379private:
381};
382
383// 10120 - Vault Warder
385{
386 npc_vault_warder(Creature* creature) : ScriptedAI(creature) { }
387
388 void Reset() override
389 {
391
392 if (me->HasStringId("VaultWarderOutside"))
393 return;
394
395 me->SetUninteractible(true);
396 me->SetImmuneToAll(true);
397 }
398
399 void JustEngagedWith(Unit* /*who*/) override
400 {
401 _scheduler.Schedule(10s, 15s, [this](TaskContext& task)
402 {
404 task.Repeat(10s, 15s);
405 });
406 }
407
408 void DoAction(int32 action) override
409 {
410 if (action == ACTION_ACTIVATE_VAULT_WARDERS && me->IsAlive())
411 {
412 _scheduler.Schedule(5s, [this](TaskContext& task)
413 {
414 switch (task.GetRepeatCounter())
415 {
416 case 0:
417 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
418 task.Repeat(5s);
419 break;
420 case 1:
421 me->SetFaction(FACTION_TITAN_3);
422 me->SetUninteractible(false);
423 me->SetImmuneToAll(false);
424 break;
425 default:
426 break;
427 }
428 });
429 }
430 }
431
432 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
433 {
434 switch (spellInfo->Id)
435 {
439 break;
441 if (me->HasStringId("VaultWarderOutside"))
442 return;
443
444 _scheduler.Schedule(2s, [this](TaskContext& task)
445 {
446 switch (task.GetRepeatCounter())
447 {
448 case 0:
449 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
450 task.Repeat(4s);
451 break;
452 case 1:
453 me->SetFaction(FACTION_TITAN);
454 me->RemoveAurasDueToSpell(SPELL_STONED);
455 me->SetUninteractible(false);
456 me->SetImmuneToAll(false);
457 DoZoneInCombat();
458 break;
459 default:
460 break;
461 }
462 });
463 break;
464 default:
465 break;
466 }
467 }
468
469 void UpdateAI(uint32 diff) override
470 {
471 _scheduler.Update(diff);
472
473 UpdateVictim();
474 }
475
476private:
478};
479
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ FAIL
void GetCreatureListWithOptionsInGrid(Container &container, WorldObject *source, float maxSearchRange, FindCreatureOptions const &options)
EvadeReason
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
void AddSC_boss_archaedas()
ArchaedasEvents
@ EVENT_INTRO_4
@ EVENT_INTRO_1
@ EVENT_INTRO_2
@ EVENT_AWAKEN_WALKERS
@ EVENT_GROUND_TREMOR
@ EVENT_AWAKEN_DWARF
@ EVENT_AWAKEN_GUARDIANS
@ EVENT_INTRO_3
ArchaedasSpells
@ SPELL_TRAMPLE
@ SPELL_FREEZE_ANIM
@ SPELL_RECONSTRUCT
@ SPELL_AWAKEN_DWARF
@ SPELL_STONE_DWARF_AWAKEN_VISUAL
@ SPELL_AWAKEN_WALKERS
@ SPELL_AWAKEN_GUARDIANS
@ SPELL_GROUND_TREMOR
@ SPELL_EARTHEN_GUARDS_DESTROYED
@ SPELL_DESTROY_EARTHEN_GUARDS
@ SPELL_WHIRLWIND
@ SPELL_ARCHAEDAS_AWAKEN
@ SPELL_STONED
ArchaedasMisc
@ FACTION_TITAN_3
@ ACTION_ACTIVATE_VAULT_WARDERS
ArchaedasPhases
@ PHASE_NONE
@ PHASE_HEALTH_66
@ PHASE_HEALTH_33
ArchaedasTexts
@ EMOTE_AWAKEN
@ SAY_AGGRO
@ SAY_SUMMON_1
@ SAY_SUMMON_2
@ SAY_SLAY
InstanceScript *const instance
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool HasStringId(std::string_view id) const
void SetImmuneToAll(bool apply) override
Definition Creature.h:187
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
virtual bool SetBossState(uint32 id, EncounterState state)
uint32 GetEntry() const
Definition Object.h:89
uint32 const Id
Definition SpellInfo.h:328
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Definition Unit.h:647
bool IsAlive() const
Definition Unit.h:1205
void SetUninteractible(bool apply)
Definition Unit.cpp:8583
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
void JustReachedHome() override
void JustDied(Unit *) override
boss_archaedas(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void DoAction(int32 action) override
void EnterEvadeMode(EvadeReason why) override
void JustEngagedWith(Unit *who) override
void UpdateOutOfCombatEvents(uint32 diff)
void Reset() override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *) override
void JustAppeared() override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
npc_earthen_guardian(Creature *creature)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
npc_earthen_hallshaper_custodian(Creature *creature)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void DoAction(int32 action) override
void Reset() override
void UpdateAI(uint32 diff) override
TaskScheduler _scheduler
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
npc_vault_warder(Creature *creature)
void JustEngagedWith(Unit *) override
@ ACTION_ARCHAEDAS_AWAKEN
Definition uldaman.h:78
@ DATA_ARCHAEDAS
Definition uldaman.h:36
#define RegisterUldamanCreatureAI(ai_name)
Definition uldaman.h:93
@ NPC_EARTHEN_HALLSHAPER
Definition uldaman.h:55