TrinityCore
Loading...
Searching...
No Matches
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/*
19 * Timers requires to be revisited
20 * Devour is NYI
21 */
22
23#include "ScriptMgr.h"
24#include "InstanceScript.h"
25#include "ScriptedCreature.h"
26#include "temple_of_ahnqiraj.h"
27
29{
30 // Kri
32 SPELL_CLEAVE = 40504,
35
36 // Vem
37 SPELL_CHARGE = 26561,
41
42 // Yauj
44 SPELL_FEAR = 26580,
46 SPELL_DISPEL = 25808,
48
49 // Shared
51 SPELL_BLOODY_DEATH = 25770 // NYI
52};
53
72
73static void RespawnDeadBugs(InstanceScript* instance)
74{
75 for (uint32 type : { DATA_KRI, DATA_VEM, DATA_YAUJ })
76 if (Creature* bug = instance->GetCreature(type))
77 if (bug->isDead())
78 bug->DespawnOrUnsummon(1ms, 1s);
79}
80
81// 15511 - Lord Kri
82struct boss_kri : public BossAI
83{
84 boss_kri(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { }
85
86 void JustEngagedWith(Unit* who) override
87 {
89
93 }
94
102
112
113 void UpdateAI(uint32 diff) override
114 {
115 if (!UpdateVictim())
116 return;
117
118 events.Update(diff);
119
121 return;
122
123 while (uint32 eventId = events.ExecuteEvent())
124 {
125 switch (eventId)
126 {
127 case EVENT_THRASH:
129 events.Repeat(5s, 15s);
130 break;
131 case EVENT_CLEAVE:
133 events.Repeat(5s, 15s);
134 break;
137 events.Repeat(5s, 20s);
138 break;
139 default:
140 break;
141 }
142
144 return;
145 }
146
148 }
149};
150
151// 15544 - Vem
152struct boss_vem : public BossAI
153{
154 boss_vem(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { }
155
156 void JustEngagedWith(Unit* who) override
157 {
159
163 }
164
166 void JustReachedHome() override
167 {
171 }
172
173 void JustDied(Unit* /*killer*/) override
174 {
177
179
181 }
182
183 void UpdateAI(uint32 diff) override
184 {
185 if (!UpdateVictim())
186 return;
187
188 events.Update(diff);
189
191 return;
192
193 while (uint32 eventId = events.ExecuteEvent())
194 {
195 switch (eventId)
196 {
197 case EVENT_VEM_CHARGE:
199 DoCast(target, SPELL_CHARGE);
200 events.Repeat(15s, 25s);
201 break;
202 case EVENT_KNOCK_AWAY:
204 events.Repeat(15s, 20s);
205 break;
206 case EVENT_KNOCKDOWN:
208 events.Repeat(10s, 20s);
209 break;
210 default:
211 break;
212 }
213
215 return;
216 }
217
219 }
220};
221
222// 15543 - Princess Yauj
223struct boss_yauj : public BossAI
224{
225 boss_yauj(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { }
226
227 void JustEngagedWith(Unit* who) override
228 {
230
235 }
236
237 void JustReachedHome() override
238 {
241 }
242
251
252 void UpdateAI(uint32 diff) override
253 {
254 if (!UpdateVictim())
255 return;
256
257 events.Update(diff);
258
260 return;
261
262 while (uint32 eventId = events.ExecuteEvent())
263 {
264 switch (eventId)
265 {
266 case EVENT_GREAT_HEAL:
267 if (Unit* target = DoSelectLowestHpFriendly(250.0f))
268 DoCast(target, SPELL_GREAT_HEAL);
269 events.Repeat(10s, 15s);
270 break;
271 case EVENT_FEAR:
273 events.Repeat(20s, 30s);
274 break;
275 case EVENT_RAVAGE:
277 events.Repeat(10s, 15s);
278 break;
279 case EVENT_DISPEL:
281 events.Repeat(10s, 15s);
282 break;
283 default:
284 break;
285 }
286
288 return;
289 }
290
292 }
293};
294
uint32_t uint32
Definition Define.h:133
@ UNIT_DYNFLAG_LOOTABLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
BugTrioEvents
@ EVENT_DISPEL
@ EVENT_VEM_CHARGE
@ EVENT_KNOCKDOWN
@ EVENT_KNOCK_AWAY
@ EVENT_GREAT_HEAL
@ EVENT_FEAR
@ EVENT_CLEAVE
@ EVENT_RAVAGE
@ EVENT_THRASH
@ EVENT_TOXIC_VOLLEY
BugTrioSpells
@ SPELL_CLEAVE
@ SPELL_VENGEANCE
@ SPELL_DISPEL
@ SPELL_CHARGE
@ SPELL_BLOODY_DEATH
@ SPELL_DESPAWN_BROOD
@ SPELL_FEAR
@ SPELL_RAVAGE
@ SPELL_SUMMON_YAUJ_BROOD
@ SPELL_KNOCK_AWAY
@ SPELL_THRASH
@ SPELL_SUMMON_POISON_CLOUD
@ SPELL_KNOCKDOWN
@ SPELL_GREAT_HEAL
@ SPELL_TOXIC_VOLLEY
void AddSC_bug_trio()
static void RespawnDeadBugs(InstanceScript *instance)
InstanceScript *const instance
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:90
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
boss_kri(Creature *creature)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void JustReachedHome() override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void JustReachedHome() override
boss_vem(Creature *creature)
void JustEngagedWith(Unit *who) override
boss_yauj(Creature *creature)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void JustReachedHome() override
#define RegisterAQ40CreatureAI(ai_name)
@ DATA_BUG_TRIO
@ DATA_BUG_TRIO_DEATH
@ DATA_KRI
@ DATA_VEM
@ DATA_YAUJ