Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_skeram.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 "
temple_of_ahnqiraj.h
"
10
11
enum
Yells
12
{
13
SAY_AGGRO
= 0,
14
SAY_SLAY
= 1,
15
SAY_SPLIT
= 2,
16
SAY_DEATH
= 3
17
};
18
19
enum
Spells
20
{
21
SPELL_ARCANE_EXPLOSION
= 26192,
22
SPELL_EARTH_SHOCK
= 26194,
23
SPELL_TRUE_FULFILLMENT
= 785,
24
SPELL_INITIALIZE_IMAGE
= 3730,
25
SPELL_SUMMON_IMAGES
= 747
26
};
27
28
enum
Events
29
{
30
EVENT_ARCANE_EXPLOSION
= 1,
31
EVENT_FULLFILMENT
= 2,
32
EVENT_BLINK
= 3,
33
EVENT_EARTH_SHOCK
= 4
34
};
35
36
uint32
const
BlinkSpells
[3] = { 4801, 8195, 20449 };
37
38
class
boss_skeram
:
public
CreatureScript
39
{
40
public
:
41
boss_skeram
() :
CreatureScript
(
"boss_skeram"
) { }
42
43
struct
boss_skeramAI
:
public
BossAI
44
{
45
boss_skeramAI
(
Creature
* creature) :
BossAI
(creature,
DATA_SKERAM
) { }
46
47
void
Reset
()
OVERRIDE
48
{
49
_flag
= 0;
50
_hpct
= 75.0f;
51
me
->SetVisible(
true
);
52
}
53
54
void
KilledUnit
(
Unit
*
/*victim*/
)
OVERRIDE
55
{
56
Talk
(
SAY_SLAY
);
57
}
58
59
void
EnterEvadeMode
()
OVERRIDE
60
{
61
ScriptedAI::EnterEvadeMode
();
62
if
(
me
->IsSummon())
63
((
TempSummon
*)
me
)->UnSummon();
64
}
65
66
void
JustSummoned
(
Creature
* creature)
OVERRIDE
67
{
68
// Shift the boss and images (Get it? *Shift*?)
69
uint8
rand = 0;
70
if
(
_flag
!= 0)
71
{
72
while
(
_flag
& (1 << rand))
73
rand = std::rand() % 2;
74
DoCast
(
me
,
BlinkSpells
[rand]);
75
_flag
|= (1 << rand);
76
_flag
|= (1 << 7);
77
}
78
79
while
(
_flag
& (1 << rand))
80
rand = std::rand() % 2;
81
creature->CastSpell(creature,
BlinkSpells
[rand]);
82
_flag
|= (1 << rand);
83
84
if
(
_flag
& (1 << 7))
85
_flag
= 0;
86
87
if
(
Unit
* Target =
SelectTarget
(
SELECT_TARGET_RANDOM
))
88
creature->AI()->AttackStart(Target);
89
90
float
ImageHealthPct;
91
92
if
(
me
->GetHealthPct() < 25.0f)
93
ImageHealthPct = 0.50f;
94
else
if
(
me
->GetHealthPct() < 50.0f)
95
ImageHealthPct = 0.20f;
96
else
97
ImageHealthPct = 0.10f;
98
99
creature->SetMaxHealth(
me
->GetMaxHealth() * ImageHealthPct);
100
creature->SetHealth(creature->GetMaxHealth() * (
me
->GetHealthPct() / 100.0f));
101
}
102
103
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
104
{
105
if
(!
me
->IsSummon())
106
Talk
(
SAY_DEATH
);
107
else
108
me
->RemoveCorpse();
109
}
110
111
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
112
{
113
_EnterCombat
();
114
events
.Reset();
115
116
events
.ScheduleEvent(
EVENT_ARCANE_EXPLOSION
, std::rand() % 12000 + 6000);
117
events
.ScheduleEvent(
EVENT_FULLFILMENT
, 15000);
118
events
.ScheduleEvent(
EVENT_BLINK
, std::rand() % 45000 + 30000);
119
events
.ScheduleEvent(
EVENT_EARTH_SHOCK
, 2000);
120
121
Talk
(
SAY_AGGRO
);
122
}
123
124
void
UpdateAI
(
uint32
diff)
OVERRIDE
125
{
126
if
(!
UpdateVictim
())
127
return
;
128
129
events
.Update(diff);
130
131
while
(
uint32
eventId =
events
.ExecuteEvent())
132
{
133
switch
(eventId)
134
{
135
case
EVENT_ARCANE_EXPLOSION
:
136
DoCastAOE
(
SPELL_ARCANE_EXPLOSION
,
true
);
137
events
.ScheduleEvent(
EVENT_ARCANE_EXPLOSION
, std::rand() % 18000 + 8000);
138
break
;
139
case
EVENT_FULLFILMENT
:
141
// Spell actually works, tested in duel
142
DoCast
(
SelectTarget
(
SELECT_TARGET_RANDOM
, 0, 0.0f,
true
),
SPELL_TRUE_FULFILLMENT
,
true
);
143
events
.ScheduleEvent(
EVENT_FULLFILMENT
, std::rand() % 30000 + 20000);
144
break
;
145
case
EVENT_BLINK
:
146
DoCast
(
me
,
BlinkSpells
[std::rand() % 2]);
147
DoResetThreat
();
148
me
->SetVisible(
true
);
149
events
.ScheduleEvent(
EVENT_BLINK
, std::rand() % 30000 + 10000);
150
break
;
151
case
EVENT_EARTH_SHOCK
:
152
DoCastVictim
(
SPELL_EARTH_SHOCK
);
153
events
.ScheduleEvent(
EVENT_EARTH_SHOCK
, 2000);
154
break
;
155
}
156
}
157
158
if
(!
me
->IsSummon() &&
me
->GetHealthPct() <
_hpct
)
159
{
160
DoCast
(
me
,
SPELL_SUMMON_IMAGES
);
161
Talk
(
SAY_SPLIT
);
162
_hpct
-= 25.0f;
163
me
->SetVisible(
false
);
164
events
.RescheduleEvent(
EVENT_BLINK
, 2000);
165
}
166
167
if
(
me
->IsWithinMeleeRange(
me
->GetVictim()))
168
{
169
events
.RescheduleEvent(
EVENT_EARTH_SHOCK
, 2000);
170
DoMeleeAttackIfReady
();
171
}
172
}
173
174
private
:
175
float
_hpct
;
176
uint8
_flag
;
177
};
178
179
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
180
{
181
return
new
boss_skeramAI
(creature);
182
}
183
};
184
185
class
PlayerOrPetCheck
186
{
187
public
:
188
bool
operator()
(
WorldObject
*
object
)
const
189
{
190
if
(object->
GetTypeId
() !=
TypeID::TYPEID_PLAYER
)
191
if
(!object->
ToCreature
()->
IsPet
())
192
return
true
;
193
194
return
false
;
195
}
196
};
197
198
class
spell_skeram_arcane_explosion
:
public
SpellScriptLoader
199
{
200
public
:
201
spell_skeram_arcane_explosion
() :
SpellScriptLoader
(
"spell_skeram_arcane_explosion"
) { }
202
203
class
spell_skeram_arcane_explosion_SpellScript
:
public
SpellScript
204
{
205
PrepareSpellScript
(
spell_skeram_arcane_explosion_SpellScript
);
206
207
void
FilterTargets
(std::list<WorldObject*>& targets)
208
{
209
targets.remove_if(
PlayerOrPetCheck
());
210
}
211
212
void
Register
()
OVERRIDE
213
{
214
OnObjectAreaTargetSelect
+=
SpellObjectAreaTargetSelectFn
(
spell_skeram_arcane_explosion_SpellScript::FilterTargets
,
EFFECT_0
,
TARGET_UNIT_SRC_AREA_ENEMY
);
215
}
216
};
217
218
SpellScript
*
GetSpellScript
() const
OVERRIDE
219
{
220
return
new
spell_skeram_arcane_explosion_SpellScript
();
221
}
222
};
223
224
void
AddSC_boss_skeram
()
225
{
226
new
boss_skeram
();
227
new
spell_skeram_arcane_explosion
();
228
}
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
TypeID::TYPEID_PLAYER
@ TYPEID_PLAYER
Definition
Object.h:55
ScriptMgr.h
ScriptedCreature.h
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:18
TARGET_UNIT_SRC_AREA_ENEMY
@ TARGET_UNIT_SRC_AREA_ENEMY
Definition
SharedDefines.h:1621
SpellScript.h
SpellObjectAreaTargetSelectFn
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition
SpellScript.h:283
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
Events
Events
Definition
alterac_valley.cpp:40
SAY_SLAY
@ SAY_SLAY
Definition
boss_alizabal.cpp:20
SPELL_ARCANE_EXPLOSION
@ SPELL_ARCANE_EXPLOSION
Definition
boss_balinda.cpp:11
SAY_DEATH
#define SAY_DEATH
Definition
boss_commander_kolurg.cpp:30
SAY_AGGRO
#define SAY_AGGRO
Definition
boss_commander_kolurg.cpp:28
SAY_SPLIT
@ SAY_SPLIT
Definition
boss_halazzi.cpp:15
EVENT_BLINK
@ EVENT_BLINK
Definition
boss_shazzrah.cpp:32
EVENT_ARCANE_EXPLOSION
@ EVENT_ARCANE_EXPLOSION
Definition
boss_shazzrah.cpp:28
BlinkSpells
uint32 const BlinkSpells[3]
Definition
boss_skeram.cpp:36
SAY_DEATH
@ SAY_DEATH
Definition
boss_skeram.cpp:16
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_skeram.cpp:13
SAY_SPLIT
@ SAY_SPLIT
Definition
boss_skeram.cpp:15
SAY_SLAY
@ SAY_SLAY
Definition
boss_skeram.cpp:14
SPELL_TRUE_FULFILLMENT
@ SPELL_TRUE_FULFILLMENT
Definition
boss_skeram.cpp:23
SPELL_SUMMON_IMAGES
@ SPELL_SUMMON_IMAGES
Definition
boss_skeram.cpp:25
SPELL_ARCANE_EXPLOSION
@ SPELL_ARCANE_EXPLOSION
Definition
boss_skeram.cpp:21
SPELL_INITIALIZE_IMAGE
@ SPELL_INITIALIZE_IMAGE
Definition
boss_skeram.cpp:24
SPELL_EARTH_SHOCK
@ SPELL_EARTH_SHOCK
Definition
boss_skeram.cpp:22
AddSC_boss_skeram
void AddSC_boss_skeram()
Definition
boss_skeram.cpp:224
EVENT_BLINK
@ EVENT_BLINK
Definition
boss_skeram.cpp:32
EVENT_ARCANE_EXPLOSION
@ EVENT_ARCANE_EXPLOSION
Definition
boss_skeram.cpp:30
EVENT_EARTH_SHOCK
@ EVENT_EARTH_SHOCK
Definition
boss_skeram.cpp:33
EVENT_FULLFILMENT
@ EVENT_FULLFILMENT
Definition
boss_skeram.cpp:31
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
Object::GetTypeId
TypeID GetTypeId() const
Definition
Object.h:131
Object::ToCreature
Creature * ToCreature()
Definition
Object.h:207
PlayerOrPetCheck
Definition
boss_skeram.cpp:186
PlayerOrPetCheck::operator()
bool operator()(WorldObject *object) const
Definition
boss_skeram.cpp:188
SpellScript
Definition
SpellScript.h:139
SpellScript::OnObjectAreaTargetSelect
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition
SpellScript.h:282
SpellScriptLoader::SpellScriptLoader
SpellScriptLoader(const char *name)
Definition
ScriptMgr.cpp:1372
TempSummon
Definition
TemporarySummon.h:27
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::IsPet
bool IsPet() const
Definition
Unit.h:1511
WorldObject
Definition
Object.h:610
boss_skeram
Definition
boss_skeram.cpp:39
boss_skeram::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_skeram.cpp:179
boss_skeram::boss_skeram
boss_skeram()
Definition
boss_skeram.cpp:41
spell_skeram_arcane_explosion::spell_skeram_arcane_explosion_SpellScript
Definition
boss_skeram.cpp:204
spell_skeram_arcane_explosion::spell_skeram_arcane_explosion_SpellScript::PrepareSpellScript
PrepareSpellScript(spell_skeram_arcane_explosion_SpellScript)
spell_skeram_arcane_explosion::spell_skeram_arcane_explosion_SpellScript::FilterTargets
void FilterTargets(std::list< WorldObject * > &targets)
Definition
boss_skeram.cpp:207
spell_skeram_arcane_explosion::spell_skeram_arcane_explosion_SpellScript::Register
void Register() OVERRIDE
Definition
boss_skeram.cpp:212
spell_skeram_arcane_explosion
Definition
boss_skeram.cpp:199
spell_skeram_arcane_explosion::spell_skeram_arcane_explosion
spell_skeram_arcane_explosion()
Definition
boss_skeram.cpp:201
spell_skeram_arcane_explosion::GetSpellScript
SpellScript * GetSpellScript() const OVERRIDE
Definition
boss_skeram.cpp:218
ScriptedAI::DoResetThreat
void DoResetThreat()
Definition
ScriptedCreature.cpp:260
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
Yells
Definition
boss_illidan.cpp:256
boss_skeram::boss_skeramAI
Definition
boss_skeram.cpp:44
boss_skeram::boss_skeramAI::boss_skeramAI
boss_skeramAI(Creature *creature)
Definition
boss_skeram.cpp:45
boss_skeram::boss_skeramAI::JustSummoned
void JustSummoned(Creature *creature) OVERRIDE
Definition
boss_skeram.cpp:66
boss_skeram::boss_skeramAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_skeram.cpp:124
boss_skeram::boss_skeramAI::EnterEvadeMode
void EnterEvadeMode() OVERRIDE
Definition
boss_skeram.cpp:59
boss_skeram::boss_skeramAI::KilledUnit
void KilledUnit(Unit *) OVERRIDE
Definition
boss_skeram.cpp:54
boss_skeram::boss_skeramAI::_hpct
float _hpct
Definition
boss_skeram.cpp:175
boss_skeram::boss_skeramAI::Reset
void Reset() OVERRIDE
Definition
boss_skeram.cpp:47
boss_skeram::boss_skeramAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_skeram.cpp:111
boss_skeram::boss_skeramAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_skeram.cpp:103
boss_skeram::boss_skeramAI::_flag
uint8 _flag
Definition
boss_skeram.cpp:176
temple_of_ahnqiraj.h
DATA_SKERAM
@ DATA_SKERAM
Definition
temple_of_ahnqiraj.h:11
src
server
scripts
Kalimdor
TempleOfAhnQiraj
boss_skeram.cpp
Generated on
for Project SkyFire Core by
1.17.0