TrinityCore
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/* ScriptData
19SDName: Boss_Golemagg
20SD%Complete: 90
21SDComment: Timers need to be confirmed, Golemagg's Trust need to be checked
22SDCategory: Molten Core
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "molten_core.h"
28#include "ObjectAccessor.h"
29#include "ScriptedCreature.h"
30
32{
34};
35
37{
38 // Golemagg
42 SPELL_ENRAGE = 19953,
44
45 // Core Rager
46 SPELL_MANGLE = 19820
47};
48
50{
53};
54
55struct boss_golemagg : public BossAI
56{
58
59 void Reset() override
60 {
63 }
64
65 void JustEngagedWith(Unit* victim) override
66 {
69 }
70
71 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
72 {
74 return;
75
76 DoCast(me, SPELL_ENRAGE, true);
78 }
79
80 void UpdateAI(uint32 diff) override
81 {
82 if (!UpdateVictim())
83 return;
84
85 events.Update(diff);
86
88 return;
89
90 while (uint32 eventId = events.ExecuteEvent())
91 {
92 switch (eventId)
93 {
94 case EVENT_PYROBLAST:
96 DoCast(target, SPELL_PYROBLAST);
98 break;
102 break;
103 default:
104 break;
105 }
106
108 return;
109 }
110 }
111};
112
114{
115 npc_core_rager(Creature* creature) : ScriptedAI(creature)
116 {
117 _instance = creature->GetInstanceScript();
118 }
119
120 void Reset() override
121 {
123 }
124
125 void JustEngagedWith(Unit* /*who*/) override
126 {
127 _scheduler.Schedule(7s, [this](TaskContext task) // These times are probably wrong
128 {
130 task.Repeat(10s);
131 });
132 }
133
134 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
135 {
136 if (HealthAbovePct(50) || !_instance)
137 return;
138
140 {
141 if (pGolemagg->IsAlive())
142 {
145 me->SetFullHealth();
146 }
147 }
148 }
149
150 void UpdateAI(uint32 diff) override
151 {
152 if (!UpdateVictim())
153 return;
154
155 _scheduler.Update(diff);
156 }
157
158private:
161};
162
164{
167}
Texts
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SPELL_ENRAGE
@ SPELL_MANGLE
@ SPELL_MAGMASPLASH
@ SPELL_EARTHQUAKE
@ SPELL_GOLEMAGG_TRUST
@ SPELL_PYROBLAST
void AddSC_boss_golemagg()
@ EMOTE_LOWHP
@ EVENT_EARTHQUAKE
@ EVENT_PYROBLAST
void JustEngagedWith(Unit *who) override
EventMap events
void Reset() override
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
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 ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetFullHealth()
Definition: Unit.h:790
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
#define RegisterMoltenCoreCreatureAI(ai_name)
Definition: molten_core.h:84
@ BOSS_GOLEMAGG_THE_INCINERATOR
Definition: molten_core.h:37
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
bool HealthAbovePct(uint32 pct) const
bool HealthBelowPct(uint32 pct) const
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
void UpdateAI(uint32 diff) override
void Reset() override
boss_golemagg(Creature *creature)
void JustEngagedWith(Unit *victim) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
void Reset() override
npc_core_rager(Creature *creature)
InstanceScript * _instance
TaskScheduler _scheduler