Project SkyFire Core
SkyFire 5.4.8 server core API documentation
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
7SDName: boss_kri, boss_yauj, boss_vem : The Bug Trio
8SD%Complete: 100
9SDComment:
10SDCategory: Temple of Ahn'Qiraj
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "temple_of_ahnqiraj.h"
16
18{
19 SPELL_CLEAVE = 26350,
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,
26
27 SPELL_HEAL = 25807,
28 SPELL_FEAR = 19408
29};
30
32{
33public:
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;
43 Check_Timer = 0;
44
45 VemDead = false;
46 Death = false;
47 }
48
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
68
69 instance->SetData(DATA_BUG_TRIO_DEATH, 1);
70 }
71 }
73 {
74 //Return since we have no target
75 if (!UpdateVictim())
76 return;
77
78 //Cleave_Timer
79 if (Cleave_Timer <= diff)
80 {
82 Cleave_Timer = std::rand() % 12000 + 5000;
83 } else Cleave_Timer -= diff;
84
85 //ToxicVolley_Timer
86 if (ToxicVolley_Timer <= diff)
87 {
89 ToxicVolley_Timer = std::rand() % 15000 + 10000;
90 } else ToxicVolley_Timer -= diff;
91
92 if (!HealthAbovePct(5) && !Death)
93 {
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 {
106 VemDead = true;
107 }
108 Check_Timer = 2000;
109 } else Check_Timer -=diff;
110 }
111
113 }
114 private:
116
120
122 bool Death;
123 };
124
126 {
127 return new boss_kriAI(creature);
128 }
129};
130
132{
133public:
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
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
165 instance->SetData(DATA_BUG_TRIO_DEATH, 1);
166 }
167 }
168
169 void EnterCombat(Unit* /*who*/) OVERRIDE { }
170
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;
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 {
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 {
205 Enraged = true;
206 } else Charge_Timer -= diff;
207
209 }
210 private:
212
216
218 };
219
221 {
222 return new boss_vemAI(creature);
223 }
224};
225
227{
228public:
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
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
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
275 {
276 //Return since we have no target
277 if (!UpdateVictim())
278 return;
279
280 //Fear_Timer
281 if (Fear_Timer <= diff)
282 {
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:
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 {
325 VemDead = true;
326 }
327 }
328 }
329 Check_Timer = 2000;
330 } else Check_Timer -= diff;
331
333 }
334 private:
336
340
342 };
343
345 {
346 return new boss_yaujAI(creature);
347 }
348};
349
351{
352 new boss_kri();
353 new boss_vem();
354 new boss_yauj();
355}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:69
@ UNIT_DYNFLAG_LOOTABLE
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ OBJECT_FIELD_DYNAMIC_FLAGS
@ SPELL_CLEAVE
@ SPELL_ENRAGE
@ SPELL_CHARGE
@ SPELL_POISON_CLOUD
@ SPELL_CLEAVE
@ SPELL_KNOCKBACK
@ SPELL_ENRAGE
@ SPELL_CHARGE
@ SPELL_FEAR
@ SPELL_HEAL
@ SPELL_POISON_CLOUD
@ SPELL_TOXIC_VOLLEY
void AddSC_bug_trio()
@ SPELL_FEAR
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthAbovePct(uint32 pct) const
float DoGetThreat(Unit *unit)
ScriptedAI(Creature *creature)
void DoModifyThreatPercent(Unit *unit, int32 pct)
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void Reset() OVERRIDE
boss_kriAI(Creature *creature)
InstanceScript * instance
void JustDied(Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
InstanceScript * instance
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
boss_vemAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void JustDied(Unit *) OVERRIDE
void Reset() OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void JustDied(Unit *) OVERRIDE
boss_yaujAI(Creature *creature)
InstanceScript * instance
void EnterCombat(Unit *) OVERRIDE
@ DATA_VEM_DEATH
@ DATA_BUG_TRIO_DEATH
@ DATA_KRI
@ DATA_VEM
@ DATA_VEMISDEAD