Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_archavon.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 "
vault_of_archavon.h
"
10
11
enum
Emotes
12
{
13
EMOTE_BERSERK
= 0,
14
EMOTE_LEAP
= 1
// Not in use
15
};
16
17
enum
Spells
18
{
19
// Spells Archavon
20
SPELL_ROCK_SHARDS
= 58678,
21
SPELL_ROCK_SHARDS_VISUAL_L
= 58689,
22
SPELL_ROCK_SHARDS_VISUAL_R
= 58692,
23
SPELL_ROCK_SHARDS_DAMAGE_L
= 58695,
24
SPELL_ROCK_SHARDS_DAMAGE_R
= 58696,
25
SPELL_CRUSHING_LEAP
= 58960,
26
SPELL_STOMP
= 58663,
27
SPELL_IMPALE
= 58666,
28
SPELL_BERSERK
= 47008,
29
30
// Archavon Warders
31
SPELL_ROCK_SHOWER
= 60919,
32
SPELL_SHIELD_CRUSH
= 60897,
33
SPELL_WHIRL
= 60902
34
};
35
36
enum
Creatures
37
{
38
NPC_ARCHAVON_WARDER
= 32353
39
};
40
41
enum
Events
42
{
43
// Archavon
44
EVENT_ROCK_SHARDS
= 1,
// 15s cd
45
EVENT_CHOKING_CLOUD
= 2,
// 30s cd
46
EVENT_STOMP
= 3,
// 45s cd
47
EVENT_IMPALE
= 4,
48
EVENT_BERSERK
= 5,
// 300s cd
49
50
//mob
51
EVENT_ROCK_SHOWER
= 6,
// set = 20s cd, unkown cd
52
EVENT_SHIELD_CRUSH
= 7,
// set = 30s cd
53
EVENT_WHIRL
= 8,
// set= 10s cd
54
};
55
56
class
boss_archavon
:
public
CreatureScript
57
{
58
public
:
59
boss_archavon
() :
CreatureScript
(
"boss_archavon"
) { }
60
61
struct
boss_archavonAI
:
public
BossAI
62
{
63
boss_archavonAI
(
Creature
* creature) :
BossAI
(creature,
DATA_ARCHAVON
)
64
{
65
}
66
67
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
68
{
69
events
.ScheduleEvent(
EVENT_ROCK_SHARDS
, 15000);
70
events
.ScheduleEvent(
EVENT_CHOKING_CLOUD
, 30000);
71
events
.ScheduleEvent(
EVENT_STOMP
, 45000);
72
events
.ScheduleEvent(
EVENT_BERSERK
, 300000);
73
74
_EnterCombat
();
75
}
76
77
// Below UpdateAI may need review/debug.
78
void
UpdateAI
(
uint32
diff)
OVERRIDE
79
{
80
if
(!
UpdateVictim
())
81
return
;
82
83
events
.Update(diff);
84
85
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
86
return
;
87
88
while
(
uint32
eventId =
events
.ExecuteEvent())
89
{
90
switch
(eventId)
91
{
92
case
EVENT_ROCK_SHARDS
:
93
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
94
DoCast
(target,
SPELL_ROCK_SHARDS
);
95
events
.ScheduleEvent(
EVENT_ROCK_SHARDS
, 15000);
96
break
;
97
case
EVENT_CHOKING_CLOUD
:
98
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
99
DoCast
(target,
SPELL_CRUSHING_LEAP
,
true
);
//10y~80y, ignore range
100
events
.ScheduleEvent(
EVENT_CHOKING_CLOUD
, 30000);
101
break
;
102
case
EVENT_STOMP
:
103
DoCastVictim
(
SPELL_STOMP
);
104
events
.ScheduleEvent(
EVENT_IMPALE
, 3000);
105
events
.ScheduleEvent(
EVENT_STOMP
, 45000);
106
break
;
107
case
EVENT_IMPALE
:
108
DoCastVictim
(
SPELL_IMPALE
);
109
break
;
110
case
EVENT_BERSERK
:
111
DoCast
(
me
,
SPELL_BERSERK
);
112
Talk
(
EMOTE_BERSERK
);
113
break
;
114
default
:
115
break
;
116
}
117
}
118
119
DoMeleeAttackIfReady
();
120
}
121
};
122
123
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
124
{
125
return
new
boss_archavonAI
(creature);
126
}
127
};
128
129
/*######
130
## Mob Archavon Warder
131
######*/
132
class
npc_archavon_warder
:
public
CreatureScript
133
{
134
public
:
135
npc_archavon_warder
() :
CreatureScript
(
"npc_archavon_warder"
) { }
136
137
struct
npc_archavon_warderAI
:
public
ScriptedAI
//npc 32353
138
{
139
npc_archavon_warderAI
(
Creature
* creature) :
ScriptedAI
(creature)
140
{
141
}
142
143
EventMap
events
;
144
145
void
Reset
()
OVERRIDE
146
{
147
events
.Reset();
148
events
.ScheduleEvent(
EVENT_ROCK_SHOWER
, 2000);
149
events
.ScheduleEvent(
EVENT_SHIELD_CRUSH
, 20000);
150
events
.ScheduleEvent(
EVENT_WHIRL
, 7500);
151
}
152
153
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
154
{
155
DoZoneInCombat
();
156
}
157
158
void
UpdateAI
(
uint32
diff)
OVERRIDE
159
{
160
if
(!
UpdateVictim
())
161
return
;
162
163
events
.Update(diff);
164
165
if
(
me
->HasUnitState(
UNIT_STATE_CASTING
))
166
return
;
167
168
while
(
uint32
eventId =
events
.ExecuteEvent())
169
{
170
switch
(eventId)
171
{
172
case
EVENT_ROCK_SHOWER
:
173
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
174
DoCast
(target,
SPELL_ROCK_SHOWER
);
175
events
.ScheduleEvent(
EVENT_ROCK_SHARDS
, 6000);
176
break
;
177
case
EVENT_SHIELD_CRUSH
:
178
DoCastVictim
(
SPELL_SHIELD_CRUSH
);
179
events
.ScheduleEvent(
EVENT_SHIELD_CRUSH
, 20000);
180
break
;
181
case
EVENT_WHIRL
:
182
DoCastVictim
(
SPELL_WHIRL
);
183
events
.ScheduleEvent(
EVENT_WHIRL
, 8000);
184
break
;
185
default
:
186
break
;
187
}
188
}
189
190
DoMeleeAttackIfReady
();
191
}
192
};
193
194
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
195
{
196
return
new
npc_archavon_warderAI
(creature);
197
}
198
};
199
200
// 58941 - Rock Shards
201
class
spell_archavon_rock_shards
:
public
SpellScriptLoader
202
{
203
public
:
204
spell_archavon_rock_shards
() :
SpellScriptLoader
(
"spell_archavon_rock_shards"
) { }
205
206
class
spell_archavon_rock_shards_SpellScript
:
public
SpellScript
207
{
208
PrepareSpellScript
(
spell_archavon_rock_shards_SpellScript
);
209
210
bool
Validate
(
SpellInfo
const
*
/*spellInfo*/
)
OVERRIDE
211
{
212
if
(!
sSpellMgr
->GetSpellInfo(
SPELL_ROCK_SHARDS_VISUAL_L
)
213
|| !
sSpellMgr
->GetSpellInfo(
SPELL_ROCK_SHARDS_VISUAL_R
)
214
|| !
sSpellMgr
->GetSpellInfo(
SPELL_ROCK_SHARDS_DAMAGE_L
)
215
|| !
sSpellMgr
->GetSpellInfo(
SPELL_ROCK_SHARDS_DAMAGE_R
))
216
return
false
;
217
return
true
;
218
}
219
220
void
HandleScript
(
SpellEffIndex
/*effIndex*/
)
221
{
222
Unit
* caster =
GetCaster
();
223
224
for
(
uint8
i = 0; i < 3; ++i)
225
{
226
caster->
CastSpell
((
Unit
*)NULL,
SPELL_ROCK_SHARDS_VISUAL_L
,
true
);
227
caster->
CastSpell
((
Unit
*)NULL,
SPELL_ROCK_SHARDS_VISUAL_R
,
true
);
228
}
229
230
caster->
CastSpell
((
Unit
*)NULL,
SPELL_ROCK_SHARDS_DAMAGE_L
,
true
);
231
caster->
CastSpell
((
Unit
*)NULL,
SPELL_ROCK_SHARDS_DAMAGE_R
,
true
);
232
}
233
234
void
Register
()
OVERRIDE
235
{
236
OnEffectHit
+=
SpellEffectFn
(
spell_archavon_rock_shards_SpellScript::HandleScript
,
EFFECT_0
,
SPELL_EFFECT_SCRIPT_EFFECT
);
237
}
238
};
239
240
SpellScript
*
GetSpellScript
() const
OVERRIDE
241
{
242
return
new
spell_archavon_rock_shards_SpellScript
();
243
}
244
};
245
246
void
AddSC_boss_archavon
()
247
{
248
new
boss_archavon
();
249
new
npc_archavon_warder
();
250
new
spell_archavon_rock_shards
();
251
}
Spells
Spells
Definition
BattlegroundIC.h:645
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
ScriptMgr.h
ScriptedCreature.h
SpellEffIndex
SpellEffIndex
Definition
SharedDefines.h:17
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:18
SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition
SharedDefines.h:965
sSpellMgr
#define sSpellMgr
Definition
SpellMgr.h:744
SpellScript.h
SpellEffectFn
#define SpellEffectFn(F, I, N)
Definition
SpellScript.h:269
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
Creatures
Creatures
Definition
alterac_valley.cpp:28
Events
Events
Definition
alterac_valley.cpp:40
NPC_ARCHAVON_WARDER
@ NPC_ARCHAVON_WARDER
Definition
boss_archavon.cpp:38
EMOTE_LEAP
@ EMOTE_LEAP
Definition
boss_archavon.cpp:14
EMOTE_BERSERK
@ EMOTE_BERSERK
Definition
boss_archavon.cpp:13
SPELL_STOMP
@ SPELL_STOMP
Definition
boss_archavon.cpp:26
SPELL_ROCK_SHARDS
@ SPELL_ROCK_SHARDS
Definition
boss_archavon.cpp:20
SPELL_ROCK_SHARDS_DAMAGE_R
@ SPELL_ROCK_SHARDS_DAMAGE_R
Definition
boss_archavon.cpp:24
SPELL_ROCK_SHOWER
@ SPELL_ROCK_SHOWER
Definition
boss_archavon.cpp:31
SPELL_ROCK_SHARDS_VISUAL_R
@ SPELL_ROCK_SHARDS_VISUAL_R
Definition
boss_archavon.cpp:22
SPELL_SHIELD_CRUSH
@ SPELL_SHIELD_CRUSH
Definition
boss_archavon.cpp:32
SPELL_ROCK_SHARDS_VISUAL_L
@ SPELL_ROCK_SHARDS_VISUAL_L
Definition
boss_archavon.cpp:21
SPELL_WHIRL
@ SPELL_WHIRL
Definition
boss_archavon.cpp:33
SPELL_BERSERK
@ SPELL_BERSERK
Definition
boss_archavon.cpp:28
SPELL_CRUSHING_LEAP
@ SPELL_CRUSHING_LEAP
Definition
boss_archavon.cpp:25
SPELL_ROCK_SHARDS_DAMAGE_L
@ SPELL_ROCK_SHARDS_DAMAGE_L
Definition
boss_archavon.cpp:23
SPELL_IMPALE
@ SPELL_IMPALE
Definition
boss_archavon.cpp:27
AddSC_boss_archavon
void AddSC_boss_archavon()
Definition
boss_archavon.cpp:246
EVENT_SHIELD_CRUSH
@ EVENT_SHIELD_CRUSH
Definition
boss_archavon.cpp:52
EVENT_WHIRL
@ EVENT_WHIRL
Definition
boss_archavon.cpp:53
EVENT_ROCK_SHOWER
@ EVENT_ROCK_SHOWER
Definition
boss_archavon.cpp:51
EVENT_BERSERK
@ EVENT_BERSERK
Definition
boss_archavon.cpp:48
EVENT_ROCK_SHARDS
@ EVENT_ROCK_SHARDS
Definition
boss_archavon.cpp:44
EVENT_STOMP
@ EVENT_STOMP
Definition
boss_archavon.cpp:46
EVENT_IMPALE
@ EVENT_IMPALE
Definition
boss_archavon.cpp:47
EVENT_CHOKING_CLOUD
@ EVENT_CHOKING_CLOUD
Definition
boss_archavon.cpp:45
Emotes
Emotes
Definition
boss_chromaggus.cpp:12
SPELL_BERSERK
#define SPELL_BERSERK
Definition
boss_four_horsemen.cpp:62
EMOTE_BERSERK
@ EMOTE_BERSERK
Definition
boss_huhuran.cpp:19
SPELL_WHIRL
@ SPELL_WHIRL
Definition
boss_northrend_beasts.cpp:88
SPELL_IMPALE
@ SPELL_IMPALE
Definition
boss_northrend_beasts.cpp:57
EVENT_WHIRL
@ EVENT_WHIRL
Definition
boss_northrend_beasts.cpp:127
EVENT_IMPALE
@ EVENT_IMPALE
Definition
boss_northrend_beasts.cpp:104
EVENT_BERSERK
@ EVENT_BERSERK
Definition
boss_occuthar.cpp:31
EVENT_STOMP
@ EVENT_STOMP
Definition
boss_razorgore.cpp:46
SPELL_STOMP
@ SPELL_STOMP
Definition
chapter5.cpp:158
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::DoZoneInCombat
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
Definition
CreatureAI.cpp:33
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
EventMap
Definition
CreatureAIImpl.h:304
SpellInfo
Definition
SpellInfo.h:158
SpellScript
Definition
SpellScript.h:139
SpellScript::OnEffectHit
HookList< EffectHandler > OnEffectHit
Definition
SpellScript.h:267
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
Unit
Definition
Unit.h:1367
Unit::CastSpell
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
Definition
UnitCombat.cpp:324
boss_archavon
Definition
boss_archavon.cpp:57
boss_archavon::boss_archavon
boss_archavon()
Definition
boss_archavon.cpp:59
boss_archavon::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_archavon.cpp:123
npc_archavon_warder
Definition
boss_archavon.cpp:133
npc_archavon_warder::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_archavon.cpp:194
npc_archavon_warder::npc_archavon_warder
npc_archavon_warder()
Definition
boss_archavon.cpp:135
spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript
Definition
boss_archavon.cpp:207
spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript::Validate
bool Validate(SpellInfo const *) OVERRIDE
Definition
boss_archavon.cpp:210
spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript::Register
void Register() OVERRIDE
Definition
boss_archavon.cpp:234
spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript::HandleScript
void HandleScript(SpellEffIndex)
Definition
boss_archavon.cpp:220
spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript::PrepareSpellScript
PrepareSpellScript(spell_archavon_rock_shards_SpellScript)
spell_archavon_rock_shards
Definition
boss_archavon.cpp:202
spell_archavon_rock_shards::GetSpellScript
SpellScript * GetSpellScript() const OVERRIDE
Definition
boss_archavon.cpp:240
spell_archavon_rock_shards::spell_archavon_rock_shards
spell_archavon_rock_shards()
Definition
boss_archavon.cpp:204
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
boss_archavon::boss_archavonAI
Definition
boss_archavon.cpp:62
boss_archavon::boss_archavonAI::boss_archavonAI
boss_archavonAI(Creature *creature)
Definition
boss_archavon.cpp:63
boss_archavon::boss_archavonAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_archavon.cpp:78
boss_archavon::boss_archavonAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_archavon.cpp:67
npc_archavon_warder::npc_archavon_warderAI
Definition
boss_archavon.cpp:138
npc_archavon_warder::npc_archavon_warderAI::npc_archavon_warderAI
npc_archavon_warderAI(Creature *creature)
Definition
boss_archavon.cpp:139
npc_archavon_warder::npc_archavon_warderAI::events
EventMap events
Definition
boss_archavon.cpp:143
npc_archavon_warder::npc_archavon_warderAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_archavon.cpp:158
npc_archavon_warder::npc_archavon_warderAI::Reset
void Reset() OVERRIDE
Definition
boss_archavon.cpp:145
npc_archavon_warder::npc_archavon_warderAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_archavon.cpp:153
vault_of_archavon.h
DATA_ARCHAVON
@ DATA_ARCHAVON
Definition
vault_of_archavon.h:13
src
server
scripts
Northrend
VaultOfArchavon
boss_archavon.cpp
Generated on
for Project SkyFire Core by
1.17.0