Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_golemagg.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Boss_Golemagg
8SD%Complete: 90
9SDComment: Timers need to be confirmed, Golemagg's Trust need to be checked
10SDCategory: Molten Core
11EndScriptData */
12
13#include "ObjectMgr.h"
14#include "ScriptMgr.h"
15#include "ScriptedCreature.h"
16#include "molten_core.h"
17
19{
21};
22
24{
25 // Golemagg
29 SPELL_ENRAGE = 19953,
31
32 // Core Rager
34};
35
41
43{
44public:
45 boss_golemagg() : CreatureScript("boss_golemagg") {}
46
47 struct boss_golemaggAI : public BossAI
48 {
50
52 {
55 }
56
58 {
59 BossAI::EnterCombat(victim);
60 events.ScheduleEvent(EVENT_PYROBLAST, 7000);
61 }
62
63 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE
64 {
65 if (!HealthBelowPct(10) || me->HasAura(SPELL_ENRAGE))
66 return;
67
68 DoCast(me, SPELL_ENRAGE, true);
69 events.ScheduleEvent(EVENT_EARTHQUAKE, 3000);
70 }
71
73 {
74 if (!UpdateVictim())
75 return;
76
77 events.Update(diff);
78
79 if (me->HasUnitState(UNIT_STATE_CASTING))
80 return;
81
82 while (uint32 eventId = events.ExecuteEvent())
83 {
84 switch (eventId)
85 {
86 case EVENT_PYROBLAST:
87 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
88 DoCast(target, SPELL_PYROBLAST);
89 events.ScheduleEvent(EVENT_PYROBLAST, 7000);
90 break;
93 events.ScheduleEvent(EVENT_EARTHQUAKE, 3000);
94 break;
95 default:
96 break;
97 }
98 }
99
101 }
102 };
103
105 {
106 return new boss_golemaggAI(creature);
107 }
108};
109
111{
112public:
113 npc_core_rager() : CreatureScript("npc_core_rager") {}
114
116 {
117 npc_core_ragerAI(Creature* creature) : ScriptedAI(creature)
118 {
119 instance = creature->GetInstanceScript();
120 mangleTimer = 0;
121 }
122
124 {
125 mangleTimer = 7 * IN_MILLISECONDS; // These times are probably wrong
126 }
127
128 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE
129 {
130 if (HealthAbovePct(50) || !instance)
131 return;
132
133 if (Creature* pGolemagg = instance->instance->GetCreature(instance->GetData64(BOSS_GOLEMAGG_THE_INCINERATOR)))
134 {
135 if (pGolemagg->IsAlive())
136 {
137 me->AddAura(SPELL_GOLEMAGG_TRUST, me);
139 me->SetFullHealth();
140 }
141 }
142 }
143
145 {
146 if (!UpdateVictim())
147 return;
148
149 // Mangle
150 if (mangleTimer <= diff)
151 {
154 }
155 else
156 mangleTimer -= diff;
157
159 }
160
161 private:
164 };
165
167 {
168 return new npc_core_ragerAI(creature);
169 }
170};
171
173{
174 new boss_golemagg();
175 new npc_core_rager();
176}
@ IN_MILLISECONDS
Definition Common.h:125
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_ENRAGE
@ SPELL_ENRAGE
@ SPELL_MANGLE
@ SPELL_MAGMASPLASH
@ SPELL_EARTHQUAKE
@ SPELL_GOLEMAGG_TRUST
@ SPELL_PYROBLAST
void AddSC_boss_golemagg()
@ EMOTE_LOWHP
@ EVENT_EARTHQUAKE
@ EVENT_PYROBLAST
EventMap events
void Reset() OVERRIDE
BossAI(Creature *creature, uint32 bossId)
void EnterCombat(Unit *) OVERRIDE
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ BOSS_GOLEMAGG_THE_INCINERATOR
Definition molten_core.h:18
Creature * me
bool HealthAbovePct(uint32 pct) const
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
void DamageTaken(Unit *, uint32 &) OVERRIDE
void EnterCombat(Unit *victim) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
boss_golemaggAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void DamageTaken(Unit *, uint32 &) OVERRIDE