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#include "ScriptMgr.h"
19#include "GameObject.h"
20#include "GameObjectAI.h"
21#include "InstanceScript.h"
22#include "magtheridons_lair.h"
23#include "PassiveAI.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26#include "SpellAuraEffects.h"
27#include "SpellInfo.h"
28#include "SpellScript.h"
29
43
45{
46 // Magtheridon
48 SPELL_CLEAVE = 30619,
52 SPELL_QUAKE = 30657,
54
55 // Player or Manticron Cube
59
60 // Hellfire Raid Trigger
62
63 // HellFire Channeler
70 SPELL_FEAR = 30530,
71
72 // WorldTrigger
74
75 // Magtheridon Room
78
79 // Target Trigger
80 SPELL_BLAZE = 30542
81};
82
105
113
119
120// 17257 - Magtheridon
122{
124
134
144
155
156 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
157 {
159 {
161
162 if (_channelersCount == 0)
163 CombatStart();
164 }
165 }
166
181
182 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
183 {
184 if (spellInfo->Id == SPELL_SHADOW_CAGE)
186 }
187
188 void DamageTaken(Unit* /*who*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
189 {
190 if (me->HealthBelowPctDamaged(30, damage) && !events.IsInPhase(PHASE_3))
191 {
194 me->AttackStop();
199 }
200 }
201
202 void JustDied(Unit* /*killer*/) override
203 {
205 _JustDied();
207 }
208
209 void KilledUnit(Unit* who) override
210 {
211 if (who->GetTypeId() == TYPEID_PLAYER)
212 Talk(SAY_SLAY);
213 }
214
215 void UpdateAI(uint32 diff) override
216 {
218 return;
219
220 events.Update(diff);
221
223 return;
224
225 while (uint32 eventId = events.ExecuteEvent())
226 {
227 switch (eventId)
228 {
229 case EVENT_BERSERK:
231 break;
232 case EVENT_CLEAVE:
234 events.Repeat(10s);
235 break;
236 case EVENT_BLAZE:
238 events.Repeat(20s);
239 break;
240 case EVENT_QUAKE:
242 events.Repeat(60s);
243 break;
245 CombatStart();
246 break;
247 case EVENT_RELEASED:
249 me->SetImmuneToPC(false);
258 break;
259 case EVENT_COLLAPSE:
262 break;
265 {
266 trigger->CastSpell(trigger, SPELL_DEBRIS_KNOCKDOWN, true);
269 }
270 break;
271 case EVENT_DEBRIS:
273 events.Repeat(20s);
274 break;
277 break;
278 case EVENT_BLAST_NOVA:
281 events.Repeat(55s);
282 break;
283 case EVENT_TAUNT:
285 events.Repeat(4min, 5min);
286 break;
287 default:
288 break;
289 }
290
292 return;
293 }
294
296 }
297
298private:
300};
301
302// 17256 - Hellfire Channeler
304{
305 npc_hellfire_channeler(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()), _canCastDarkMending(true)
306 {
308 }
309
310 void Reset() override
311 {
312 _events.Reset();
315 }
316
317 void JustEngagedWith(Unit* /*who*/) override
318 {
320
321 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
322 magtheridon->AI()->DoAction(ACTION_START_CHANNELERS_EVENT);
323
328
329 }
330
331 void JustDied(Unit* /*killer*/) override
332 {
334
335 // Channelers killed by "Hit Kill" need trigger combat event too. It's needed for Cata+
336 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
337 magtheridon->AI()->DoAction(ACTION_START_CHANNELERS_EVENT);
338 }
339
340 void JustSummoned(Creature* summon) override
341 {
342 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
343 magtheridon->AI()->JustSummoned(summon);
344
345 DoZoneInCombat(summon);
346 }
347
348 void EnterEvadeMode(EvadeReason /*why*/) override
349 {
351 if (Creature* magtheridon = _instance->GetCreature(DATA_MAGTHERIDON))
352 magtheridon->AI()->EnterEvadeMode(EVADE_REASON_OTHER);
353 }
354
355 void UpdateAI(uint32 diff) override
356 {
357 if (!UpdateVictim())
358 return;
359
361 return;
362
363 _events.Update(diff);
364
365 while (uint32 eventId = _events.ExecuteEvent())
366 {
367 switch (eventId)
368 {
369 case EVENT_SHADOWBOLT:
371 _events.Repeat(15s, 20s);
372 break;
373 case EVENT_FEAR:
375 DoCast(target, SPELL_FEAR);
376 _events.Repeat(25s, 40s);
377 break;
380 {
382 {
383 DoCast(target, SPELL_DARK_MENDING);
384 _canCastDarkMending = false;
386 }
387 }
388 _events.Repeat(1s);
389 break;
391 _canCastDarkMending = true;
392 break;
393 case EVENT_ABYSSAL:
395 _events.Repeat(60s);
396 break;
397 default:
398 break;
399 }
400
402 return;
403 }
404
406 }
407
408private:
412};
413
414// 17516 - Magtheridon's Room
416{
417 npc_magtheridon_room(Creature* creature) : PassiveAI(creature) { }
418
419 void Reset() override
420 {
422
423 _scheduler.Schedule(5s, [this](TaskContext /*context*/)
424 {
426 });
427 }
428
429 void UpdateAI(uint32 diff) override
430 {
431 _scheduler.Update(diff);
432 }
433
434private:
436};
437
438// 181713 - Manticron Cube
440{
442
443 bool OnGossipHello(Player* player) override
444 {
446 return true;
447
448 if (Creature* trigger = player->FindNearestCreature(NPC_HELFIRE_RAID_TRIGGER, 10.0f))
449 trigger->CastSpell(nullptr, SPELL_SHADOW_GRASP_VISUAL);
450
451 player->CastSpell(nullptr, SPELL_SHADOW_GRASP, true);
452 return true;
453 }
454};
455
456// 30541 - Blaze
458{
460
461 bool Validate(SpellInfo const* /*spell*/) override
462 {
463 return ValidateSpellInfo({ SPELL_BLAZE });
464 }
465
467 {
469 }
470
475};
476
477// 30410 - Shadow Grasp
479{
481
482 bool Validate(SpellInfo const* /*spell*/) override
483 {
485 }
486
487 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
488 {
490 if (Unit* caster = GetCaster())
491 caster->CastSpell(caster, SPELL_MIND_EXHAUSTION, true);
492 }
493
498};
499
500// 30166 - Shadow Grasp (Visual Effect)
533
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
@ SPELLVALUE_MAX_TARGETS
#define AuraEffectApplyFn(F, I, N, M)
#define SpellHitFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
@ REACT_DEFENSIVE
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
MagtheridonSpells
@ SPELL_SHADOW_BOLT_VOLLEY
@ SPELL_DEBRIS_SERVERSIDE
@ SPELL_DEBRIS_KNOCKDOWN
@ SPELL_CLEAVE
@ SPELL_SHADOW_CAGE
@ SPELL_QUAKE
@ SPELL_SHADOW_GRASP
@ SPELL_SHADOW_GRASP_C
@ SPELL_DARK_MENDING
@ SPELL_SOUL_TRANSFER
@ SPELL_FEAR
@ SPELL_BLAZE_TARGET
@ SPELL_DEBRIS_DAMAGE
@ SPELL_SHADOW_GRASP_VISUAL
@ SPELL_CAMERA_SHAKE
@ SPELL_SHADOW_CAGE_C
@ SPELL_BURNING_ABYSSAL
@ SPELL_MIND_EXHAUSTION
@ SPELL_DEBRIS_VISUAL
@ 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_BANISH
MagtheridonEvents
@ EVENT_SHADOWBOLT
@ EVENT_START_FIGHT
@ EVENT_RELEASED
@ EVENT_BLAZE
@ EVENT_TAUNT
@ EVENT_DEBRIS
@ EVENT_ABYSSAL
@ EVENT_DARK_MENDING
@ EVENT_NEARLY_EMOTE
@ EVENT_BERSERK
@ EVENT_FEAR
@ EVENT_BLAST_NOVA
@ EVENT_CHECK_FRIEND
@ EVENT_CLEAVE
@ EVENT_QUAKE
@ EVENT_DEBRIS_KNOCKDOWN
@ EVENT_COLLAPSE
void AddSC_boss_magtheridon()
MagtheridonMisc
@ ACTION_START_CHANNELERS_EVENT
@ SUMMON_GROUP_CHANNELERS
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetCaster() const
Unit * GetTarget() const
InstanceScript *const instance
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
@ EVADE_REASON_OTHER
Definition CreatureAI.h:98
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:129
void SetReactState(ReactStates st)
Definition Creature.h:119
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 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
HookList< HitHandler > OnHit
Unit * GetHitUnit() const
void DoZoneInCombat(uint32 entry=0)
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
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:769
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:4519
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
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
bool AttackStop()
Definition Unit.cpp:5645
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2099
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
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
PrepareAuraScript(spell_magtheridon_shadow_grasp_visual)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_magtheridon_shadow_grasp)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
@ NPC_HELLFIRE_CHANNELLER
@ NPC_HELFIRE_RAID_TRIGGER
@ DATA_CALL_WARDERS
@ DATA_COLLAPSE
@ DATA_COLLAPSE_2
@ DATA_MANTICRON_CUBE
@ DATA_MAGTHERIDON
#define RegisterMagtheridonsLairCreatureAI(ai_name)
@ ACTION_ENABLE
@ ACTION_DISABLE
#define RegisterMagtheridonsLairGameObjectAI(ai_name)
Unit * DoSelectBelowHpPctFriendlyWithEntry(uint32 entry, float range, uint8 hpPct=1, bool excludeSelf=true)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void Reset() 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 SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void JustDied(Unit *) override
void SummonedCreatureDies(Creature *summon, Unit *) override
bool OnGossipHello(Player *player) override
go_manticron_cube(GameObject *go)
npc_hellfire_channeler(Creature *creature)
void JustEngagedWith(Unit *) override
void JustSummoned(Creature *summon) override
void EnterEvadeMode(EvadeReason) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
npc_magtheridon_room(Creature *creature)
@ DATA_WORLD_TRIGGER