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
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
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:
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
244 }
245
246private:
249};
250
251// 7077 - Earthen Hallshaper
252// 7309 - Earthen Custodian
254{
256
257 void Reset() override
258 {
260 me->SetImmuneToAll(true);
262 }
263
264 void JustEngagedWith(Unit* /*who*/) override
265 {
267 {
268 _scheduler.Schedule(15s, 25s, [this](TaskContext task)
269 {
271 task.Repeat(30s, 45s);
272 });
273 }
274 }
275
276 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
277 {
278 switch (spellInfo->Id)
279 {
283 break;
285 _scheduler.Schedule(3s, [this](TaskContext task)
286 {
287 switch (task.GetRepeatCounter())
288 {
289 case 0:
290 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
291 task.Repeat(4s);
292 break;
293 case 1:
294 me->RemoveAurasDueToSpell(SPELL_STONED);
295 me->RemoveUnitFlag(UNIT_FLAG_UNINTERACTIBLE);
296 me->SetImmuneToAll(false);
297 DoZoneInCombat();
298 break;
299 default:
300 break;
301 }
302 });
303 break;
304 default:
305 break;
306 }
307 }
308
309 void UpdateAI(uint32 diff) override
310 {
311 _scheduler.Update(diff);
312
313 if (UpdateVictim())
315 }
316
317private:
319};
320
321// 7076 - Earthen Guardian
323{
324 npc_earthen_guardian(Creature* creature) : ScriptedAI(creature) { }
325
326 void Reset() override
327 {
329 me->SetImmuneToAll(true);
331 }
332
333 void JustEngagedWith(Unit* /*who*/) override
334 {
335 _scheduler.Schedule(15s, 25s, [this](TaskContext task)
336 {
338 task.Repeat(15s, 25s);
339 });
340 }
341
342 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
343 {
344 switch (spellInfo->Id)
345 {
349 break;
351 _scheduler.Schedule(7s, [this](TaskContext task)
352 {
353 switch (task.GetRepeatCounter())
354 {
355 case 0:
356 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
357 task.Repeat(4s);
358 break;
359 case 1:
360 me->RemoveAurasDueToSpell(SPELL_STONED);
361 me->RemoveUnitFlag(UNIT_FLAG_UNINTERACTIBLE);
362 me->SetImmuneToAll(false);
363 DoZoneInCombat();
364 break;
365 default:
366 break;
367 }
368 });
369 break;
370 default:
371 break;
372 }
373 }
374
375 void UpdateAI(uint32 diff) override
376 {
377 _scheduler.Update(diff);
378
379 if (UpdateVictim())
381 }
382
383private:
385};
386
387// 10120 - Vault Warder
389{
390 npc_vault_warder(Creature* creature) : ScriptedAI(creature) { }
391
392 void Reset() override
393 {
395
396 if (me->HasStringId("VaultWarderOutside"))
397 return;
398
400 me->SetImmuneToAll(true);
401 }
402
403 void JustEngagedWith(Unit* /*who*/) override
404 {
405 _scheduler.Schedule(10s, 15s, [this](TaskContext task)
406 {
408 task.Repeat(10s, 15s);
409 });
410 }
411
412 void DoAction(int32 action) override
413 {
414 if (action == ACTION_ACTIVATE_VAULT_WARDERS && me->IsAlive())
415 {
416 _scheduler.Schedule(5s, [this](TaskContext task)
417 {
418 switch (task.GetRepeatCounter())
419 {
420 case 0:
421 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
422 task.Repeat(5s);
423 break;
424 case 1:
425 me->SetFaction(FACTION_TITAN_3);
426 me->RemoveUnitFlag(UNIT_FLAG_UNINTERACTIBLE);
427 me->SetImmuneToAll(false);
428 break;
429 default:
430 break;
431 }
432 });
433 }
434 }
435
436 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
437 {
438 switch (spellInfo->Id)
439 {
443 break;
445 if (me->HasStringId("VaultWarderOutside"))
446 return;
447
448 _scheduler.Schedule(2s, [this](TaskContext task)
449 {
450 switch (task.GetRepeatCounter())
451 {
452 case 0:
453 DoCastSelf(SPELL_STONE_DWARF_AWAKEN_VISUAL);
454 task.Repeat(4s);
455 break;
456 case 1:
457 me->SetFaction(FACTION_TITAN);
458 me->RemoveAurasDueToSpell(SPELL_STONED);
459 me->RemoveUnitFlag(UNIT_FLAG_UNINTERACTIBLE);
460 me->SetImmuneToAll(false);
461 DoZoneInCombat();
462 break;
463 default:
464 break;
465 }
466 });
467 break;
468 default:
469 break;
470 }
471 }
472
473 void UpdateAI(uint32 diff) override
474 {
475 _scheduler.Update(diff);
476
477 if (UpdateVictim())
479 }
480
481private:
483};
484
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ FAIL
void GetCreatureListWithOptionsInGrid(Container &container, WorldObject *source, float maxSearchRange, FindCreatureOptions const &options)
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
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(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool HasStringId(std::string_view id) const
void SetImmuneToAll(bool apply) override
Definition Creature.h:126
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual bool SetBossState(uint32 id, EncounterState state)
uint32 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Definition Unit.h:769
bool IsAlive() const
Definition Unit.h:1234
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
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:66
@ DATA_ARCHAEDAS
Definition uldaman.h:32
#define RegisterUldamanCreatureAI(ai_name)
Definition uldaman.h:81
@ NPC_EARTHEN_HALLSHAPER
Definition uldaman.h:43