Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_ormorok.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
#include "
ScriptMgr.h
"
7
#include "
ScriptedCreature.h
"
8
#include "
nexus.h
"
9
#include "
SpellScript.h
"
10
11
enum
Spells
12
{
13
SPELL_SPELL_REFLECTION
= 47981,
14
SPELL_TRAMPLE
= 48016,
15
SPELL_FRENZY
= 48017,
16
SPELL_SUMMON_CRYSTALLINE_TANGLER
= 61564,
17
SPELL_CRYSTAL_SPIKES
= 47958,
18
};
19
enum
Yells
20
{
21
SAY_AGGRO
= 1,
22
SAY_DEATH
= 2,
23
SAY_REFLECT
= 3,
24
SAY_CRYSTAL_SPIKES
= 4,
25
SAY_KILL
= 5,
26
};
27
28
enum
Events
29
{
30
EVENT_CRYSTAL_SPIKES
= 1,
31
EVENT_TRAMPLE
= 2,
32
EVENT_SPELL_REFLECTION
= 3,
33
EVENT_CRYSTALLINE_TANGLER
= 4,
34
};
35
36
class
OrmorokTanglerPredicate
37
{
38
public
:
39
OrmorokTanglerPredicate
(
Unit
* unit) :
me
(unit) { }
40
41
bool
operator()
(
WorldObject
*
object
)
const
42
{
43
return
object
->GetDistance2d(
me
) >= 5.0f;
44
}
45
46
private
:
47
Unit
*
me
;
48
};
49
50
class
boss_ormorok
:
public
CreatureScript
51
{
52
public
:
53
boss_ormorok
() :
CreatureScript
(
"boss_ormorok"
) { }
54
55
struct
boss_ormorokAI
:
public
BossAI
56
{
57
boss_ormorokAI
(
Creature
* creature) :
BossAI
(creature,
DATA_ORMOROK_EVENT
) { }
58
59
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
60
{
61
_EnterCombat
();
62
63
events
.ScheduleEvent(
EVENT_CRYSTAL_SPIKES
, 12000);
64
events
.ScheduleEvent(
EVENT_TRAMPLE
, 10000);
65
events
.ScheduleEvent(
EVENT_SPELL_REFLECTION
, 30000);
66
if
(
IsHeroic
())
67
events
.ScheduleEvent(
EVENT_CRYSTALLINE_TANGLER
, 17000);
68
69
Talk
(
SAY_AGGRO
);
70
71
if
(
instance
)
72
instance
->SetData(
DATA_ORMOROK_EVENT
,
IN_PROGRESS
);
73
}
74
75
void
DamageTaken
(
Unit
*
/*attacker*/
,
uint32
&
/*damage*/
)
OVERRIDE
76
{
77
if
(!
frenzy
&&
HealthBelowPct
(25))
78
{
79
DoCast
(
me
,
SPELL_FRENZY
);
80
frenzy
=
true
;
81
}
82
}
83
84
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
85
{
86
_JustDied
();
87
88
Talk
(
SAY_DEATH
);
89
90
if
(
instance
)
91
instance
->SetData(
DATA_ORMOROK_EVENT
,
DONE
);
92
}
93
94
void
KilledUnit
(
Unit
*
/*victim*/
)
OVERRIDE
95
{
96
Talk
(
SAY_KILL
);
97
}
98
99
void
UpdateAI
(
uint32
diff)
OVERRIDE
100
{
101
if
(!
UpdateVictim
())
102
return
;
103
104
events
.Update(diff);
105
106
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
107
return
;
108
109
while
(
uint32
eventId =
events
.ExecuteEvent())
110
{
111
switch
(eventId)
112
{
113
case
EVENT_TRAMPLE
:
114
DoCast
(
me
,
SPELL_TRAMPLE
);
115
events
.ScheduleEvent(
EVENT_TRAMPLE
, 10000);
116
break
;
117
case
EVENT_SPELL_REFLECTION
:
118
Talk
(
SAY_REFLECT
);
119
DoCast
(
me
,
SPELL_SPELL_REFLECTION
);
120
events
.ScheduleEvent(
EVENT_SPELL_REFLECTION
, 30000);
121
break
;
122
case
EVENT_CRYSTAL_SPIKES
:
123
Talk
(
SAY_CRYSTAL_SPIKES
);
124
DoCast
(
SPELL_CRYSTAL_SPIKES
);
125
events
.ScheduleEvent(
EVENT_CRYSTAL_SPIKES
, 12000);
126
break
;
127
case
EVENT_CRYSTALLINE_TANGLER
:
128
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0,
OrmorokTanglerPredicate
(
me
)))
129
DoCast
(target,
SPELL_SUMMON_CRYSTALLINE_TANGLER
);
130
events
.ScheduleEvent(
EVENT_CRYSTALLINE_TANGLER
, 17000);
131
break
;
132
default
:
133
break
;
134
}
135
}
136
137
DoMeleeAttackIfReady
();
138
}
139
140
private
:
141
bool
frenzy
;
142
};
143
144
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
145
{
146
return
new
boss_ormorokAI
(creature);
147
}
148
};
149
150
enum
CrystalSpikes
151
{
152
NPC_CRYSTAL_SPIKE_INITIAL
= 27101,
153
NPC_CRYSTAL_SPIKE_TRIGGER
= 27079,
154
155
DATA_COUNT
= 1,
156
MAX_COUNT
= 5,
157
158
SPELL_CRYSTAL_SPIKE_DAMAGE
= 47944,
159
160
GO_CRYSTAL_SPIKE_TRAP
= 188537,
161
};
162
163
uint32
const
crystalSpikeSummon
[3] =
164
{
165
47936,
166
47942,
167
47943
168
};
169
170
class
npc_crystal_spike_trigger
:
public
CreatureScript
171
{
172
public
:
173
npc_crystal_spike_trigger
() :
CreatureScript
(
"npc_crystal_spike_trigger"
) { }
174
175
struct
npc_crystal_spike_triggerAI
:
public
ScriptedAI
176
{
177
npc_crystal_spike_triggerAI
(
Creature
* creature) :
ScriptedAI
(creature) { }
178
179
void
IsSummonedBy
(
Unit
* owner)
OVERRIDE
180
{
181
switch
(
me
->GetEntry())
182
{
183
case
NPC_CRYSTAL_SPIKE_INITIAL
:
184
_count
= 0;
185
me
->SetFacingToObject(owner);
186
break
;
187
case
NPC_CRYSTAL_SPIKE_TRIGGER
:
188
if
(
Creature
* trigger = owner->
ToCreature
())
189
_count
= trigger->AI()->GetData(
DATA_COUNT
) + 1;
190
break
;
191
default
:
192
_count
=
MAX_COUNT
;
193
break
;
194
}
195
196
if
(
me
->GetEntry() ==
NPC_CRYSTAL_SPIKE_TRIGGER
)
197
if
(
GameObject
* trap =
me
->FindNearestGameObject(
GO_CRYSTAL_SPIKE_TRAP
, 1.0f))
198
trap->Use(
me
);
199
200
_despawntimer
= 2000;
201
}
202
203
uint32
GetData
(
uint32
type)
const
OVERRIDE
204
{
205
return
type ==
DATA_COUNT
?
_count
: 0;
206
}
207
208
void
UpdateAI
(
uint32
diff)
OVERRIDE
209
{
210
if
(
_despawntimer
<= diff)
211
{
212
if
(
me
->GetEntry() ==
NPC_CRYSTAL_SPIKE_TRIGGER
)
213
if
(
GameObject
* trap =
me
->FindNearestGameObject(
GO_CRYSTAL_SPIKE_TRAP
, 1.0f))
214
trap->Delete();
215
216
me
->DespawnOrUnsummon();
217
}
218
else
219
_despawntimer
-= diff;
220
}
221
222
private
:
223
uint32
_count
;
224
uint32
_despawntimer
;
225
};
226
227
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
228
{
229
return
new
npc_crystal_spike_triggerAI
(creature);
230
}
231
};
232
233
class
spell_crystal_spike
:
public
SpellScriptLoader
234
{
235
public
:
236
spell_crystal_spike
() :
SpellScriptLoader
(
"spell_crystal_spike"
) { }
237
238
class
spell_crystal_spike_AuraScript
:
public
AuraScript
239
{
240
PrepareAuraScript
(
spell_crystal_spike_AuraScript
);
241
242
void
HandlePeriodic
(
AuraEffect
const
*
/*aurEff*/
)
243
{
244
Unit
* target =
GetTarget
();
245
if
(target->
GetEntry
() ==
NPC_CRYSTAL_SPIKE_INITIAL
|| target->
GetEntry
() ==
NPC_CRYSTAL_SPIKE_TRIGGER
)
246
if
(
Creature
* trigger = target->
ToCreature
())
247
{
248
uint32
spell = target->
GetEntry
() ==
NPC_CRYSTAL_SPIKE_INITIAL
?
crystalSpikeSummon
[0] :
crystalSpikeSummon
[std::rand() % 2];
249
if
(trigger->AI()->GetData(
DATA_COUNT
) <
MAX_COUNT
)
250
trigger->CastSpell(trigger, spell,
true
);
251
}
252
}
253
254
void
Register
()
OVERRIDE
255
{
256
OnEffectPeriodic
+=
AuraEffectPeriodicFn
(
spell_crystal_spike_AuraScript::HandlePeriodic
,
EFFECT_0
,
SPELL_AURA_PERIODIC_DUMMY
);
257
}
258
};
259
260
AuraScript
*
GetAuraScript
() const
OVERRIDE
261
{
262
return
new
spell_crystal_spike_AuraScript
();
263
}
264
};
265
266
void
AddSC_boss_ormorok
()
267
{
268
new
boss_ormorok
();
269
new
npc_crystal_spike_trigger
();
270
new
spell_crystal_spike
();
271
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
IN_PROGRESS
@ IN_PROGRESS
Definition
InstanceScript.h:47
DONE
@ DONE
Definition
InstanceScript.h:49
ScriptMgr.h
ScriptedCreature.h
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:18
SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_PERIODIC_DUMMY
Definition
SpellAuraDefines.h:273
SpellScript.h
AuraEffectPeriodicFn
#define AuraEffectPeriodicFn(F, I, N)
Definition
SpellScript.h:669
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
Events
Events
Definition
alterac_valley.cpp:40
SAY_DEATH
#define SAY_DEATH
Definition
boss_commander_kolurg.cpp:30
SAY_AGGRO
#define SAY_AGGRO
Definition
boss_commander_kolurg.cpp:28
SAY_KILL
#define SAY_KILL
Definition
boss_commander_kolurg.cpp:29
SPELL_FRENZY
@ SPELL_FRENZY
Definition
boss_drekthar.cpp:14
EVENT_TRAMPLE
@ EVENT_TRAMPLE
Definition
boss_moam.cpp:29
SAY_DEATH
@ SAY_DEATH
Definition
boss_ormorok.cpp:22
SAY_CRYSTAL_SPIKES
@ SAY_CRYSTAL_SPIKES
Definition
boss_ormorok.cpp:24
SAY_REFLECT
@ SAY_REFLECT
Definition
boss_ormorok.cpp:23
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_ormorok.cpp:21
SAY_KILL
@ SAY_KILL
Definition
boss_ormorok.cpp:25
SPELL_TRAMPLE
@ SPELL_TRAMPLE
Definition
boss_ormorok.cpp:14
SPELL_CRYSTAL_SPIKES
@ SPELL_CRYSTAL_SPIKES
Definition
boss_ormorok.cpp:17
SPELL_FRENZY
@ SPELL_FRENZY
Definition
boss_ormorok.cpp:15
SPELL_SPELL_REFLECTION
@ SPELL_SPELL_REFLECTION
Definition
boss_ormorok.cpp:13
SPELL_SUMMON_CRYSTALLINE_TANGLER
@ SPELL_SUMMON_CRYSTALLINE_TANGLER
Definition
boss_ormorok.cpp:16
AddSC_boss_ormorok
void AddSC_boss_ormorok()
Definition
boss_ormorok.cpp:266
crystalSpikeSummon
uint32 const crystalSpikeSummon[3]
Definition
boss_ormorok.cpp:163
CrystalSpikes
CrystalSpikes
Definition
boss_ormorok.cpp:151
NPC_CRYSTAL_SPIKE_INITIAL
@ NPC_CRYSTAL_SPIKE_INITIAL
Definition
boss_ormorok.cpp:152
NPC_CRYSTAL_SPIKE_TRIGGER
@ NPC_CRYSTAL_SPIKE_TRIGGER
Definition
boss_ormorok.cpp:153
GO_CRYSTAL_SPIKE_TRAP
@ GO_CRYSTAL_SPIKE_TRAP
Definition
boss_ormorok.cpp:160
DATA_COUNT
@ DATA_COUNT
Definition
boss_ormorok.cpp:155
MAX_COUNT
@ MAX_COUNT
Definition
boss_ormorok.cpp:156
SPELL_CRYSTAL_SPIKE_DAMAGE
@ SPELL_CRYSTAL_SPIKE_DAMAGE
Definition
boss_ormorok.cpp:158
EVENT_CRYSTALLINE_TANGLER
@ EVENT_CRYSTALLINE_TANGLER
Definition
boss_ormorok.cpp:33
EVENT_SPELL_REFLECTION
@ EVENT_SPELL_REFLECTION
Definition
boss_ormorok.cpp:32
EVENT_CRYSTAL_SPIKES
@ EVENT_CRYSTAL_SPIKES
Definition
boss_ormorok.cpp:30
EVENT_TRAMPLE
@ EVENT_TRAMPLE
Definition
boss_ormorok.cpp:31
SPELL_TRAMPLE
@ SPELL_TRAMPLE
Definition
boss_ramstein_the_gorger.cpp:19
EVENT_SPELL_REFLECTION
@ EVENT_SPELL_REFLECTION
Definition
boss_temporus.cpp:37
AuraEffect
Definition
SpellAuraEffects.h:18
AuraScript
Definition
SpellScript.h:436
AuraScript::OnEffectPeriodic
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition
SpellScript.h:668
AuraScript::AuraScript
AuraScript()
Definition
SpellScript.h:597
AuraScript::GetTarget
Unit * GetTarget() const
Definition
SpellScript.cpp:1085
BossAI::instance
InstanceScript *const instance
Definition
ScriptedCreature.h:383
BossAI::events
EventMap events
Definition
ScriptedCreature.h:439
BossAI::BossAI
BossAI(Creature *creature, uint32 bossId)
Definition
ScriptedCreature.cpp:456
BossAI::_JustDied
void _JustDied()
Definition
ScriptedCreature.cpp:474
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
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
GameObject
Definition
GameObject.h:629
Object::GetEntry
uint32 GetEntry() const
Definition
Object.h:125
Object::ToCreature
Creature * ToCreature()
Definition
Object.h:207
OrmorokTanglerPredicate
Definition
boss_ormorok.cpp:37
OrmorokTanglerPredicate::operator()
bool operator()(WorldObject *object) const
Definition
boss_ormorok.cpp:41
OrmorokTanglerPredicate::me
Unit * me
Definition
boss_ormorok.cpp:47
OrmorokTanglerPredicate::OrmorokTanglerPredicate
OrmorokTanglerPredicate(Unit *unit)
Definition
boss_ormorok.cpp:39
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
Unit
Definition
Unit.h:1367
WorldObject
Definition
Object.h:610
boss_ormorok
Definition
boss_ormorok.cpp:51
boss_ormorok::boss_ormorok
boss_ormorok()
Definition
boss_ormorok.cpp:53
boss_ormorok::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_ormorok.cpp:144
npc_crystal_spike_trigger
Definition
boss_ormorok.cpp:171
npc_crystal_spike_trigger::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_ormorok.cpp:227
npc_crystal_spike_trigger::npc_crystal_spike_trigger
npc_crystal_spike_trigger()
Definition
boss_ormorok.cpp:173
spell_crystal_spike::spell_crystal_spike_AuraScript
Definition
boss_ormorok.cpp:239
spell_crystal_spike::spell_crystal_spike_AuraScript::Register
void Register() OVERRIDE
Definition
boss_ormorok.cpp:254
spell_crystal_spike::spell_crystal_spike_AuraScript::HandlePeriodic
void HandlePeriodic(AuraEffect const *)
Definition
boss_ormorok.cpp:242
spell_crystal_spike::spell_crystal_spike_AuraScript::PrepareAuraScript
PrepareAuraScript(spell_crystal_spike_AuraScript)
spell_crystal_spike
Definition
boss_ormorok.cpp:234
spell_crystal_spike::spell_crystal_spike
spell_crystal_spike()
Definition
boss_ormorok.cpp:236
spell_crystal_spike::GetAuraScript
AuraScript * GetAuraScript() const OVERRIDE
Definition
boss_ormorok.cpp:260
nexus.h
DATA_ORMOROK_EVENT
@ DATA_ORMOROK_EVENT
Definition
nexus.h:13
ScriptedAI::IsHeroic
bool IsHeroic() const
Definition
ScriptedCreature.h:279
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::HealthBelowPct
bool HealthBelowPct(uint32 pct) const
Definition
ScriptedCreature.h:247
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
Yells
Definition
boss_illidan.cpp:256
boss_ormorok::boss_ormorokAI
Definition
boss_ormorok.cpp:56
boss_ormorok::boss_ormorokAI::KilledUnit
void KilledUnit(Unit *) OVERRIDE
Definition
boss_ormorok.cpp:94
boss_ormorok::boss_ormorokAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_ormorok.cpp:84
boss_ormorok::boss_ormorokAI::boss_ormorokAI
boss_ormorokAI(Creature *creature)
Definition
boss_ormorok.cpp:57
boss_ormorok::boss_ormorokAI::DamageTaken
void DamageTaken(Unit *, uint32 &) OVERRIDE
Definition
boss_ormorok.cpp:75
boss_ormorok::boss_ormorokAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_ormorok.cpp:99
boss_ormorok::boss_ormorokAI::frenzy
bool frenzy
Definition
boss_ormorok.cpp:141
boss_ormorok::boss_ormorokAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_ormorok.cpp:59
npc_crystal_spike_trigger::npc_crystal_spike_triggerAI
Definition
boss_ormorok.cpp:176
npc_crystal_spike_trigger::npc_crystal_spike_triggerAI::npc_crystal_spike_triggerAI
npc_crystal_spike_triggerAI(Creature *creature)
Definition
boss_ormorok.cpp:177
npc_crystal_spike_trigger::npc_crystal_spike_triggerAI::IsSummonedBy
void IsSummonedBy(Unit *owner) OVERRIDE
Definition
boss_ormorok.cpp:179
npc_crystal_spike_trigger::npc_crystal_spike_triggerAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_ormorok.cpp:208
npc_crystal_spike_trigger::npc_crystal_spike_triggerAI::_count
uint32 _count
Definition
boss_ormorok.cpp:223
npc_crystal_spike_trigger::npc_crystal_spike_triggerAI::_despawntimer
uint32 _despawntimer
Definition
boss_ormorok.cpp:224
npc_crystal_spike_trigger::npc_crystal_spike_triggerAI::GetData
uint32 GetData(uint32 type) const OVERRIDE
Definition
boss_ormorok.cpp:203
src
server
scripts
Northrend
Nexus
Nexus
boss_ormorok.cpp
Generated on
for Project SkyFire Core by
1.17.0