Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_buru.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
#include "
ScriptMgr.h
"
6
#include "
ScriptedCreature.h
"
7
#include "
SpellScript.h
"
8
#include "
ruins_of_ahnqiraj.h
"
9
10
enum
Emotes
11
{
12
EMOTE_TARGET
= 0
13
};
14
15
enum
Spells
16
{
17
SPELL_CREEPING_PLAGUE
= 20512,
18
SPELL_DISMEMBER
= 96,
19
SPELL_GATHERING_SPEED
= 1834,
20
SPELL_FULL_SPEED
= 1557,
21
SPELL_THORNS
= 25640,
22
SPELL_BURU_TRANSFORM
= 24721,
23
SPELL_SUMMON_HATCHLING
= 1881,
24
SPELL_EXPLODE
= 19593,
25
SPELL_EXPLODE_2
= 5255,
26
SPELL_BURU_EGG_TRIGGER
= 26646
27
};
28
29
enum
Events
30
{
31
EVENT_DISMEMBER
= 1,
32
EVENT_GATHERING_SPEED
= 2,
33
EVENT_FULL_SPEED
= 3,
34
EVENT_CREEPING_PLAGUE
= 4,
35
EVENT_RESPAWN_EGG
= 5
36
};
37
38
enum
Phases
39
{
40
PHASE_EGG
= 0,
41
PHASE_TRANSFORM
= 1
42
};
43
44
enum
Actions
45
{
46
ACTION_EXPLODE
= 0
47
};
48
49
class
boss_buru
:
public
CreatureScript
50
{
51
public
:
52
boss_buru
() :
CreatureScript
(
"boss_buru"
) { }
53
54
struct
boss_buruAI
:
public
BossAI
55
{
56
boss_buruAI
(
Creature
* creature) :
BossAI
(creature,
DATA_BURU
)
57
{
58
}
59
60
void
EnterEvadeMode
()
OVERRIDE
61
{
62
BossAI::EnterEvadeMode
();
63
64
for
(std::list<uint64>::iterator i =
Eggs
.begin(); i !=
Eggs
.end(); ++i)
65
if
(
Creature
* egg =
me
->GetMap()->GetCreature(*
Eggs
.begin()))
66
egg->Respawn();
67
68
Eggs
.clear();
69
}
70
71
void
EnterCombat
(
Unit
* who)
OVERRIDE
72
{
73
_EnterCombat
();
74
Talk
(
EMOTE_TARGET
, who);
75
DoCast
(
me
,
SPELL_THORNS
);
76
77
events
.ScheduleEvent(
EVENT_DISMEMBER
, 5000);
78
events
.ScheduleEvent(
EVENT_GATHERING_SPEED
, 9000);
79
events
.ScheduleEvent(
EVENT_FULL_SPEED
, 60000);
80
81
_phase
=
PHASE_EGG
;
82
}
83
84
void
DoAction
(
int32
action)
OVERRIDE
85
{
86
if
(action ==
ACTION_EXPLODE
)
87
if
(
_phase
==
PHASE_EGG
)
88
me
->DealDamage(
me
, 45000);
89
}
90
91
void
KilledUnit
(
Unit
* victim)
OVERRIDE
92
{
93
if
(victim->GetTypeId() ==
TypeID::TYPEID_PLAYER
)
94
ChaseNewVictim
();
95
}
96
97
void
ChaseNewVictim
()
98
{
99
if
(
_phase
!=
PHASE_EGG
)
100
return
;
101
102
me
->RemoveAurasDueToSpell(
SPELL_FULL_SPEED
);
103
me
->RemoveAurasDueToSpell(
SPELL_GATHERING_SPEED
);
104
events
.ScheduleEvent(
EVENT_GATHERING_SPEED
, 9000);
105
events
.ScheduleEvent(
EVENT_FULL_SPEED
, 60000);
106
107
if
(
Unit
* victim =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0, 0.0f,
true
))
108
{
109
DoResetThreat
();
110
AttackStart
(victim);
111
Talk
(
EMOTE_TARGET
, victim);
112
}
113
}
114
115
void
ManageRespawn
(
uint64
EggGUID)
116
{
117
ChaseNewVictim
();
118
Eggs
.push_back(EggGUID);
119
events
.ScheduleEvent(
EVENT_RESPAWN_EGG
, 100000);
120
}
121
122
void
UpdateAI
(
uint32
diff)
OVERRIDE
123
{
124
if
(!
UpdateVictim
())
125
return
;
126
127
events
.Update(diff);
128
129
while
(
uint32
eventId =
events
.ExecuteEvent())
130
{
131
switch
(eventId)
132
{
133
case
EVENT_DISMEMBER
:
134
DoCastVictim
(
SPELL_DISMEMBER
);
135
events
.ScheduleEvent(
EVENT_DISMEMBER
, 5000);
136
break
;
137
case
EVENT_GATHERING_SPEED
:
138
DoCast
(
me
,
SPELL_GATHERING_SPEED
);
139
events
.ScheduleEvent(
EVENT_GATHERING_SPEED
, 9000);
140
break
;
141
case
EVENT_FULL_SPEED
:
142
DoCast
(
me
,
SPELL_FULL_SPEED
);
143
break
;
144
case
EVENT_CREEPING_PLAGUE
:
145
DoCast
(
me
,
SPELL_CREEPING_PLAGUE
);
146
events
.ScheduleEvent(
EVENT_CREEPING_PLAGUE
, 6000);
147
break
;
148
case
EVENT_RESPAWN_EGG
:
149
if
(
Creature
* egg =
me
->GetMap()->GetCreature(*
Eggs
.begin()))
150
{
151
egg->Respawn();
152
Eggs
.pop_front();
153
}
154
break
;
155
default
:
156
break
;
157
}
158
}
159
160
if
(
me
->GetHealthPct() < 20.0f &&
_phase
==
PHASE_EGG
)
161
{
162
DoCast
(
me
,
SPELL_BURU_TRANSFORM
);
// Enrage
163
DoCast
(
me
,
SPELL_FULL_SPEED
,
true
);
164
me
->RemoveAurasDueToSpell(
SPELL_THORNS
);
165
_phase
=
PHASE_TRANSFORM
;
166
}
167
168
DoMeleeAttackIfReady
();
169
}
170
private
:
171
uint8
_phase
;
172
std::list<uint64>
Eggs
;
173
};
174
175
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
176
{
177
return
new
boss_buruAI
(creature);
178
}
179
};
180
181
class
npc_buru_egg
:
public
CreatureScript
182
{
183
public
:
184
npc_buru_egg
() :
CreatureScript
(
"npc_buru_egg"
) { }
185
186
struct
npc_buru_eggAI
:
public
ScriptedAI
187
{
188
npc_buru_eggAI
(
Creature
* creature) :
ScriptedAI
(creature)
189
{
190
_instance
=
me
->GetInstanceScript();
191
SetCombatMovement
(
false
);
192
}
193
194
void
EnterCombat
(
Unit
* attacker)
OVERRIDE
195
{
196
if
(
Creature
* buru =
me
->GetMap()->GetCreature(
_instance
->GetData64(
DATA_BURU
)))
197
if
(!buru->IsInCombat())
198
buru->AI()->AttackStart(attacker);
199
}
200
201
void
JustSummoned
(
Creature
* who)
OVERRIDE
202
{
203
if
(who->GetEntry() ==
NPC_HATCHLING
)
204
if
(
Creature
* buru =
me
->GetMap()->GetCreature(
_instance
->GetData64(
DATA_BURU
)))
205
if
(
Unit
* target = buru->AI()->SelectTarget(
SELECT_TARGET_RANDOM
))
206
who->AI()->AttackStart(target);
207
}
208
209
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
210
{
211
DoCastAOE
(
SPELL_EXPLODE
,
true
);
212
DoCastAOE
(
SPELL_EXPLODE_2
,
true
);
// Unknown purpose
213
DoCast
(
me
,
SPELL_SUMMON_HATCHLING
,
true
);
214
215
if
(
Creature
* buru =
me
->GetMap()->GetCreature(
_instance
->GetData64(
DATA_BURU
)))
216
if
(
boss_buru::boss_buruAI
* buruAI =
dynamic_cast<
boss_buru::boss_buruAI
*
>
(buru->AI()))
217
buruAI->ManageRespawn(
me
->GetGUID());
218
}
219
private
:
220
InstanceScript
*
_instance
;
221
};
222
223
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
224
{
225
return
new
npc_buru_eggAI
(creature);
226
}
227
};
228
229
class
spell_egg_explosion
:
public
SpellScriptLoader
230
{
231
public
:
232
spell_egg_explosion
() :
SpellScriptLoader
(
"spell_egg_explosion"
) { }
233
234
class
spell_egg_explosion_SpellScript
:
public
SpellScript
235
{
236
PrepareSpellScript
(
spell_egg_explosion_SpellScript
);
237
238
void
HandleAfterCast
()
239
{
240
if
(
Creature
* buru =
GetCaster
()->FindNearestCreature(
NPC_BURU
, 5.f))
241
buru->AI()->DoAction(
ACTION_EXPLODE
);
242
}
243
244
void
HandleDummyHitTarget
(
SpellEffIndex
/*effIndex*/
)
245
{
246
if
(
Unit
* target =
GetHitUnit
())
247
GetCaster
()->
DealDamage
(target, -16 *
GetCaster
()->GetDistance(target) + 500);
248
}
249
250
void
Register
()
OVERRIDE
251
{
252
AfterCast
+=
SpellCastFn
(
spell_egg_explosion_SpellScript::HandleAfterCast
);
253
OnEffectHitTarget
+=
SpellEffectFn
(
spell_egg_explosion_SpellScript::HandleDummyHitTarget
,
EFFECT_0
,
SPELL_EFFECT_DUMMY
);
254
}
255
};
256
257
SpellScript
*
GetSpellScript
() const
OVERRIDE
258
{
259
return
new
spell_egg_explosion_SpellScript
();
260
}
261
};
262
263
void
AddSC_boss_buru
()
264
{
265
new
boss_buru
();
266
new
npc_buru_egg
();
267
new
spell_egg_explosion
();
268
}
Actions
Actions
Definition
BattlegroundIC.h:186
Spells
Spells
Definition
BattlegroundIC.h:645
int32
std::int32_t int32
Definition
Define.h:73
uint8
std::uint8_t uint8
Definition
Define.h:79
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
uint64
std::uint64_t uint64
Definition
Define.h:76
TypeID::TYPEID_PLAYER
@ TYPEID_PLAYER
Definition
Object.h:55
ScriptMgr.h
ScriptedCreature.h
SpellEffIndex
SpellEffIndex
Definition
SharedDefines.h:17
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:18
SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_DUMMY
Definition
SharedDefines.h:891
SpellScript.h
SpellEffectFn
#define SpellEffectFn(F, I, N)
Definition
SpellScript.h:269
SpellCastFn
#define SpellCastFn(F)
Definition
SpellScript.h:256
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
Events
Events
Definition
alterac_valley.cpp:40
Phases
Phases
Definition
boss_anraphet.cpp:80
ACTION_EXPLODE
@ ACTION_EXPLODE
Definition
boss_buru.cpp:46
EMOTE_TARGET
@ EMOTE_TARGET
Definition
boss_buru.cpp:12
SPELL_SUMMON_HATCHLING
@ SPELL_SUMMON_HATCHLING
Definition
boss_buru.cpp:23
SPELL_FULL_SPEED
@ SPELL_FULL_SPEED
Definition
boss_buru.cpp:20
SPELL_GATHERING_SPEED
@ SPELL_GATHERING_SPEED
Definition
boss_buru.cpp:19
SPELL_THORNS
@ SPELL_THORNS
Definition
boss_buru.cpp:21
SPELL_DISMEMBER
@ SPELL_DISMEMBER
Definition
boss_buru.cpp:18
SPELL_BURU_EGG_TRIGGER
@ SPELL_BURU_EGG_TRIGGER
Definition
boss_buru.cpp:26
SPELL_CREEPING_PLAGUE
@ SPELL_CREEPING_PLAGUE
Definition
boss_buru.cpp:17
SPELL_EXPLODE
@ SPELL_EXPLODE
Definition
boss_buru.cpp:24
SPELL_BURU_TRANSFORM
@ SPELL_BURU_TRANSFORM
Definition
boss_buru.cpp:22
SPELL_EXPLODE_2
@ SPELL_EXPLODE_2
Definition
boss_buru.cpp:25
PHASE_EGG
@ PHASE_EGG
Definition
boss_buru.cpp:40
PHASE_TRANSFORM
@ PHASE_TRANSFORM
Definition
boss_buru.cpp:41
AddSC_boss_buru
void AddSC_boss_buru()
Definition
boss_buru.cpp:263
EVENT_DISMEMBER
@ EVENT_DISMEMBER
Definition
boss_buru.cpp:31
EVENT_GATHERING_SPEED
@ EVENT_GATHERING_SPEED
Definition
boss_buru.cpp:32
EVENT_FULL_SPEED
@ EVENT_FULL_SPEED
Definition
boss_buru.cpp:33
EVENT_RESPAWN_EGG
@ EVENT_RESPAWN_EGG
Definition
boss_buru.cpp:35
EVENT_CREEPING_PLAGUE
@ EVENT_CREEPING_PLAGUE
Definition
boss_buru.cpp:34
Emotes
Emotes
Definition
boss_chromaggus.cpp:12
BossAI::events
EventMap events
Definition
ScriptedCreature.h:439
BossAI::BossAI
BossAI(Creature *creature, uint32 bossId)
Definition
ScriptedCreature.cpp:456
BossAI::_EnterCombat
void _EnterCombat()
Definition
ScriptedCreature.cpp:485
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::Talk
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
Definition
CreatureAI.cpp:28
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
CreatureAI::EnterEvadeMode
virtual void EnterEvadeMode()
Definition
CreatureAI.cpp:130
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
InstanceScript
Definition
InstanceScript.h:123
SpellScript
Definition
SpellScript.h:139
SpellScript::AfterCast
HookList< CastHandler > AfterCast
Definition
SpellScript.h:255
SpellScript::OnEffectHitTarget
HookList< EffectHandler > OnEffectHitTarget
Definition
SpellScript.h:268
SpellScript::GetHitUnit
Unit * GetHitUnit()
Definition
SpellScript.cpp:399
SpellScript::GetCaster
Unit * GetCaster()
Definition
SpellScript.cpp:352
SpellScriptLoader::SpellScriptLoader
SpellScriptLoader(const char *name)
Definition
ScriptMgr.cpp:1372
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
UnitAI::SelectTarget
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition
UnitAI.cpp:66
UnitAI::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
UnitAI::DoCastAOE
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:176
Unit
Definition
Unit.h:1367
Unit::DealDamage
uint32 DealDamage(Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
Definition
UnitCombat.cpp:63
boss_buru
Definition
boss_buru.cpp:50
boss_buru::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_buru.cpp:175
boss_buru::boss_buru
boss_buru()
Definition
boss_buru.cpp:52
npc_buru_egg
Definition
boss_buru.cpp:182
npc_buru_egg::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_buru.cpp:223
npc_buru_egg::npc_buru_egg
npc_buru_egg()
Definition
boss_buru.cpp:184
spell_egg_explosion::spell_egg_explosion_SpellScript
Definition
boss_buru.cpp:235
spell_egg_explosion::spell_egg_explosion_SpellScript::Register
void Register() OVERRIDE
Definition
boss_buru.cpp:250
spell_egg_explosion::spell_egg_explosion_SpellScript::HandleDummyHitTarget
void HandleDummyHitTarget(SpellEffIndex)
Definition
boss_buru.cpp:244
spell_egg_explosion::spell_egg_explosion_SpellScript::PrepareSpellScript
PrepareSpellScript(spell_egg_explosion_SpellScript)
spell_egg_explosion::spell_egg_explosion_SpellScript::HandleAfterCast
void HandleAfterCast()
Definition
boss_buru.cpp:238
spell_egg_explosion
Definition
boss_buru.cpp:230
spell_egg_explosion::spell_egg_explosion
spell_egg_explosion()
Definition
boss_buru.cpp:232
spell_egg_explosion::GetSpellScript
SpellScript * GetSpellScript() const OVERRIDE
Definition
boss_buru.cpp:257
ruins_of_ahnqiraj.h
NPC_HATCHLING
@ NPC_HATCHLING
Definition
ruins_of_ahnqiraj.h:35
NPC_BURU
@ NPC_BURU
Definition
ruins_of_ahnqiraj.h:27
DATA_BURU
@ DATA_BURU
Definition
ruins_of_ahnqiraj.h:14
ScriptedAI::DoResetThreat
void DoResetThreat()
Definition
ScriptedCreature.cpp:260
ScriptedAI::SetCombatMovement
void SetCombatMovement(bool allowMovement)
Definition
ScriptedCreature.cpp:394
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
ScriptedAI::AttackStart
void AttackStart(Unit *) OVERRIDE
Definition
ScriptedCreature.cpp:118
boss_buru::boss_buruAI
Definition
boss_buru.cpp:55
boss_buru::boss_buruAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_buru.cpp:122
boss_buru::boss_buruAI::Eggs
std::list< uint64 > Eggs
Definition
boss_buru.cpp:172
boss_buru::boss_buruAI::KilledUnit
void KilledUnit(Unit *victim) OVERRIDE
Definition
boss_buru.cpp:91
boss_buru::boss_buruAI::ChaseNewVictim
void ChaseNewVictim()
Definition
boss_buru.cpp:97
boss_buru::boss_buruAI::boss_buruAI
boss_buruAI(Creature *creature)
Definition
boss_buru.cpp:56
boss_buru::boss_buruAI::ManageRespawn
void ManageRespawn(uint64 EggGUID)
Definition
boss_buru.cpp:115
boss_buru::boss_buruAI::EnterEvadeMode
void EnterEvadeMode() OVERRIDE
Definition
boss_buru.cpp:60
boss_buru::boss_buruAI::_phase
uint8 _phase
Definition
boss_buru.cpp:171
boss_buru::boss_buruAI::EnterCombat
void EnterCombat(Unit *who) OVERRIDE
Definition
boss_buru.cpp:71
boss_buru::boss_buruAI::DoAction
void DoAction(int32 action) OVERRIDE
Definition
boss_buru.cpp:84
npc_buru_egg::npc_buru_eggAI
Definition
boss_buru.cpp:187
npc_buru_egg::npc_buru_eggAI::EnterCombat
void EnterCombat(Unit *attacker) OVERRIDE
Definition
boss_buru.cpp:194
npc_buru_egg::npc_buru_eggAI::npc_buru_eggAI
npc_buru_eggAI(Creature *creature)
Definition
boss_buru.cpp:188
npc_buru_egg::npc_buru_eggAI::JustSummoned
void JustSummoned(Creature *who) OVERRIDE
Definition
boss_buru.cpp:201
npc_buru_egg::npc_buru_eggAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_buru.cpp:209
npc_buru_egg::npc_buru_eggAI::_instance
InstanceScript * _instance
Definition
boss_buru.cpp:220
src
server
scripts
Kalimdor
RuinsOfAhnQiraj
boss_buru.cpp
Generated on
for Project SkyFire Core by
1.17.0