Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_mal_ganis.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
/* Script Data Start
7
SDName: Boss mal_ganis
8
SDAuthor: Tartalo
9
SD%Complete: 80
10
SDComment: @todo Intro & outro
11
SDCategory:
12
Script Data End */
13
14
#include "
ScriptMgr.h
"
15
#include "
ScriptedCreature.h
"
16
#include "
culling_of_stratholme.h
"
17
18
enum
Spells
19
{
20
SPELL_CARRION_SWARM
= 52720,
//A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec.
21
H_SPELL_CARRION_SWARM
= 58852,
22
SPELL_MIND_BLAST
= 52722,
//Inflicts 4163 to 4837 Shadow damage to an enemy.
23
H_SPELL_MIND_BLAST
= 58850,
24
SPELL_SLEEP
= 52721,
//Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target.
25
H_SPELL_SLEEP
= 58849,
26
SPELL_VAMPIRIC_TOUCH
= 52723,
//Heals the caster for half the damage dealt by a melee attack.
27
SPELL_MAL_GANIS_KILL_CREDIT
= 58124,
// Quest credit
28
SPELL_KILL_CREDIT
= 58630
// Non-existing spell as encounter credit, created in spell_dbc
29
};
30
31
enum
Yells
32
{
33
SAY_AGGRO
= 2,
34
SAY_KILL
= 3,
35
SAY_SLAY
= 4,
36
SAY_SLEEP
= 5,
37
SAY_30HEALTH
= 6,
38
SAY_15HEALTH
= 7,
39
SAY_ESCAPE_SPEECH_1
= 8,
40
SAY_ESCAPE_SPEECH_2
= 9,
41
SAY_OUTRO
= 10
42
};
43
44
enum
CombatPhases
45
{
46
COMBAT
,
47
OUTRO
48
};
49
50
class
boss_mal_ganis
:
public
CreatureScript
51
{
52
public
:
53
boss_mal_ganis
() :
CreatureScript
(
"boss_mal_ganis"
) { }
54
55
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
56
{
57
return
new
boss_mal_ganisAI
(creature);
58
}
59
60
struct
boss_mal_ganisAI
:
public
ScriptedAI
61
{
62
boss_mal_ganisAI
(
Creature
* creature) :
ScriptedAI
(creature)
63
{
64
instance
= creature->
GetInstanceScript
();
65
}
66
67
uint32
uiCarrionSwarmTimer
;
68
uint32
uiMindBlastTimer
;
69
uint32
uiVampiricTouchTimer
;
70
uint32
uiSleepTimer
;
71
72
uint8
uiOutroStep
;
73
uint32
uiOutroTimer
;
74
75
bool
bYelled
;
76
bool
bYelled2
;
77
78
CombatPhases
Phase
;
79
80
InstanceScript
*
instance
;
81
82
void
Reset
()
OVERRIDE
83
{
84
bYelled
=
false
;
85
bYelled2
=
false
;
86
Phase
=
COMBAT
;
87
uiCarrionSwarmTimer
= 6000;
88
uiMindBlastTimer
= 11000;
89
uiVampiricTouchTimer
= std::rand() % 15000 + 10000;
90
uiSleepTimer
= std::rand() % 20000 + 15000;
91
uiOutroTimer
= 1000;
92
93
if
(
instance
)
94
instance
->SetData(
DATA_MAL_GANIS_EVENT
,
NOT_STARTED
);
95
}
96
97
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
98
{
99
Talk
(
SAY_AGGRO
);
100
if
(
instance
)
101
instance
->SetData(
DATA_MAL_GANIS_EVENT
,
IN_PROGRESS
);
102
}
103
104
void
DamageTaken
(
Unit
* done_by,
uint32
&damage)
OVERRIDE
105
{
106
if
(damage >=
me
->GetHealth() && done_by !=
me
)
107
damage =
me
->GetHealth()-1;
108
}
109
110
void
UpdateAI
(
uint32
diff)
OVERRIDE
111
{
112
switch
(
Phase
)
113
{
114
case
COMBAT
:
115
//Return since we have no target
116
if
(!
UpdateVictim
())
117
return
;
118
119
if
(!
bYelled
&&
HealthBelowPct
(30))
120
{
121
Talk
(
SAY_30HEALTH
);
122
bYelled
=
true
;
123
}
124
125
if
(!
bYelled2
&&
HealthBelowPct
(15))
126
{
127
Talk
(
SAY_15HEALTH
);
128
bYelled2
=
true
;
129
}
130
131
if
(
HealthBelowPct
(1))
132
{
133
//Handle Escape Event: Don't forget to add Player::RewardPlayerAndGroupAtEvent
134
me
->SetFlag(
UNIT_FIELD_FLAGS
,
UNIT_FLAG_NON_ATTACKABLE
|
UNIT_FLAG_NOT_SELECTABLE
);
135
uiOutroStep
= 1;
136
Phase
=
OUTRO
;
137
return
;
138
}
139
140
if
(
Creature
* pArthas =
me
->GetCreature(*
me
,
instance
?
instance
->GetData64(
DATA_ARTHAS
) : 0))
141
if
(pArthas->isDead())
142
{
143
EnterEvadeMode
();
144
me
->DisappearAndDie();
145
if
(
instance
)
146
instance
->SetData(
DATA_MAL_GANIS_EVENT
,
FAIL
);
147
}
148
149
if
(
uiCarrionSwarmTimer
< diff)
150
{
151
DoCastVictim
(
SPELL_CARRION_SWARM
);
152
uiCarrionSwarmTimer
= 7000;
153
}
else
uiCarrionSwarmTimer
-= diff;
154
155
if
(
uiMindBlastTimer
< diff)
156
{
157
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0, 100,
true
))
158
DoCast
(target,
SPELL_MIND_BLAST
);
159
uiMindBlastTimer
= 6000;
160
}
else
uiMindBlastTimer
-= diff;
161
162
if
(
uiVampiricTouchTimer
< diff)
163
{
164
DoCast
(
me
,
SPELL_VAMPIRIC_TOUCH
);
165
uiVampiricTouchTimer
= 32000;
166
}
else
uiVampiricTouchTimer
-= diff;
167
168
if
(
uiSleepTimer
< diff)
169
{
170
Talk
(
SAY_SLEEP
);
171
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0, 100,
true
))
172
DoCast
(target,
SPELL_SLEEP
);
173
uiSleepTimer
= std::rand() % 20000 + 15000;
174
}
else
uiSleepTimer
-= diff;
175
176
DoMeleeAttackIfReady
();
177
break
;
178
case
OUTRO
:
179
if
(
uiOutroTimer
< diff)
180
{
181
switch
(
uiOutroStep
)
182
{
183
case
1:
184
Talk
(
SAY_ESCAPE_SPEECH_1
);
185
me
->GetMotionMaster()->MoveTargetedHome();
186
++
uiOutroStep
;
187
uiOutroTimer
= 8000;
188
break
;
189
case
2:
190
me
->SetTarget(
instance
?
instance
->GetData64(
DATA_ARTHAS
) : 0);
191
me
->HandleEmoteCommand(29);
192
Talk
(
SAY_ESCAPE_SPEECH_2
);
193
++
uiOutroStep
;
194
uiOutroTimer
= 9000;
195
break
;
196
case
3:
197
Talk
(
SAY_OUTRO
);
198
++
uiOutroStep
;
199
uiOutroTimer
= 16000;
200
break
;
201
case
4:
202
me
->HandleEmoteCommand(33);
203
++
uiOutroStep
;
204
uiOutroTimer
= 500;
205
break
;
206
case
5:
207
me
->SetVisible(
false
);
208
me
->Kill(
me
);
209
break
;
210
}
211
}
else
uiOutroTimer
-= diff;
212
break
;
213
}
214
}
215
216
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
217
{
218
if
(
instance
)
219
{
220
instance
->SetData(
DATA_MAL_GANIS_EVENT
,
DONE
);
221
DoCastAOE
(
SPELL_MAL_GANIS_KILL_CREDIT
);
222
// give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc
223
DoCastAOE
(
SPELL_KILL_CREDIT
);
224
}
225
}
226
227
void
KilledUnit
(
Unit
* victim)
OVERRIDE
228
{
229
if
(victim->GetTypeId() !=
TypeID::TYPEID_PLAYER
)
230
return
;
231
232
Talk
(
SAY_SLAY
);
233
}
234
};
235
};
236
237
void
AddSC_boss_mal_ganis
()
238
{
239
new
boss_mal_ganis
();
240
}
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
IN_PROGRESS
@ IN_PROGRESS
Definition
InstanceScript.h:47
FAIL
@ FAIL
Definition
InstanceScript.h:48
DONE
@ DONE
Definition
InstanceScript.h:49
NOT_STARTED
@ NOT_STARTED
Definition
InstanceScript.h:46
TypeID::TYPEID_PLAYER
@ TYPEID_PLAYER
Definition
Object.h:55
ScriptMgr.h
ScriptedCreature.h
UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_NON_ATTACKABLE
Definition
Unit.h:626
UNIT_FLAG_NOT_SELECTABLE
@ UNIT_FLAG_NOT_SELECTABLE
Definition
Unit.h:650
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
UNIT_FIELD_FLAGS
@ UNIT_FIELD_FLAGS
Definition
UpdateFields.h:82
SAY_SLAY
@ SAY_SLAY
Definition
boss_alizabal.cpp:20
SPELL_CARRION_SWARM
@ SPELL_CARRION_SWARM
Definition
boss_anetheron.cpp:13
SAY_AGGRO
#define SAY_AGGRO
Definition
boss_commander_kolurg.cpp:28
SAY_KILL
#define SAY_KILL
Definition
boss_commander_kolurg.cpp:29
SPELL_SLEEP
@ SPELL_SLEEP
Definition
boss_high_inquisitor_fairbanks.cpp:23
SPELL_MIND_BLAST
@ SPELL_MIND_BLAST
Definition
boss_kelris.cpp:12
SAY_SLEEP
@ SAY_SLEEP
Definition
boss_kelris.cpp:16
SAY_ESCAPE_SPEECH_2
@ SAY_ESCAPE_SPEECH_2
Definition
boss_mal_ganis.cpp:40
SAY_OUTRO
@ SAY_OUTRO
Definition
boss_mal_ganis.cpp:41
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_mal_ganis.cpp:33
SAY_30HEALTH
@ SAY_30HEALTH
Definition
boss_mal_ganis.cpp:37
SAY_SLEEP
@ SAY_SLEEP
Definition
boss_mal_ganis.cpp:36
SAY_SLAY
@ SAY_SLAY
Definition
boss_mal_ganis.cpp:35
SAY_ESCAPE_SPEECH_1
@ SAY_ESCAPE_SPEECH_1
Definition
boss_mal_ganis.cpp:39
SAY_15HEALTH
@ SAY_15HEALTH
Definition
boss_mal_ganis.cpp:38
AddSC_boss_mal_ganis
void AddSC_boss_mal_ganis()
Definition
boss_mal_ganis.cpp:237
H_SPELL_CARRION_SWARM
@ H_SPELL_CARRION_SWARM
Definition
boss_mal_ganis.cpp:21
SPELL_SLEEP
@ SPELL_SLEEP
Definition
boss_mal_ganis.cpp:24
SPELL_VAMPIRIC_TOUCH
@ SPELL_VAMPIRIC_TOUCH
Definition
boss_mal_ganis.cpp:26
SPELL_KILL_CREDIT
@ SPELL_KILL_CREDIT
Definition
boss_mal_ganis.cpp:28
SPELL_MIND_BLAST
@ SPELL_MIND_BLAST
Definition
boss_mal_ganis.cpp:22
SPELL_MAL_GANIS_KILL_CREDIT
@ SPELL_MAL_GANIS_KILL_CREDIT
Definition
boss_mal_ganis.cpp:27
SPELL_CARRION_SWARM
@ SPELL_CARRION_SWARM
Definition
boss_mal_ganis.cpp:20
H_SPELL_SLEEP
@ H_SPELL_SLEEP
Definition
boss_mal_ganis.cpp:25
H_SPELL_MIND_BLAST
@ H_SPELL_MIND_BLAST
Definition
boss_mal_ganis.cpp:23
CombatPhases
CombatPhases
Definition
boss_mal_ganis.cpp:45
COMBAT
@ COMBAT
Definition
boss_mal_ganis.cpp:46
OUTRO
@ OUTRO
Definition
boss_mal_ganis.cpp:47
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
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
WorldObject::GetInstanceScript
InstanceScript * GetInstanceScript()
Definition
Object.cpp:1612
boss_mal_ganis
Definition
boss_mal_ganis.cpp:51
boss_mal_ganis::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_mal_ganis.cpp:55
boss_mal_ganis::boss_mal_ganis
boss_mal_ganis()
Definition
boss_mal_ganis.cpp:53
culling_of_stratholme.h
DATA_ARTHAS
@ DATA_ARTHAS
Definition
culling_of_stratholme.h:22
DATA_MAL_GANIS_EVENT
@ DATA_MAL_GANIS_EVENT
Definition
culling_of_stratholme.h:14
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_mal_ganis::boss_mal_ganisAI
Definition
boss_mal_ganis.cpp:61
boss_mal_ganis::boss_mal_ganisAI::boss_mal_ganisAI
boss_mal_ganisAI(Creature *creature)
Definition
boss_mal_ganis.cpp:62
boss_mal_ganis::boss_mal_ganisAI::uiOutroStep
uint8 uiOutroStep
Definition
boss_mal_ganis.cpp:72
boss_mal_ganis::boss_mal_ganisAI::bYelled
bool bYelled
Definition
boss_mal_ganis.cpp:75
boss_mal_ganis::boss_mal_ganisAI::uiMindBlastTimer
uint32 uiMindBlastTimer
Definition
boss_mal_ganis.cpp:68
boss_mal_ganis::boss_mal_ganisAI::uiOutroTimer
uint32 uiOutroTimer
Definition
boss_mal_ganis.cpp:73
boss_mal_ganis::boss_mal_ganisAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_mal_ganis.cpp:97
boss_mal_ganis::boss_mal_ganisAI::uiSleepTimer
uint32 uiSleepTimer
Definition
boss_mal_ganis.cpp:70
boss_mal_ganis::boss_mal_ganisAI::Reset
void Reset() OVERRIDE
Definition
boss_mal_ganis.cpp:82
boss_mal_ganis::boss_mal_ganisAI::bYelled2
bool bYelled2
Definition
boss_mal_ganis.cpp:76
boss_mal_ganis::boss_mal_ganisAI::instance
InstanceScript * instance
Definition
boss_mal_ganis.cpp:80
boss_mal_ganis::boss_mal_ganisAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_mal_ganis.cpp:216
boss_mal_ganis::boss_mal_ganisAI::Phase
CombatPhases Phase
Definition
boss_mal_ganis.cpp:78
boss_mal_ganis::boss_mal_ganisAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_mal_ganis.cpp:110
boss_mal_ganis::boss_mal_ganisAI::KilledUnit
void KilledUnit(Unit *victim) OVERRIDE
Definition
boss_mal_ganis.cpp:227
boss_mal_ganis::boss_mal_ganisAI::DamageTaken
void DamageTaken(Unit *done_by, uint32 &damage) OVERRIDE
Definition
boss_mal_ganis.cpp:104
boss_mal_ganis::boss_mal_ganisAI::uiVampiricTouchTimer
uint32 uiVampiricTouchTimer
Definition
boss_mal_ganis.cpp:69
boss_mal_ganis::boss_mal_ganisAI::uiCarrionSwarmTimer
uint32 uiCarrionSwarmTimer
Definition
boss_mal_ganis.cpp:67
src
server
scripts
Kalimdor
CavernsOfTime
CullingOfStratholme
boss_mal_ganis.cpp
Generated on
for Project SkyFire Core by
1.17.0