TrinityCore
Loading...
Searching...
No Matches
boss_magtheridon.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 * Spell 30657 has tricky implementation, requires to be investigated and scripted
21 * Spell 30410 deals no periodic damage
22 */
23
24#include "ScriptMgr.h"
25#include "Containers.h"
26#include "InstanceScript.h"
27#include "magtheridons_lair.h"
28#include "ScriptedCreature.h"
29#include "SpellInfo.h"
30#include "TemporarySummon.h"
31#include "SpellScript.h"
32
46
48{
49 // Magtheridon - Initial
51
52 // Magtheridon - Combat - Phase 2, 3
53 SPELL_CLEAVE = 30619,
54 SPELL_BLAZE = 30541,
55 SPELL_QUAKE = 30576,
58
59 // Magtheridon - Collapse
61
62 // Magtheridon - Combat - Phase 3
63 SPELL_DEBRIS = 30629,
64
65 // Hellfire Channeler
70 SPELL_FEAR = 30530,
72
73 // World Trigger (Not Immune PC)
75
76 // Magtheridon's Room
79
80 // Scripts
89 SPELL_SHADOW_CAGE = 30168
90};
91
121
126
134
141
142// 17257 - Magtheridon
144{
146
158
169
170 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
171 {
173 {
175
176 if (_channelersCount == 0)
177 {
180 }
181 }
182 }
183
203
204 void OnSpellStart(SpellInfo const* spellInfo) override
205 {
206 if (spellInfo->Id == SPELL_BLAST_NOVA)
208 }
209
210 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
211 {
212 if (spellInfo->Id == SPELL_SHADOW_CAGE)
214 }
215
216 void DamageTaken(Unit* /*who*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
217 {
219 {
222 }
223 }
224
225 void EnterEvadeMode(EvadeReason /*why*/) override
226 {
228 }
229
230 void KilledUnit(Unit* who) override
231 {
232 if (who->GetTypeId() == TYPEID_PLAYER)
233 Talk(SAY_SLAY);
234 }
235
236 void JustDied(Unit* /*killer*/) override
237 {
239 _JustDied();
241 }
242
243 void UpdateAI(uint32 diff) override
244 {
246 return;
247
248 events.Update(diff);
249
251 return;
252
253 while (uint32 eventId = events.ExecuteEvent())
254 {
255 switch (eventId)
256 {
257 // Out of Combat
258 case EVENT_TAUNT:
260 events.Repeat(4min, 5min);
261 break;
262
263 // Phase 1
271 break;
275 break;
279 me->SetUninteractible(false);
280 me->SetImmuneToPC(false);
283 Talk(SAY_FREE);
287 break;
290 break;
291
292 // Phase 2, 3: Combat
293 case EVENT_CLEAVE:
295 events.Repeat(8s, 10s);
296 break;
297 case EVENT_BLAZE:
299 events.Repeat(20s);
300 break;
301 case EVENT_QUAKE:
303 events.Repeat(60s);
304 break;
305 case EVENT_BLAST_NOVA:
307 events.Repeat(55s);
308 break;
309 case EVENT_BERSERK:
311 break;
312
313 // Phase 3: Collapse
314 case EVENT_COLLAPSE_1:
317 me->AttackStop();
320 break;
321 case EVENT_COLLAPSE_2:
325 break;
326 case EVENT_COLLAPSE_3:
329 break;
330 case EVENT_COLLAPSE_4:
333 break;
334 case EVENT_COLLAPSE_5:
336 trigger->CastSpell(trigger, SPELL_DEBRIS_KNOCKDOWN, true);
338 break;
339 case EVENT_COLLAPSE_6:
342 break;
343
344 // Phase 3: Combat
345 case EVENT_DEBRIS:
347 events.Repeat(20s);
348 break;
349 default:
350 break;
351 }
352
354 return;
355 }
356 }
357
358private:
360};
361
362// 17256 - Hellfire Channeler
364{
365 npc_hellfire_channeler(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript())
366 {
368 }
369
370 void InitializeAI() override
371 {
373 me->SetCorpseDelay(4, true);
375 }
376
377 void JustAppeared() override
378 {
379 _scheduler.Schedule(5s, [this](TaskContext const& /*task*/)
380 {
382 });
383 }
384
385 void Reset() override
386 {
388 }
389
390 void JustEngagedWith(Unit* /*who*/) override
391 {
393
395
396 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
397 magtheridon->AI()->DoAction(ACTION_START_ENCOUNTER);
398
400 .SetValidator([this]
401 {
403 })
404 .Schedule(20s, 30s, [this](TaskContext& task)
405 {
407 task.Repeat(10s, 20s);
408 })
409 .Schedule(15s, 55s, [this](TaskContext& task)
410 {
413 task.Repeat(60s, 80s);
414 })
415 .Schedule(1200ms, [this](TaskContext& task)
416 {
418 {
419 DoCast(target, SPELL_DARK_MENDING);
420 task.Repeat(10s, 20s);
421 }
422 else
423 task.Repeat(1200ms);
424 })
425 .Schedule(15s, 20s, [this](TaskContext& task)
426 {
428 DoCast(target, SPELL_FEAR);
429 task.Repeat(25s, 40s);
430 });
431 }
432
433 void JustSummoned(Creature* summon) override
434 {
435 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
436 magtheridon->AI()->JustSummoned(summon);
437
438 DoZoneInCombat(summon);
439 }
440
441 void SummonedCreatureDespawn(Creature* summon) override
442 {
443 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
444 magtheridon->AI()->SummonedCreatureDespawn(summon);
445 }
446
447 void EnterEvadeMode(EvadeReason /*why*/) override
448 {
450 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
451 magtheridon->AI()->DoAction(ACTION_RESET_ENCOUNTER);
452 }
453
454 void JustDied(Unit* /*killer*/) override
455 {
457
458 // One-shotted channelers need trigger combat event too. It's needed for Cata+
459 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
460 magtheridon->AI()->DoAction(ACTION_START_ENCOUNTER);
461 }
462
463 void UpdateAI(uint32 diff) override
464 {
465 _scheduler.Update(diff);
466
467 UpdateVictim();
468 }
469
470private:
473};
474
475// 17516 - Magtheridon's Room
477{
479
480 void InitializeAI() override
481 {
483 }
484
485 void JustAppeared() override
486 {
487 _scheduler.Schedule(0s, [this](TaskContext& task)
488 {
489 switch (task.GetRepeatCounter())
490 {
491 case 0:
492 DoCastSelf(SPELL_DEBRIS_VISUAL);
493 task.Repeat(5s);
494 break;
495 case 1:
496 DoCastSelf(SPELL_DEBRIS_DAMAGE);
497 task.Repeat(5s);
498 break;
499 case 2:
500 me->DespawnOrUnsummon();
501 break;
502 default:
503 break;
504 }
505 });
506 }
507
508 void UpdateAI(uint32 diff) override
509 {
510 _scheduler.Update(diff);
511 }
512
513private:
515};
516
517// 30541 - Blaze
541
542// 30576 - Quake
560
561// 30572 - Quake
587
588// 30629 - Debris
612
613// 30420 - Shadow Grasp
615{
616 bool Validate(SpellInfo const* /*spellInfo*/) override
617 {
619 }
620
621 void HandleScript(SpellEffIndex /*effIndex*/)
622 {
623 Unit* target = GetHitUnit();
624
626 return;
627
628 target->CastSpell(nullptr, SPELL_SHADOW_GRASP, true);
629 }
630
635};
636
637// 30410 - Shadow Grasp
663
664// 30166 - Shadow Grasp
691
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ FAIL
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENTRY
@ EMOTE_STATE_TALK
@ EMOTE_ONESHOT_NONE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ REACT_DEFENSIVE
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
MagtheridonEventGroups
@ EVENT_GROUP_BREAK_FREE
MagtheridonSpells
@ SPELL_SHADOW_GRASP_CHANNELER
@ SPELL_SHADOW_BOLT_VOLLEY
@ SPELL_DEBRIS_KNOCKDOWN
@ SPELL_CLEAVE
@ SPELL_SHADOW_CAGE
@ SPELL_QUAKE
@ SPELL_SHADOW_GRASP
@ SPELL_DARK_MENDING
@ SPELL_SOUL_TRANSFER
@ SPELL_FEAR
@ SPELL_QUAKE_TARGET_SELECTOR
@ SPELL_QUAKE_KNOCK_BACK
@ SPELL_DEBRIS_DAMAGE
@ SPELL_DEBRIS
@ SPELL_BLAZE_SUMMON
@ SPELL_SHADOW_GRASP_VISUAL
@ SPELL_SHADOW_CAGE_DUMMY
@ SPELL_CAMERA_SHAKE
@ SPELL_BURNING_ABYSSAL
@ SPELL_MIND_EXHAUSTION
@ SPELL_DEBRIS_VISUAL
@ SPELL_QUAKE_PERIODIC
@ SPELL_DEBRIS_SUMMON
@ SPELL_BLAST_NOVA
@ SPELL_BERSERK
@ SPELL_BLAZE
MagtheridonTexts
@ SAY_DEATH
@ EMOTE_BLAST_NOVA
@ SAY_FREE
@ SAY_BANISHED
@ EMOTE_NEARLY_FREE
@ EMOTE_BREAKS_FREE
@ SAY_SLAY
@ SAY_TAUNT
@ EMOTE_WEAKEN
@ SAY_COLLAPSE
MagtheridonPhases
@ PHASE_0_BANISHED
@ PHASE_2_BREAKS_FREE
@ PHASE_3_COLLAPSE
@ PHASE_1_CHANNELERS
MagtheridonEvents
@ EVENT_BREAK_FREE_4
@ EVENT_BLAZE
@ EVENT_COLLAPSE_6
@ EVENT_BREAK_FREE_3
@ EVENT_COLLAPSE_5
@ EVENT_COLLAPSE_3
@ EVENT_TAUNT
@ EVENT_BREAK_FREE_2
@ EVENT_DEBRIS
@ EVENT_COLLAPSE_2
@ EVENT_COLLAPSE_4
@ EVENT_BREAK_FREE_1
@ EVENT_BERSERK
@ EVENT_BLAST_NOVA
@ EVENT_CLEAVE
@ EVENT_QUAKE
@ EVENT_COLLAPSE_1
void AddSC_boss_magtheridon()
MagtheridonMisc
@ ACTION_RESET_ENCOUNTER
@ ACTION_START_ENCOUNTER
@ SUMMON_GROUP_CHANNELERS
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetCaster() const
Unit * GetTarget() const
uint32 GetId() const
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
Creature *const me
Definition CreatureAI.h:63
void SetImmuneToPC(bool apply) override
Definition Creature.h:190
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetRegenerateHealth(bool value)
Definition Creature.h:381
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:118
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:246
void CancelEvent(EventId eventId)
Definition EventMap.cpp:156
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:32
void CancelEventGroup(GroupIndex group)
Definition EventMap.cpp:178
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
CreatureBoundary const * GetBossBoundary(uint32 id) const
EncounterState GetBossState(uint32 id) const
uint32 GetEntry() const
Definition Object.h:89
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoZoneInCombat(uint32 entry=0)
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 & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void InitializeAI()
Definition UnitAI.cpp:35
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3253
void SetUninteractible(bool apply)
Definition Unit.cpp:8583
void SetEmoteState(Emote emote)
Definition Unit.h:880
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:4806
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
bool AttackStop()
Definition Unit.cpp:5984
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:1512
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
void HandleScript(SpellEffIndex)
void OnPeriodic(AuraEffect const *)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
@ NPC_HELLFIRE_CHANNELLER
@ DATA_CALL_WARDERS
@ DATA_COLLAPSE_1
@ DATA_COLLAPSE_2
@ DATA_MANTICRON_CUBE
@ DATA_MAGTHERIDON
#define RegisterMagtheridonsLairCreatureAI(ai_name)
@ ACTION_ENABLE
@ ACTION_DISABLE
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:67
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
Unit * DoSelectBelowHpPctFriendlyWithEntry(uint32 entry, float range, uint8 hpPct=1, bool excludeSelf=true)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void DoAction(int32 action) override
boss_magtheridon(Creature *creature)
void EnterEvadeMode(EvadeReason) override
void KilledUnit(Unit *who) override
void UpdateAI(uint32 diff) override
void OnSpellStart(SpellInfo const *spellInfo) override
void JustEngagedWith(Unit *who) override
void JustAppeared() override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void JustDied(Unit *) override
void SummonedCreatureDies(Creature *summon, Unit *) override
npc_hellfire_channeler(Creature *creature)
void JustEngagedWith(Unit *) override
void JustSummoned(Creature *summon) override
void EnterEvadeMode(EvadeReason) override
void SummonedCreatureDespawn(Creature *summon) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void InitializeAI() override
void JustAppeared() override
@ DATA_WORLD_TRIGGER