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 }
128
129private:
131};
132
133// 11672 - Core Rager
135{
136 npc_core_rager(Creature* creature) : ScriptedAI(creature) { }
137
138 void Reset() override
139 {
142 }
143
144 void JustEngagedWith(Unit* /*who*/) override
145 {
146 _scheduler.Schedule(5s, 15s, [this](TaskContext& task)
147 {
149 task.Repeat(10s, 20s);
150 });
151 }
152
153 void DoAction(int32 action) override
154 {
155 if (action == ACTION_QUIET_SUICIDE)
157 }
158
159 void OnSpellCast(SpellInfo const* spell) override
160 {
161 if (spell->Id == SPELL_FULL_HEAL)
163 }
164
165 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
166 {
167 if (me->HealthBelowPctDamaged(50, damage))
168 {
169 _scheduler.Schedule(0s, [this](TaskContext const& /*task*/)
170 {
172 });
173 }
174 }
175
176 void UpdateAI(uint32 diff) override
177 {
178 if (!UpdateVictim())
179 return;
180
181 _scheduler.Update(diff);
182 }
183
184private:
186};
187
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
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:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
uint32 const Id
Definition SpellInfo.h:328
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
#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