TrinityCore
boss_bug_trio.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: boss_kri, boss_yauj, boss_vem : The Bug Trio
20SD%Complete: 100
21SDComment:
22SDCategory: Temple of Ahn'Qiraj
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "ScriptedCreature.h"
28#include "temple_of_ahnqiraj.h"
29#include "TemporarySummon.h"
30
32{
33 SPELL_CLEAVE = 26350,
35 SPELL_POISON_CLOUD = 38718, //Only Spell with right dmg.
36 SPELL_ENRAGE = 34624, //Changed cause 25790 is cast on gamers too. Same prob with old explosion of twin emperors.
37
38 SPELL_CHARGE = 26561,
40
41 SPELL_HEAL = 25807,
42 SPELL_FEAR = 19408
43};
44
46{
47public:
48 boss_kri() : CreatureScript("boss_kri") { }
49
50 CreatureAI* GetAI(Creature* creature) const override
51 {
52 return GetAQ40AI<boss_kriAI>(creature);
53 }
54
55 struct boss_kriAI : public BossAI
56 {
57 boss_kriAI(Creature* creature) : BossAI(creature, DATA_BUG_TRIO)
58 {
59 Initialize();
60 }
61
63 {
64 Cleave_Timer = urand(4000, 8000);
65 ToxicVolley_Timer = urand(6000, 12000);
66 Check_Timer = 2000;
67
68 VemDead = false;
69 Death = false;
70 }
71
75
76 bool VemDead;
77 bool Death;
78
79 void Reset() override
80 {
81 Initialize();
82 _Reset();
83 }
84
85 void JustDied(Unit* /*killer*/) override
86 {
87 if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2)// Unlootable if death
89
91 }
92 void UpdateAI(uint32 diff) override
93 {
94 //Return since we have no target
95 if (!UpdateVictim())
96 return;
97
98 //Cleave_Timer
99 if (Cleave_Timer <= diff)
100 {
102 Cleave_Timer = urand(5000, 12000);
103 } else Cleave_Timer -= diff;
104
105 //ToxicVolley_Timer
106 if (ToxicVolley_Timer <= diff)
107 {
109 ToxicVolley_Timer = urand(10000, 15000);
110 } else ToxicVolley_Timer -= diff;
111
112 if (!HealthAbovePct(5) && !Death)
113 {
115 Death = true;
116 }
117
118 if (!VemDead)
119 {
120 //Checking if Vem is dead. If yes we will enrage.
121 if (Check_Timer <= diff)
122 {
124 {
126 VemDead = true;
127 }
128 Check_Timer = 2000;
129 } else Check_Timer -=diff;
130 }
131 }
132 };
133
134};
135
137{
138public:
139 boss_vem() : CreatureScript("boss_vem") { }
140
141 CreatureAI* GetAI(Creature* creature) const override
142 {
143 return GetAQ40AI<boss_vemAI>(creature);
144 }
145
146 struct boss_vemAI : public BossAI
147 {
148 boss_vemAI(Creature* creature) : BossAI(creature, DATA_BUG_TRIO)
149 {
150 Initialize();
151 }
152
154 {
155 Charge_Timer = urand(15000, 27000);
156 KnockBack_Timer = urand(8000, 20000);
157 Enrage_Timer = 120000;
158
159 Enraged = false;
160 }
161
165
167
168 void Reset() override
169 {
170 Initialize();
171 _Reset();
172 }
173
174 void JustDied(Unit* /*killer*/) override
175 {
177 if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2)// Unlootable if death
180 }
181
182 void UpdateAI(uint32 diff) override
183 {
184 //Return since we have no target
185 if (!UpdateVictim())
186 return;
187
188 //Charge_Timer
189 if (Charge_Timer <= diff)
190 {
192 {
193 DoCast(target, SPELL_CHARGE);
194 //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1);
195 AttackStart(target);
196 }
197
198 Charge_Timer = urand(8000, 16000);
199 } else Charge_Timer -= diff;
200
201 //KnockBack_Timer
202 if (KnockBack_Timer <= diff)
203 {
205 if (GetThreat(me->GetVictim()))
207 KnockBack_Timer = urand(15000, 25000);
208 } else KnockBack_Timer -= diff;
209
210 //Enrage_Timer
211 if (!Enraged && Enrage_Timer <= diff)
212 {
214 Enraged = true;
215 } else Charge_Timer -= diff;
216 }
217 };
218
219};
220
222{
223public:
224 boss_yauj() : CreatureScript("boss_yauj") { }
225
226 CreatureAI* GetAI(Creature* creature) const override
227 {
228 return GetAQ40AI<boss_yaujAI>(creature);
229 }
230
231 struct boss_yaujAI : public BossAI
232 {
233 boss_yaujAI(Creature* creature) : BossAI(creature, DATA_BUG_TRIO)
234 {
235 Initialize();
236 }
237
239 {
240 Heal_Timer = urand(25000, 40000);
241 Fear_Timer = urand(12000, 24000);
242 Check_Timer = 2000;
243
244 VemDead = false;
245 }
246
250
252
253 void Reset() override
254 {
255 Initialize();
256 }
257
258 void JustDied(Unit* /*killer*/) override
259 {
260 if (instance->GetData(DATA_BUG_TRIO_DEATH) < 2)// Unlootable if death
263
264 for (uint8 i = 0; i < 10; ++i)
265 {
267 {
269 Summoned->AI()->AttackStart(target);
270 }
271 }
272 }
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 {
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 switch (urand(0, 2))
292 {
293 case 0:
295 DoCast(kri, SPELL_HEAL);
296 break;
297 case 1:
299 DoCast(vem, SPELL_HEAL);
300 break;
301 case 2:
303 break;
304 }
305
306 Heal_Timer = 15000 + rand32() % 15000;
307 } else Heal_Timer -= diff;
308
309 //Checking if Vem is dead. If yes we will enrage.
310 if (Check_Timer <= diff)
311 {
312 if (!VemDead)
313 {
315 {
317 VemDead = true;
318 }
319 }
320 Check_Timer = 2000;
321 } else Check_Timer -= diff;
322 }
323 };
324
325};
326
328{
329 new boss_kri();
330 new boss_vem();
331 new boss_yauj();
332}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: ObjectDefines.h:64
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
uint32 rand32()
Definition: Random.cpp:70
@ UNIT_DYNFLAG_LOOTABLE
@ SPELL_CLEAVE
@ SPELL_KNOCKBACK
@ SPELL_ENRAGE
@ SPELL_CHARGE
@ SPELL_FEAR
@ SPELL_HEAL
@ SPELL_POISON_CLOUD
@ SPELL_TOXIC_VOLLEY
void AddSC_bug_trio()
InstanceScript *const instance
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
Creature * GetCreature(uint32 type)
void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:170
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
Unit * GetVictim() const
Definition: Unit.h:715
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetPositionZ() const
Definition: Position.h:78
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
bool HealthAbovePct(uint32 pct) const
float GetThreat(Unit const *victim, Unit const *who=nullptr)
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
void ResetThreatList(Unit *who=nullptr)
void Reset() override
void UpdateAI(uint32 diff) override
boss_kriAI(Creature *creature)
void JustDied(Unit *) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
boss_vemAI(Creature *creature)
void Reset() override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
boss_yaujAI(Creature *creature)
@ DATA_BUG_TRIO
@ DATA_VEM_DEATH
@ DATA_BUG_TRIO_DEATH
@ DATA_KRI
@ DATA_VEM
@ DATA_VEMISDEAD