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 }
147};
148
149// 15544 - Vem
150struct boss_vem : public BossAI
151{
152 boss_vem(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { }
153
154 void JustEngagedWith(Unit* who) override
155 {
157
161 }
162
164 void JustReachedHome() override
165 {
169 }
170
171 void JustDied(Unit* /*killer*/) override
172 {
175
177
179 }
180
181 void UpdateAI(uint32 diff) override
182 {
183 if (!UpdateVictim())
184 return;
185
186 events.Update(diff);
187
189 return;
190
191 while (uint32 eventId = events.ExecuteEvent())
192 {
193 switch (eventId)
194 {
195 case EVENT_VEM_CHARGE:
197 DoCast(target, SPELL_CHARGE);
198 events.Repeat(15s, 25s);
199 break;
200 case EVENT_KNOCK_AWAY:
202 events.Repeat(15s, 20s);
203 break;
204 case EVENT_KNOCKDOWN:
206 events.Repeat(10s, 20s);
207 break;
208 default:
209 break;
210 }
211
213 return;
214 }
215 }
216};
217
218// 15543 - Princess Yauj
219struct boss_yauj : public BossAI
220{
221 boss_yauj(Creature* creature) : BossAI(creature, DATA_BUG_TRIO) { }
222
223 void JustEngagedWith(Unit* who) override
224 {
226
231 }
232
233 void JustReachedHome() override
234 {
237 }
238
247
248 void UpdateAI(uint32 diff) override
249 {
250 if (!UpdateVictim())
251 return;
252
253 events.Update(diff);
254
256 return;
257
258 while (uint32 eventId = events.ExecuteEvent())
259 {
260 switch (eventId)
261 {
262 case EVENT_GREAT_HEAL:
263 if (Unit* target = DoSelectLowestHpFriendly(250.0f))
264 DoCast(target, SPELL_GREAT_HEAL);
265 events.Repeat(10s, 15s);
266 break;
267 case EVENT_FEAR:
269 events.Repeat(20s, 30s);
270 break;
271 case EVENT_RAVAGE:
273 events.Repeat(10s, 15s);
274 break;
275 case EVENT_DISPEL:
277 events.Repeat(10s, 15s);
278 break;
279 default:
280 break;
281 }
282
284 return;
285 }
286 }
287};
288
uint32_t uint32
Definition Define.h:154
@ UNIT_DYNFLAG_LOOTABLE
@ UNIT_STATE_CASTING
Definition Unit.h:290
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:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
Creature * GetCreature(uint32 type)
void RemoveDynamicFlag(uint32 flag)
Definition Object.h:98
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
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