Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
boss_bug_trio.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
/* ScriptData
7
SDName: boss_kri, boss_yauj, boss_vem : The Bug Trio
8
SD%Complete: 100
9
SDComment:
10
SDCategory: Temple of Ahn'Qiraj
11
EndScriptData */
12
13
#include "
ScriptMgr.h
"
14
#include "
ScriptedCreature.h
"
15
#include "
temple_of_ahnqiraj.h
"
16
17
enum
Spells
18
{
19
SPELL_CLEAVE
= 26350,
20
SPELL_TOXIC_VOLLEY
= 25812,
21
SPELL_POISON_CLOUD
= 38718,
//Only Spell with right dmg.
22
SPELL_ENRAGE
= 34624,
//Changed cause 25790 is casted on gamers too. Same prob with old explosion of twin emperors.
23
24
SPELL_CHARGE
= 26561,
25
SPELL_KNOCKBACK
= 26027,
26
27
SPELL_HEAL
= 25807,
28
SPELL_FEAR
= 19408
29
};
30
31
class
boss_kri
:
public
CreatureScript
32
{
33
public
:
34
boss_kri
() :
CreatureScript
(
"boss_kri"
) { }
35
36
struct
boss_kriAI
:
public
ScriptedAI
37
{
38
boss_kriAI
(
Creature
* creature) :
ScriptedAI
(creature)
39
{
40
instance
= creature->
GetInstanceScript
();
41
Cleave_Timer
= 0;
42
ToxicVolley_Timer
= 0;
43
Check_Timer
= 0;
44
45
VemDead
=
false
;
46
Death
=
false
;
47
}
48
49
void
Reset
()
OVERRIDE
50
{
51
Cleave_Timer
= std::rand() % 8000 + 4000;
52
ToxicVolley_Timer
= std::rand() % 12000 + 6000;
53
Check_Timer
= 2000;
54
55
VemDead
=
false
;
56
Death
=
false
;
57
}
58
59
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
60
61
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
62
{
63
if
(
instance
)
64
{
65
if
(
instance
->GetData(
DATA_BUG_TRIO_DEATH
) < 2)
66
// Unlootable if death
67
me
->RemoveFlag(
OBJECT_FIELD_DYNAMIC_FLAGS
,
UNIT_DYNFLAG_LOOTABLE
);
68
69
instance
->SetData(
DATA_BUG_TRIO_DEATH
, 1);
70
}
71
}
72
void
UpdateAI
(
uint32
diff)
OVERRIDE
73
{
74
//Return since we have no target
75
if
(!
UpdateVictim
())
76
return
;
77
78
//Cleave_Timer
79
if
(
Cleave_Timer
<= diff)
80
{
81
DoCastVictim
(
SPELL_CLEAVE
);
82
Cleave_Timer
= std::rand() % 12000 + 5000;
83
}
else
Cleave_Timer
-= diff;
84
85
//ToxicVolley_Timer
86
if
(
ToxicVolley_Timer
<= diff)
87
{
88
DoCastVictim
(
SPELL_TOXIC_VOLLEY
);
89
ToxicVolley_Timer
= std::rand() % 15000 + 10000;
90
}
else
ToxicVolley_Timer
-= diff;
91
92
if
(!
HealthAbovePct
(5) && !
Death
)
93
{
94
DoCastVictim
(
SPELL_POISON_CLOUD
);
95
Death
=
true
;
96
}
97
98
if
(!
VemDead
)
99
{
100
//Checking if Vem is dead. If yes we will enrage.
101
if
(
Check_Timer
<= diff)
102
{
103
if
(
instance
&&
instance
->GetData(
DATA_VEMISDEAD
))
104
{
105
DoCast
(
me
,
SPELL_ENRAGE
);
106
VemDead
=
true
;
107
}
108
Check_Timer
= 2000;
109
}
else
Check_Timer
-=diff;
110
}
111
112
DoMeleeAttackIfReady
();
113
}
114
private
:
115
InstanceScript
*
instance
;
116
117
uint32
Cleave_Timer
;
118
uint32
ToxicVolley_Timer
;
119
uint32
Check_Timer
;
120
121
bool
VemDead
;
122
bool
Death
;
123
};
124
125
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
126
{
127
return
new
boss_kriAI
(creature);
128
}
129
};
130
131
class
boss_vem
:
public
CreatureScript
132
{
133
public
:
134
boss_vem
() :
CreatureScript
(
"boss_vem"
) { }
135
136
struct
boss_vemAI
:
public
ScriptedAI
137
{
138
boss_vemAI
(
Creature
* creature) :
ScriptedAI
(creature)
139
{
140
instance
= creature->
GetInstanceScript
();
141
Charge_Timer
= 0;
142
KnockBack_Timer
= 0;
143
Enrage_Timer
= 0;
144
145
Enraged
=
false
;
146
}
147
148
void
Reset
()
OVERRIDE
149
{
150
Charge_Timer
= std::rand() % 27000 + 15000;
151
KnockBack_Timer
= std::rand() % 20000 + 8000;
152
Enrage_Timer
= 120000;
153
154
Enraged
=
false
;
155
}
156
157
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
158
{
159
if
(
instance
)
160
{
161
instance
->SetData(
DATA_VEM_DEATH
, 0);
162
if
(
instance
->GetData(
DATA_BUG_TRIO_DEATH
) < 2)
163
// Unlootable if death
164
me
->RemoveFlag(
OBJECT_FIELD_DYNAMIC_FLAGS
,
UNIT_DYNFLAG_LOOTABLE
);
165
instance
->SetData(
DATA_BUG_TRIO_DEATH
, 1);
166
}
167
}
168
169
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
170
171
void
UpdateAI
(
uint32
diff)
OVERRIDE
172
{
173
//Return since we have no target
174
if
(!
UpdateVictim
())
175
return
;
176
177
//Charge_Timer
178
if
(
Charge_Timer
<= diff)
179
{
180
Unit
* target = NULL;
181
target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0);
182
if
(target)
183
{
184
DoCast
(target,
SPELL_CHARGE
);
185
//me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1);
186
AttackStart
(target);
187
}
188
189
Charge_Timer
= std::rand() % 16000 + 8000;
190
}
else
Charge_Timer
-= diff;
191
192
//KnockBack_Timer
193
if
(
KnockBack_Timer
<= diff)
194
{
195
DoCastVictim
(
SPELL_KNOCKBACK
);
196
if
(
DoGetThreat
(
me
->GetVictim()))
197
DoModifyThreatPercent
(
me
->GetVictim(), -80);
198
KnockBack_Timer
= std::rand() % 25000 + 15000;
199
}
else
KnockBack_Timer
-= diff;
200
201
//Enrage_Timer
202
if
(!
Enraged
&&
Enrage_Timer
<= diff)
203
{
204
DoCast
(
me
,
SPELL_ENRAGE
);
205
Enraged
=
true
;
206
}
else
Charge_Timer
-= diff;
207
208
DoMeleeAttackIfReady
();
209
}
210
private
:
211
InstanceScript
*
instance
;
212
213
uint32
Charge_Timer
;
214
uint32
KnockBack_Timer
;
215
uint32
Enrage_Timer
;
216
217
bool
Enraged
;
218
};
219
220
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
221
{
222
return
new
boss_vemAI
(creature);
223
}
224
};
225
226
class
boss_yauj
:
public
CreatureScript
227
{
228
public
:
229
boss_yauj
() :
CreatureScript
(
"boss_yauj"
) { }
230
231
struct
boss_yaujAI
:
public
ScriptedAI
232
{
233
boss_yaujAI
(
Creature
* creature) :
ScriptedAI
(creature)
234
{
235
instance
= creature->
GetInstanceScript
();
236
Heal_Timer
= 0;
237
Fear_Timer
= 0;
238
Check_Timer
= 0;
239
240
VemDead
=
false
;
241
}
242
243
void
Reset
()
OVERRIDE
244
{
245
Heal_Timer
= std::rand() % 40000 + 25000;
246
Fear_Timer
= std::rand() % 24000 + 12000;
247
Check_Timer
= 2000;
248
249
VemDead
=
false
;
250
}
251
252
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
253
{
254
if
(
instance
)
255
{
256
if
(
instance
->GetData(
DATA_BUG_TRIO_DEATH
) < 2)
257
// Unlootable if death
258
me
->RemoveFlag(
OBJECT_FIELD_DYNAMIC_FLAGS
,
UNIT_DYNFLAG_LOOTABLE
);
259
instance
->SetData(
DATA_BUG_TRIO_DEATH
, 1);
260
}
261
262
for
(
uint8
i = 0; i < 10; ++i)
263
{
264
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
265
{
266
if
(
Creature
* Summoned =
me
->SummonCreature(15621,
me
->GetPositionX(),
me
->GetPositionY(),
me
->GetPositionZ(), 0,
TempSummonType::TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
, 90000))
267
Summoned->AI()->AttackStart(target);
268
}
269
}
270
}
271
272
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
273
274
void
UpdateAI
(
uint32
diff)
OVERRIDE
275
{
276
//Return since we have no target
277
if
(!
UpdateVictim
())
278
return
;
279
280
//Fear_Timer
281
if
(
Fear_Timer
<= diff)
282
{
283
DoCastVictim
(
SPELL_FEAR
);
284
DoResetThreat
();
285
Fear_Timer
= 20000;
286
}
else
Fear_Timer
-= diff;
287
288
//Casting Heal to other twins or herself.
289
if
(
Heal_Timer
<= diff)
290
{
291
if
(
instance
)
292
{
293
Unit
* pKri =
Unit::GetUnit
(*
me
,
instance
->GetData64(
DATA_KRI
));
294
Unit
* pVem =
Unit::GetUnit
(*
me
,
instance
->GetData64(
DATA_VEM
));
295
296
switch
(std::rand() % 2)
297
{
298
case
0:
299
if
(pKri)
300
DoCast
(pKri,
SPELL_HEAL
);
301
break
;
302
case
1:
303
if
(pVem)
304
DoCast
(pVem,
SPELL_HEAL
);
305
break
;
306
case
2:
307
DoCast
(
me
,
SPELL_HEAL
);
308
break
;
309
}
310
}
311
312
Heal_Timer
= 15000+rand()%15000;
313
}
else
Heal_Timer
-= diff;
314
315
//Checking if Vem is dead. If yes we will enrage.
316
if
(
Check_Timer
<= diff)
317
{
318
if
(!
VemDead
)
319
{
320
if
(
instance
)
321
{
322
if
(
instance
->GetData(
DATA_VEMISDEAD
))
323
{
324
DoCast
(
me
,
SPELL_ENRAGE
);
325
VemDead
=
true
;
326
}
327
}
328
}
329
Check_Timer
= 2000;
330
}
else
Check_Timer
-= diff;
331
332
DoMeleeAttackIfReady
();
333
}
334
private
:
335
InstanceScript
*
instance
;
336
337
uint32
Heal_Timer
;
338
uint32
Fear_Timer
;
339
uint32
Check_Timer
;
340
341
bool
VemDead
;
342
};
343
344
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
345
{
346
return
new
boss_yaujAI
(creature);
347
}
348
};
349
350
void
AddSC_bug_trio
()
351
{
352
new
boss_kri
();
353
new
boss_vem
();
354
new
boss_yauj
();
355
}
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
TempSummonType::TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition
Object.h:69
ScriptMgr.h
ScriptedCreature.h
UNIT_DYNFLAG_LOOTABLE
@ UNIT_DYNFLAG_LOOTABLE
Definition
SharedDefines.h:3634
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
OBJECT_FIELD_DYNAMIC_FLAGS
@ OBJECT_FIELD_DYNAMIC_FLAGS
Definition
UpdateFields.h:17
SPELL_CLEAVE
@ SPELL_CLEAVE
Definition
alterac_valley.cpp:12
SPELL_ENRAGE
@ SPELL_ENRAGE
Definition
alterac_valley.cpp:14
SPELL_CHARGE
@ SPELL_CHARGE
Definition
alterac_valley.cpp:11
SPELL_POISON_CLOUD
@ SPELL_POISON_CLOUD
Definition
boss_aku_mai.cpp:12
SPELL_KNOCKBACK
@ SPELL_KNOCKBACK
Definition
boss_broodlord_lashlayer.cpp:21
SPELL_CLEAVE
@ SPELL_CLEAVE
Definition
boss_bug_trio.cpp:19
SPELL_KNOCKBACK
@ SPELL_KNOCKBACK
Definition
boss_bug_trio.cpp:25
SPELL_ENRAGE
@ SPELL_ENRAGE
Definition
boss_bug_trio.cpp:22
SPELL_CHARGE
@ SPELL_CHARGE
Definition
boss_bug_trio.cpp:24
SPELL_FEAR
@ SPELL_FEAR
Definition
boss_bug_trio.cpp:28
SPELL_HEAL
@ SPELL_HEAL
Definition
boss_bug_trio.cpp:27
SPELL_POISON_CLOUD
@ SPELL_POISON_CLOUD
Definition
boss_bug_trio.cpp:21
SPELL_TOXIC_VOLLEY
@ SPELL_TOXIC_VOLLEY
Definition
boss_bug_trio.cpp:20
AddSC_bug_trio
void AddSC_bug_trio()
Definition
boss_bug_trio.cpp:350
SPELL_HEAL
@ SPELL_HEAL
Definition
boss_moira_bronzebeard.cpp:11
SPELL_FEAR
@ SPELL_FEAR
Definition
boss_nefarian.cpp:106
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
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
Unit
Definition
Unit.h:1367
Unit::GetUnit
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition
Unit.cpp:4895
WorldObject::GetInstanceScript
InstanceScript * GetInstanceScript()
Definition
Object.cpp:1612
boss_kri
Definition
boss_bug_trio.cpp:32
boss_kri::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_bug_trio.cpp:125
boss_kri::boss_kri
boss_kri()
Definition
boss_bug_trio.cpp:34
boss_vem
Definition
boss_bug_trio.cpp:132
boss_vem::boss_vem
boss_vem()
Definition
boss_bug_trio.cpp:134
boss_vem::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_bug_trio.cpp:220
boss_yauj
Definition
boss_bug_trio.cpp:227
boss_yauj::boss_yauj
boss_yauj()
Definition
boss_bug_trio.cpp:229
boss_yauj::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_bug_trio.cpp:344
ScriptedAI::DoResetThreat
void DoResetThreat()
Definition
ScriptedCreature.cpp:260
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::HealthAbovePct
bool HealthAbovePct(uint32 pct) const
Definition
ScriptedCreature.h:251
ScriptedAI::DoGetThreat
float DoGetThreat(Unit *unit)
Definition
ScriptedCreature.cpp:278
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
ScriptedAI::DoModifyThreatPercent
void DoModifyThreatPercent(Unit *unit, int32 pct)
Definition
ScriptedCreature.cpp:285
ScriptedAI::AttackStart
void AttackStart(Unit *) OVERRIDE
Definition
ScriptedCreature.cpp:118
boss_kri::boss_kriAI
Definition
boss_bug_trio.cpp:37
boss_kri::boss_kriAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_bug_trio.cpp:72
boss_kri::boss_kriAI::Check_Timer
uint32 Check_Timer
Definition
boss_bug_trio.cpp:119
boss_kri::boss_kriAI::Reset
void Reset() OVERRIDE
Definition
boss_bug_trio.cpp:49
boss_kri::boss_kriAI::boss_kriAI
boss_kriAI(Creature *creature)
Definition
boss_bug_trio.cpp:38
boss_kri::boss_kriAI::ToxicVolley_Timer
uint32 ToxicVolley_Timer
Definition
boss_bug_trio.cpp:118
boss_kri::boss_kriAI::VemDead
bool VemDead
Definition
boss_bug_trio.cpp:121
boss_kri::boss_kriAI::instance
InstanceScript * instance
Definition
boss_bug_trio.cpp:115
boss_kri::boss_kriAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_bug_trio.cpp:61
boss_kri::boss_kriAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_bug_trio.cpp:59
boss_kri::boss_kriAI::Cleave_Timer
uint32 Cleave_Timer
Definition
boss_bug_trio.cpp:117
boss_kri::boss_kriAI::Death
bool Death
Definition
boss_bug_trio.cpp:122
boss_vem::boss_vemAI
Definition
boss_bug_trio.cpp:137
boss_vem::boss_vemAI::instance
InstanceScript * instance
Definition
boss_bug_trio.cpp:211
boss_vem::boss_vemAI::Charge_Timer
uint32 Charge_Timer
Definition
boss_bug_trio.cpp:213
boss_vem::boss_vemAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_bug_trio.cpp:171
boss_vem::boss_vemAI::Enraged
bool Enraged
Definition
boss_bug_trio.cpp:217
boss_vem::boss_vemAI::KnockBack_Timer
uint32 KnockBack_Timer
Definition
boss_bug_trio.cpp:214
boss_vem::boss_vemAI::Enrage_Timer
uint32 Enrage_Timer
Definition
boss_bug_trio.cpp:215
boss_vem::boss_vemAI::boss_vemAI
boss_vemAI(Creature *creature)
Definition
boss_bug_trio.cpp:138
boss_vem::boss_vemAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_bug_trio.cpp:169
boss_vem::boss_vemAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_bug_trio.cpp:157
boss_vem::boss_vemAI::Reset
void Reset() OVERRIDE
Definition
boss_bug_trio.cpp:148
boss_yauj::boss_yaujAI
Definition
boss_bug_trio.cpp:232
boss_yauj::boss_yaujAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_bug_trio.cpp:274
boss_yauj::boss_yaujAI::Fear_Timer
uint32 Fear_Timer
Definition
boss_bug_trio.cpp:338
boss_yauj::boss_yaujAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
boss_bug_trio.cpp:252
boss_yauj::boss_yaujAI::Check_Timer
uint32 Check_Timer
Definition
boss_bug_trio.cpp:339
boss_yauj::boss_yaujAI::VemDead
bool VemDead
Definition
boss_bug_trio.cpp:341
boss_yauj::boss_yaujAI::boss_yaujAI
boss_yaujAI(Creature *creature)
Definition
boss_bug_trio.cpp:233
boss_yauj::boss_yaujAI::Reset
void Reset() OVERRIDE
Definition
boss_bug_trio.cpp:243
boss_yauj::boss_yaujAI::Heal_Timer
uint32 Heal_Timer
Definition
boss_bug_trio.cpp:337
boss_yauj::boss_yaujAI::instance
InstanceScript * instance
Definition
boss_bug_trio.cpp:335
boss_yauj::boss_yaujAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
boss_bug_trio.cpp:272
temple_of_ahnqiraj.h
DATA_VEM_DEATH
@ DATA_VEM_DEATH
Definition
temple_of_ahnqiraj.h:15
DATA_BUG_TRIO_DEATH
@ DATA_BUG_TRIO_DEATH
Definition
temple_of_ahnqiraj.h:22
DATA_KRI
@ DATA_KRI
Definition
temple_of_ahnqiraj.h:12
DATA_VEM
@ DATA_VEM
Definition
temple_of_ahnqiraj.h:13
DATA_VEMISDEAD
@ DATA_VEMISDEAD
Definition
temple_of_ahnqiraj.h:14
src
server
scripts
Kalimdor
TempleOfAhnQiraj
boss_bug_trio.cpp
Generated on
for Project SkyFire Core by
1.17.0