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 "SpellAuraEffects.h"
30#include "SpellInfo.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;
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
358 }
359
360private:
362};
363
364// 17256 - Hellfire Channeler
366{
367 npc_hellfire_channeler(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript())
368 {
370 }
371
372 void InitializeAI() override
373 {
375 me->SetCorpseDelay(4, true);
377 }
378
379 void JustAppeared() override
380 {
381 _scheduler.Schedule(5s, [this](TaskContext /*task*/)
382 {
384 });
385 }
386
387 void Reset() override
388 {
390 }
391
392 void JustEngagedWith(Unit* /*who*/) override
393 {
395
397
398 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
399 magtheridon->AI()->DoAction(ACTION_START_ENCOUNTER);
400
402 .SetValidator([this]
403 {
405 })
406 .Schedule(20s, 30s, [this](TaskContext task)
407 {
409 task.Repeat(10s, 20s);
410 })
411 .Schedule(15s, 55s, [this](TaskContext task)
412 {
415 task.Repeat(60s, 80s);
416 })
417 .Schedule(1200ms, [this](TaskContext task)
418 {
420 {
421 DoCast(target, SPELL_DARK_MENDING);
422 task.Repeat(10s, 20s);
423 }
424 else
425 task.Repeat(1200ms);
426 })
427 .Schedule(15s, 20s, [this](TaskContext task)
428 {
430 DoCast(target, SPELL_FEAR);
431 task.Repeat(25s, 40s);
432 });
433 }
434
435 void JustSummoned(Creature* summon) override
436 {
437 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
438 magtheridon->AI()->JustSummoned(summon);
439
440 DoZoneInCombat(summon);
441 }
442
443 void SummonedCreatureDespawn(Creature* summon) override
444 {
445 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
446 magtheridon->AI()->SummonedCreatureDespawn(summon);
447 }
448
449 void EnterEvadeMode(EvadeReason /*why*/) override
450 {
452 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
453 magtheridon->AI()->DoAction(ACTION_RESET_ENCOUNTER);
454 }
455
456 void JustDied(Unit* /*killer*/) override
457 {
459
460 // One-shotted channelers need trigger combat event too. It's needed for Cata+
461 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
462 magtheridon->AI()->DoAction(ACTION_START_ENCOUNTER);
463 }
464
465 void UpdateAI(uint32 diff) override
466 {
467 _scheduler.Update(diff);
468
469 if (UpdateVictim())
471 }
472
473private:
476};
477
478// 17516 - Magtheridon's Room
480{
482
483 void InitializeAI() override
484 {
486 }
487
488 void JustAppeared() override
489 {
490 _scheduler.Schedule(0s, [this](TaskContext task)
491 {
492 switch (task.GetRepeatCounter())
493 {
494 case 0:
495 DoCastSelf(SPELL_DEBRIS_VISUAL);
496 task.Repeat(5s);
497 break;
498 case 1:
499 DoCastSelf(SPELL_DEBRIS_DAMAGE);
500 task.Repeat(5s);
501 break;
502 case 2:
503 me->DespawnOrUnsummon();
504 break;
505 default:
506 break;
507 }
508 });
509 }
510
511 void UpdateAI(uint32 diff) override
512 {
513 _scheduler.Update(diff);
514 }
515
516private:
518};
519
520// 30541 - Blaze
546
547// 30576 - Quake
567
568// 30572 - Quake
596
597// 30629 - Debris
623
624// 30420 - Shadow Grasp
626{
628
629 bool Validate(SpellInfo const* /*spellInfo*/) override
630 {
632 }
633
634 void HandleScript(SpellEffIndex /*effIndex*/)
635 {
636 Unit* target = GetHitUnit();
637
639 return;
640
641 target->CastSpell(nullptr, SPELL_SHADOW_GRASP, true);
642 }
643
648};
649
650// 30410 - Shadow Grasp
678
679// 30166 - Shadow Grasp
708
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ FAIL
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
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)
@ REACT_DEFENSIVE
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:249
DamageEffectType
Definition Unit.h:366
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
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToPC(bool apply) override
Definition Creature.h:138
void SetReactState(ReactStates st)
Definition Creature.h:128
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetRegenerateHealth(bool value)
Definition Creature.h:294
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:98
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void CancelEventGroup(GroupIndex group)
Definition EventMap.cpp:165
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
CreatureBoundary const * GetBossBoundary(uint32 id) const
EncounterState GetBossState(uint32 id) const
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoZoneInCombat(uint32 entry=0)
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)
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
virtual void InitializeAI()
Definition UnitAI.cpp:36
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:783
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3116
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4558
void SetEmoteState(Emote emote)
Definition Unit.h:981
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:4542
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3807
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:932
bool AttackStop()
Definition Unit.cpp:5587
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:969
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2083
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_magtheridon_blaze_target)
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)
PrepareSpellScript(spell_magtheridon_debris)
void OnPeriodic(AuraEffect const *)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_magtheridon_quake_initial)
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_magtheridon_quake_target_selector)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_magtheridon_shadow_grasp_cube)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_magtheridon_shadow_grasp_visual)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_magtheridon_shadow_grasp)
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:66
ScriptedAI(Creature *creature)
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