TrinityCore
boss_magmus.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 "blackrock_depths.h"
20#include "InstanceScript.h"
21#include "ScriptedCreature.h"
22
24{
26 SPELL_WARSTOMP = 24375
27};
28
30{
33};
34
36{
38 PHASE_TWO = 2
39};
40
42{
43 public:
44 boss_magmus() : CreatureScript("boss_magmus") { }
45
46 struct boss_magmusAI : public BossAI
47 {
48 boss_magmusAI(Creature* creature) : BossAI(creature, BOSS_MAGMUS) { }
49
50 void JustEngagedWith(Unit* who) override
51 {
55 }
56
57 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
58 {
60 {
63 }
64 }
65
66 void UpdateAI(uint32 diff) override
67 {
68 if (!UpdateVictim())
69 return;
70
71 events.Update(diff);
72
73 while (uint32 eventId = events.ExecuteEvent())
74 {
75 switch (eventId)
76 {
80 break;
81 case EVENT_WARSTOMP:
84 break;
85 default:
86 break;
87 }
88 }
89 }
90
91 void JustDied(Unit* /*killer*/) override
92 {
93 _JustDied();
96 }
97 };
98
99 CreatureAI* GetAI(Creature* creature) const override
100 {
101 return GetBlackrockDepthsAI<boss_magmusAI>(creature);
102 }
103};
104
106{
108 SPELL_GOUTOFFLAME = 15529
110
112{
113public:
114 npc_ironhand_guardian() : CreatureScript("npc_ironhand_guardian") { }
115
117 {
119 {
121 _active = false;
122 }
123
124 void Reset() override
125 {
126 _events.Reset();
127 }
128
129 void UpdateAI(uint32 diff) override
130 {
131 if (!_active)
132 {
134 return;
135 // Once the boss is engaged, the guardians will stay activated until the next instance reset
137 _active = true;
138 }
139
140 _events.Update(diff);
141
142 while (uint32 eventId = _events.ExecuteEvent())
143 {
144 if (eventId == EVENT_GOUTOFFLAME)
145 {
147 _events.Repeat(16s, 21s);
148 }
149 }
150 }
151
152 private:
156 };
157
158 CreatureAI* GetAI(Creature* creature) const override
159 {
160 return GetBlackrockDepthsAI<npc_ironhand_guardianAI>(creature);
161 }
162};
163
165{
166 new boss_magmus();
168}
uint32_t uint32
Definition: Define.h:142
@ NOT_STARTED
Spells
Definition: PlayerAI.cpp:32
DamageEffectType
Definition: UnitDefines.h:131
@ BOSS_MAGMUS
@ DATA_THRONE_DOOR
void AddSC_boss_magmus()
@ SPELL_FIERYBURST
Definition: boss_magmus.cpp:25
@ SPELL_WARSTOMP
Definition: boss_magmus.cpp:26
@ PHASE_ONE
Definition: boss_magmus.cpp:37
@ PHASE_TWO
Definition: boss_magmus.cpp:38
@ EVENT_WARSTOMP
Definition: boss_magmus.cpp:32
@ EVENT_FIERY_BURST
Definition: boss_magmus.cpp:31
IronhandGuardian
@ EVENT_GOUTOFFLAME
@ SPELL_GOUTOFFLAME
InstanceScript *const instance
void _JustEngagedWith(Unit *who)
EventMap events
void _JustDied()
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
void Reset()
Definition: EventMap.cpp:21
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
Definition: Unit.h:627
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
CreatureAI * GetAI(Creature *creature) const override
Definition: boss_magmus.cpp:99
CreatureAI * GetAI(Creature *creature) const override
void JustDied(Unit *) override
Definition: boss_magmus.cpp:91
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
Definition: boss_magmus.cpp:57
boss_magmusAI(Creature *creature)
Definition: boss_magmus.cpp:48
void JustEngagedWith(Unit *who) override
Definition: boss_magmus.cpp:50
void UpdateAI(uint32 diff) override
Definition: boss_magmus.cpp:66