TrinityCore
Loading...
Searching...
No Matches
boss_golemagg.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 "molten_core.h"
20#include "ScriptedCreature.h"
21#include "SpellInfo.h"
22
27
29{
30 // Golemagg
34
37
38 // Core Rager
39 SPELL_THRASH = 12787,
40 SPELL_MANGLE = 19820,
43};
44
50
56
57// 11988 - Golemagg the Incinerator
58struct boss_golemagg : public BossAI
59{
61
70
71 void JustEngagedWith(Unit* who) override
72 {
74
76 }
77
78 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
79 {
81 {
84 }
85 }
86
87 void JustDied(Unit* /*killer*/) override
88 {
89 _JustDied();
90
91 std::vector<Creature*> ragers;
93 for (Creature* rager : ragers)
94 rager->AI()->DoAction(ACTION_QUIET_SUICIDE);
95 }
96
97 void UpdateAI(uint32 diff) override
98 {
99 if (!UpdateVictim())
100 return;
101
102 events.Update(diff);
103
105 return;
106
107 while (uint32 eventId = events.ExecuteEvent())
108 {
109 switch (eventId)
110 {
111 case EVENT_PYROBLAST:
113 DoCast(target, SPELL_PYROBLAST);
114 events.Repeat(3s, 13s);
115 break;
116 case EVENT_EARTHQUAKE:
118 events.Repeat(3s);
119 break;
120 default:
121 break;
122 }
123
125 return;
126 }
127
129 }
130
131private:
133};
134
135// 11672 - Core Rager
137{
138 npc_core_rager(Creature* creature) : ScriptedAI(creature) { }
139
140 void Reset() override
141 {
144 }
145
146 void JustEngagedWith(Unit* /*who*/) override
147 {
148 _scheduler.Schedule(5s, 15s, [this](TaskContext task)
149 {
151 task.Repeat(10s, 20s);
152 });
153 }
154
155 void DoAction(int32 action) override
156 {
157 if (action == ACTION_QUIET_SUICIDE)
159 }
160
161 void OnSpellCast(SpellInfo const* spell) override
162 {
163 if (spell->Id == SPELL_FULL_HEAL)
165 }
166
167 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
168 {
169 if (me->HealthBelowPctDamaged(50, damage))
170 {
171 _scheduler.Schedule(0s, [this](TaskContext /*task*/)
172 {
174 });
175 }
176 }
177
178 void UpdateAI(uint32 diff) override
179 {
180 if (!UpdateVictim())
181 return;
182
183 _scheduler.Update(diff, [this]
184 {
186 });
187 }
188
189private:
191};
192
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
GolemaggEvents
@ EVENT_EARTHQUAKE
@ EVENT_PYROBLAST
GolemaggSpells
@ SPELL_MANGLE
@ SPELL_GOLEMAGGS_TRUST
@ SPELL_EARTHQUAKE
@ SPELL_THRASH
@ SPELL_FULL_HEAL
@ SPELL_MAGMA_SPLASH
@ SPELL_QUIET_SUICIDE
@ SPELL_PYROBLAST
@ SPELL_DOUBLE_ATTACK
void AddSC_boss_golemagg()
GolemaggMisc
@ ACTION_QUIET_SUICIDE
@ NPC_CORE_RAGER
GolemaggTexts
@ EMOTE_LOW_HEALTH
void JustEngagedWith(Unit *who) override
EventMap events
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
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
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 DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
#define RegisterMoltenCoreCreatureAI(ai_name)
@ BOSS_GOLEMAGG_THE_INCINERATOR
Definition molten_core.h:37
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void Reset() override
boss_golemagg(Creature *creature)
void UpdateAI(uint32 diff) override
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustEngagedWith(Unit *) override
void Reset() override
npc_core_rager(Creature *creature)
void DoAction(int32 action) override
TaskScheduler _scheduler