TrinityCore
Loading...
Searching...
No Matches
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
34
36{
38 PHASE_TWO = 2
39};
40
42{
43 public:
44 boss_magmus() : CreatureScript("boss_magmus") { }
45
46 struct boss_magmusAI : public ScriptedAI
47 {
48 boss_magmusAI(Creature* creature) : ScriptedAI(creature) { }
49
50 void Reset() override
51 {
52 _events.Reset();
53 }
54
55 void JustEngagedWith(Unit* /*who*/) override
56 {
57 if (InstanceScript* instance = me->GetInstanceScript())
58 instance->SetData(TYPE_IRON_HALL, IN_PROGRESS);
61 }
62
63 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
64 {
66 {
69 }
70 }
71
72 void UpdateAI(uint32 diff) override
73 {
74 if (!UpdateVictim())
75 return;
76
77 _events.Update(diff);
78
79 while (uint32 eventId = _events.ExecuteEvent())
80 {
81 switch (eventId)
82 {
86 break;
87 case EVENT_WARSTOMP:
90 break;
91 default:
92 break;
93 }
94 }
95
97 }
98
99 void JustDied(Unit* /*killer*/) override
100 {
101 if (InstanceScript* instance = me->GetInstanceScript())
102 {
103 instance->HandleGameObject(instance->GetGuidData(DATA_THRONE_DOOR), true);
104 instance->SetData(TYPE_IRON_HALL, DONE);
105 }
106 }
107
108 private:
110 };
111
112 CreatureAI* GetAI(Creature* creature) const override
113 {
114 return GetBlackrockDepthsAI<boss_magmusAI>(creature);
115 }
116};
117
123
125{
126public:
127 npc_ironhand_guardian() : CreatureScript("npc_ironhand_guardian") { }
128
130 {
132 {
134 _active = false;
135 }
136
137 void Reset() override
138 {
139 _events.Reset();
140 }
141
142 void UpdateAI(uint32 diff) override
143 {
144 if (!_active)
145 {
147 return;
148 // Once the boss is engaged, the guardians will stay activated until the next instance reset
150 _active = true;
151 }
152
153 _events.Update(diff);
154
155 while (uint32 eventId = _events.ExecuteEvent())
156 {
157 if (eventId == EVENT_GOUTOFFLAME)
158 {
160 _events.Repeat(16s, 21s);
161 }
162 }
163 }
164
165 private:
169 };
170
171 CreatureAI* GetAI(Creature* creature) const override
172 {
173 return GetBlackrockDepthsAI<npc_ironhand_guardianAI>(creature);
174 }
175};
176
178{
179 new boss_magmus();
181}
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition PlayerAI.cpp:32
DamageEffectType
Definition Unit.h:352
@ TYPE_IRON_HALL
@ DATA_THRONE_DOOR
void AddSC_boss_magmus()
@ SPELL_FIERYBURST
@ SPELL_WARSTOMP
@ PHASE_ONE
@ PHASE_TWO
@ EVENT_WARSTOMP
@ EVENT_FIERY_BURST
IronhandGuardian
@ EVENT_GOUTOFFLAME
@ SPELL_GOUTOFFLAME
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
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 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
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
Definition Unit.h:769
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
void JustEngagedWith(Unit *) override
void JustDied(Unit *) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_magmusAI(Creature *creature)
void UpdateAI(uint32 diff) override