Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
pit_of_saron.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 "
SpellScript.h
"
9
#include "
SpellAuraEffects.h
"
10
#include "
pit_of_saron.h
"
11
#include "
Vehicle.h
"
12
13
enum
Spells
14
{
15
SPELL_FIREBALL
= 69583,
//Ymirjar Flamebearer
16
SPELL_HELLFIRE
= 69586,
17
SPELL_TACTICAL_BLINK
= 69584,
18
SPELL_FROST_BREATH
= 69527,
//Iceborn Proto-Drake
19
SPELL_LEAPING_FACE_MAUL
= 69504,
// Geist Ambusher
20
};
21
22
enum
Events
23
{
24
// Ymirjar Flamebearer
25
EVENT_FIREBALL
= 1,
26
EVENT_TACTICAL_BLINK
= 2,
27
};
28
29
class
npc_ymirjar_flamebearer
:
public
CreatureScript
30
{
31
public
:
32
npc_ymirjar_flamebearer
() :
CreatureScript
(
"npc_ymirjar_flamebearer"
) { }
33
34
struct
npc_ymirjar_flamebearerAI
:
public
ScriptedAI
35
{
36
npc_ymirjar_flamebearerAI
(
Creature
* creature) :
ScriptedAI
(creature)
37
{
38
}
39
40
void
Reset
()
OVERRIDE
41
{
42
_events
.Reset();
43
}
44
45
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
46
{
47
_events
.ScheduleEvent(
EVENT_FIREBALL
, 4000);
48
_events
.ScheduleEvent(
EVENT_TACTICAL_BLINK
, 15000);
49
}
50
51
void
UpdateAI
(
uint32
diff)
OVERRIDE
52
{
53
if
(!
UpdateVictim
())
54
return
;
55
56
_events
.Update(diff);
57
58
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
59
return
;
60
61
while
(
uint32
eventId =
_events
.ExecuteEvent())
62
{
63
switch
(eventId)
64
{
65
case
EVENT_FIREBALL
:
66
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
67
DoCast
(target,
SPELL_FIREBALL
);
68
_events
.RescheduleEvent(
EVENT_FIREBALL
, 5000);
69
break
;
70
case
EVENT_TACTICAL_BLINK
:
71
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
72
DoCast
(target,
SPELL_TACTICAL_BLINK
);
73
DoCast
(
me
,
SPELL_HELLFIRE
);
74
_events
.RescheduleEvent(
EVENT_TACTICAL_BLINK
, 12000);
75
break
;
76
default
:
77
break
;
78
}
79
}
80
81
DoMeleeAttackIfReady
();
82
}
83
84
private
:
85
EventMap
_events
;
86
};
87
88
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
89
{
90
return
new
npc_ymirjar_flamebearerAI
(creature);
91
}
92
};
93
94
class
npc_iceborn_protodrake
:
public
CreatureScript
95
{
96
public
:
97
npc_iceborn_protodrake
() :
CreatureScript
(
"npc_iceborn_protodrake"
) { }
98
99
struct
npc_iceborn_protodrakeAI
:
public
ScriptedAI
100
{
101
npc_iceborn_protodrakeAI
(
Creature
* creature) :
ScriptedAI
(creature),
_vehicle
(creature->GetVehicleKit())
102
{
103
ASSERT
(
_vehicle
);
104
}
105
106
void
Reset
()
OVERRIDE
107
{
108
_frostBreathCooldown
= 5000;
109
}
110
111
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
112
{
113
_vehicle
->RemoveAllPassengers();
114
}
115
116
void
UpdateAI
(
uint32
diff)
OVERRIDE
117
{
118
if
(!
UpdateVictim
())
119
return
;
120
121
if
(
_frostBreathCooldown
< diff)
122
{
123
DoCastVictim
(
SPELL_FROST_BREATH
);
124
_frostBreathCooldown
= 10000;
125
}
126
else
127
_frostBreathCooldown
-= diff;
128
129
DoMeleeAttackIfReady
();
130
}
131
132
private
:
133
Vehicle
*
_vehicle
;
134
uint32
_frostBreathCooldown
;
135
};
136
137
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
138
{
139
return
new
npc_iceborn_protodrakeAI
(creature);
140
}
141
};
142
143
class
npc_geist_ambusher
:
public
CreatureScript
144
{
145
public
:
146
npc_geist_ambusher
() :
CreatureScript
(
"npc_geist_ambusher"
) { }
147
148
struct
npc_geist_ambusherAI
:
public
ScriptedAI
149
{
150
npc_geist_ambusherAI
(
Creature
* creature) :
ScriptedAI
(creature)
151
{
152
}
153
154
void
Reset
()
OVERRIDE
155
{
156
_leapingFaceMaulCooldown
= 9000;
157
}
158
159
void
EnterCombat
(
Unit
* who)
OVERRIDE
160
{
161
if
(who->GetTypeId() !=
TypeID::TYPEID_PLAYER
)
162
return
;
163
164
// the max range is determined by aggro range
165
if
(
me
->GetDistance(who) > 5.0f)
166
DoCast
(who,
SPELL_LEAPING_FACE_MAUL
);
167
}
168
169
void
UpdateAI
(
uint32
diff)
OVERRIDE
170
{
171
if
(!
UpdateVictim
())
172
return
;
173
174
if
(
_leapingFaceMaulCooldown
< diff)
175
{
176
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0, 5.0f,
true
))
177
DoCast
(target,
SPELL_LEAPING_FACE_MAUL
);
178
_leapingFaceMaulCooldown
= std::rand() % 14000 + 9000;
179
}
180
else
181
_leapingFaceMaulCooldown
-= diff;
182
183
DoMeleeAttackIfReady
();
184
}
185
186
private
:
187
uint32
_leapingFaceMaulCooldown
;
188
};
189
190
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
191
{
192
return
new
npc_geist_ambusherAI
(creature);
193
}
194
};
195
196
class
spell_trash_npc_glacial_strike
:
public
SpellScriptLoader
197
{
198
public
:
199
spell_trash_npc_glacial_strike
() :
SpellScriptLoader
(
"spell_trash_npc_glacial_strike"
) { }
200
201
class
spell_trash_npc_glacial_strike_AuraScript
:
public
AuraScript
202
{
203
PrepareAuraScript
(
spell_trash_npc_glacial_strike_AuraScript
);
204
205
void
PeriodicTick
(
AuraEffect
const
*
/*aurEff*/
)
206
{
207
if
(
GetTarget
()->IsFullHealth())
208
{
209
GetTarget
()->
RemoveAura
(
GetId
(), 0, 0,
AURA_REMOVE_BY_ENEMY_SPELL
);
210
PreventDefaultAction
();
211
}
212
}
213
214
void
Register
()
OVERRIDE
215
{
216
OnEffectPeriodic
+=
AuraEffectPeriodicFn
(
spell_trash_npc_glacial_strike_AuraScript::PeriodicTick
,
EFFECT_2
,
SPELL_AURA_PERIODIC_DAMAGE_PERCENT
);
217
}
218
};
219
220
AuraScript
*
GetAuraScript
() const
OVERRIDE
221
{
222
return
new
spell_trash_npc_glacial_strike_AuraScript
();
223
}
224
};
225
226
void
AddSC_pit_of_saron
()
227
{
228
new
npc_ymirjar_flamebearer
();
229
new
npc_iceborn_protodrake
();
230
new
npc_geist_ambusher
();
231
new
spell_trash_npc_glacial_strike
();
232
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
ASSERT
#define ASSERT
Definition
Errors.h:29
TypeID::TYPEID_PLAYER
@ TYPEID_PLAYER
Definition
Object.h:55
ScriptMgr.h
ScriptedCreature.h
EFFECT_2
@ EFFECT_2
Definition
SharedDefines.h:20
SPELL_AURA_PERIODIC_DAMAGE_PERCENT
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition
SpellAuraDefines.h:136
SpellAuraEffects.h
SpellScript.h
AuraEffectPeriodicFn
#define AuraEffectPeriodicFn(F, I, N)
Definition
SpellScript.h:669
AURA_REMOVE_BY_ENEMY_SPELL
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition
Unit.h:409
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
Vehicle.h
Events
Events
Definition
alterac_valley.cpp:40
SPELL_FIREBALL
@ SPELL_FIREBALL
Definition
boss_balinda.cpp:13
SPELL_FROST_BREATH
@ SPELL_FROST_BREATH
Definition
boss_kalecgos.cpp:48
SPELL_HELLFIRE
@ SPELL_HELLFIRE
Definition
boss_prince_malchezaar.cpp:76
EVENT_FIREBALL
@ EVENT_FIREBALL
Definition
boss_razorgore.cpp:47
AuraEffect
Definition
SpellAuraEffects.h:18
AuraScript
Definition
SpellScript.h:436
AuraScript::PreventDefaultAction
void PreventDefaultAction()
Definition
SpellScript.cpp:905
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
AuraScript::GetId
uint32 GetId() const
Definition
SpellScript.cpp:930
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
EventMap
Definition
CreatureAIImpl.h:304
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
Unit
Definition
Unit.h:1367
Unit::RemoveAura
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition
UnitAuraState.cpp:459
Vehicle
Definition
Vehicle.h:22
npc_geist_ambusher
Definition
pit_of_saron.cpp:144
npc_geist_ambusher::npc_geist_ambusher
npc_geist_ambusher()
Definition
pit_of_saron.cpp:146
npc_geist_ambusher::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
pit_of_saron.cpp:190
npc_iceborn_protodrake
Definition
pit_of_saron.cpp:95
npc_iceborn_protodrake::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
pit_of_saron.cpp:137
npc_iceborn_protodrake::npc_iceborn_protodrake
npc_iceborn_protodrake()
Definition
pit_of_saron.cpp:97
npc_ymirjar_flamebearer
Definition
pit_of_saron.cpp:30
npc_ymirjar_flamebearer::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
pit_of_saron.cpp:88
npc_ymirjar_flamebearer::npc_ymirjar_flamebearer
npc_ymirjar_flamebearer()
Definition
pit_of_saron.cpp:32
spell_trash_npc_glacial_strike::spell_trash_npc_glacial_strike_AuraScript
Definition
pit_of_saron.cpp:202
spell_trash_npc_glacial_strike::spell_trash_npc_glacial_strike_AuraScript::Register
void Register() OVERRIDE
Definition
pit_of_saron.cpp:214
spell_trash_npc_glacial_strike::spell_trash_npc_glacial_strike_AuraScript::PrepareAuraScript
PrepareAuraScript(spell_trash_npc_glacial_strike_AuraScript)
spell_trash_npc_glacial_strike::spell_trash_npc_glacial_strike_AuraScript::PeriodicTick
void PeriodicTick(AuraEffect const *)
Definition
pit_of_saron.cpp:205
spell_trash_npc_glacial_strike
Definition
pit_of_saron.cpp:197
spell_trash_npc_glacial_strike::spell_trash_npc_glacial_strike
spell_trash_npc_glacial_strike()
Definition
pit_of_saron.cpp:199
spell_trash_npc_glacial_strike::GetAuraScript
AuraScript * GetAuraScript() const OVERRIDE
Definition
pit_of_saron.cpp:220
SPELL_FROST_BREATH
@ SPELL_FROST_BREATH
Definition
pit_of_saron.cpp:18
SPELL_HELLFIRE
@ SPELL_HELLFIRE
Definition
pit_of_saron.cpp:16
SPELL_TACTICAL_BLINK
@ SPELL_TACTICAL_BLINK
Definition
pit_of_saron.cpp:17
SPELL_FIREBALL
@ SPELL_FIREBALL
Definition
pit_of_saron.cpp:15
SPELL_LEAPING_FACE_MAUL
@ SPELL_LEAPING_FACE_MAUL
Definition
pit_of_saron.cpp:19
AddSC_pit_of_saron
void AddSC_pit_of_saron()
Definition
pit_of_saron.cpp:226
EVENT_FIREBALL
@ EVENT_FIREBALL
Definition
pit_of_saron.cpp:25
EVENT_TACTICAL_BLINK
@ EVENT_TACTICAL_BLINK
Definition
pit_of_saron.cpp:26
pit_of_saron.h
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_geist_ambusher::npc_geist_ambusherAI
Definition
pit_of_saron.cpp:149
npc_geist_ambusher::npc_geist_ambusherAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
pit_of_saron.cpp:169
npc_geist_ambusher::npc_geist_ambusherAI::EnterCombat
void EnterCombat(Unit *who) OVERRIDE
Definition
pit_of_saron.cpp:159
npc_geist_ambusher::npc_geist_ambusherAI::_leapingFaceMaulCooldown
uint32 _leapingFaceMaulCooldown
Definition
pit_of_saron.cpp:187
npc_geist_ambusher::npc_geist_ambusherAI::Reset
void Reset() OVERRIDE
Definition
pit_of_saron.cpp:154
npc_geist_ambusher::npc_geist_ambusherAI::npc_geist_ambusherAI
npc_geist_ambusherAI(Creature *creature)
Definition
pit_of_saron.cpp:150
npc_iceborn_protodrake::npc_iceborn_protodrakeAI
Definition
pit_of_saron.cpp:100
npc_iceborn_protodrake::npc_iceborn_protodrakeAI::_frostBreathCooldown
uint32 _frostBreathCooldown
Definition
pit_of_saron.cpp:134
npc_iceborn_protodrake::npc_iceborn_protodrakeAI::_vehicle
Vehicle * _vehicle
Definition
pit_of_saron.cpp:133
npc_iceborn_protodrake::npc_iceborn_protodrakeAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
pit_of_saron.cpp:116
npc_iceborn_protodrake::npc_iceborn_protodrakeAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
pit_of_saron.cpp:111
npc_iceborn_protodrake::npc_iceborn_protodrakeAI::npc_iceborn_protodrakeAI
npc_iceborn_protodrakeAI(Creature *creature)
Definition
pit_of_saron.cpp:101
npc_iceborn_protodrake::npc_iceborn_protodrakeAI::Reset
void Reset() OVERRIDE
Definition
pit_of_saron.cpp:106
npc_ymirjar_flamebearer::npc_ymirjar_flamebearerAI
Definition
pit_of_saron.cpp:35
npc_ymirjar_flamebearer::npc_ymirjar_flamebearerAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
pit_of_saron.cpp:45
npc_ymirjar_flamebearer::npc_ymirjar_flamebearerAI::Reset
void Reset() OVERRIDE
Definition
pit_of_saron.cpp:40
npc_ymirjar_flamebearer::npc_ymirjar_flamebearerAI::_events
EventMap _events
Definition
pit_of_saron.cpp:85
npc_ymirjar_flamebearer::npc_ymirjar_flamebearerAI::npc_ymirjar_flamebearerAI
npc_ymirjar_flamebearerAI(Creature *creature)
Definition
pit_of_saron.cpp:36
npc_ymirjar_flamebearer::npc_ymirjar_flamebearerAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
pit_of_saron.cpp:51
src
server
scripts
Northrend
FrozenHalls
PitOfSaron
pit_of_saron.cpp
Generated on
for Project SkyFire Core by
1.17.0