TrinityCore
Loading...
Searching...
No Matches
boss_warbringer_omrogg.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/* Timers requires to be revisited */
19
20#include "ScriptMgr.h"
21#include "InstanceScript.h"
22#include "ScriptedCreature.h"
23#include "SpellInfo.h"
24#include "SpellScript.h"
25#include "shattered_halls.h"
26
64
66{
67 SPELL_FEAR = 30584,
70 SPELL_BURNING_MAUL = 30598, // Triggers 30620, what it does? (no, it doesn't trigger 30600)
71
72 SPELL_BLAST_WAVE = 30600
73};
74
82
96
101
102// 16809 - Warbringer O'mrogg
104{
106
107 void JustEngagedWith(Unit* who) override
108 {
110
115
117 leftHead->AI()->DoAction(RAND(ACTION_AGGRO_1, ACTION_AGGRO_2, ACTION_AGGRO_3));
118 }
119
120 void OnSpellCast(SpellInfo const* spell) override
121 {
122 // Apparently this and all other are handled by GameEvents since this spell sends GameEvent
123 if (spell->Id == SPELL_BEATDOWN)
126
127 if (spell->Id == SPELL_BURNING_MAUL)
129 }
130
131 void KilledUnit(Unit* /*victim*/) override
132 {
134 leftHead->AI()->DoAction(RAND(ACTION_SLAY_1, ACTION_SLAY_2));
135 }
136
137 void JustDied(Unit* /*killer*/) override
138 {
139 _JustDied();
140
142 leftHead->AI()->DoAction(ACTION_DEATH);
143 }
144
145 void UpdateAI(uint32 diff) override
146 {
147 if (!UpdateVictim())
148 return;
149
150 events.Update(diff);
151
153 return;
154
155 while (uint32 eventId = events.ExecuteEvent())
156 {
157 switch (eventId)
158 {
159 case EVENT_FEAR:
161 events.Repeat(15s, 35s);
162 break;
165 events.Repeat(15s, 30s);
166 break;
167 case EVENT_BEATDOWN:
169 events.Repeat(25s, 40s);
170 break;
173 events.Repeat(60s, 70s);
174 break;
175 default:
176 break;
177 }
178
180 return;
181 }
182 }
183};
184
185// 19523 - O'mrogg's Left Head
186// 19524 - O'mrogg's Right Head
188{
189 npc_omrogg_heads(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
190
192 {
194 rightHead->AI()->Talk(text);
195 }
196
197 void DoAction(int32 action) override
198 {
199 switch (action)
200 {
201 case ACTION_AGGRO_1:
202 _scheduler.Schedule(0s, [this](TaskContext& task)
203 {
204 switch (task.GetRepeatCounter())
205 {
206 case 0:
207 Talk(SAY_AGGRO_1);
208 task.Repeat(3s);
209 break;
210 case 1:
211 RightHeadTalk(SAY_AGGRO_1_1);
212 task.Repeat(3s);
213 break;
214 case 2:
215 Talk(SAY_AGGRO_1_2);
216 break;
217 default:
218 break;
219 }
220 });
221 break;
222 case ACTION_AGGRO_2:
223 _scheduler.Schedule(0s, [this](TaskContext& task)
224 {
225 switch (task.GetRepeatCounter())
226 {
227 case 0:
228 Talk(SAY_AGGRO_2);
229 task.Repeat(3s);
230 break;
231 case 1:
232 RightHeadTalk(SAY_AGGRO_2_1);
233 break;
234 default:
235 break;
236 }
237 });
238 break;
239 case ACTION_AGGRO_3:
240 _scheduler.Schedule(0s, [this](TaskContext& task)
241 {
242 switch (task.GetRepeatCounter())
243 {
244 case 0:
245 Talk(SAY_AGGRO_3);
246 task.Repeat(3s);
247 break;
248 case 1:
249 RightHeadTalk(SAY_AGGRO_3_1);
250 break;
251 default:
252 break;
253 }
254 });
255 break;
256 case ACTION_ATTACK_1:
257 _scheduler.Schedule(0s, [this](TaskContext& task)
258 {
259 switch (task.GetRepeatCounter())
260 {
261 case 0:
262 Talk(SAY_ATTACK_1);
263 task.Repeat(3s);
264 break;
265 case 1:
266 RightHeadTalk(SAY_ATTACK_1_1);
267 task.Repeat(3s);
268 break;
269 case 2:
270 Talk(SAY_ATTACK_1_2);
271 break;
272 default:
273 break;
274 }
275 });
276 break;
277 case ACTION_ATTACK_2:
278 _scheduler.Schedule(0s, [this](TaskContext& task)
279 {
280 switch (task.GetRepeatCounter())
281 {
282 case 0:
283 Talk(SAY_ATTACK_2);
284 task.Repeat(3s);
285 break;
286 case 1:
287 RightHeadTalk(SAY_ATTACK_2_1);
288 break;
289 default:
290 break;
291 }
292 });
293 break;
294 case ACTION_ATTACK_3:
295 _scheduler.Schedule(0s, [this](TaskContext& task)
296 {
297 switch (task.GetRepeatCounter())
298 {
299 case 0:
300 Talk(SAY_ATTACK_3);
301 task.Repeat(3s);
302 break;
303 case 1:
304 RightHeadTalk(SAY_ATTACK_3_1);
305 task.Repeat(3s);
306 break;
307 case 2:
308 Talk(SAY_ATTACK_3_2);
309 break;
310 default:
311 break;
312 }
313 });
314 break;
315 case ACTION_ATTACK_4:
316 _scheduler.Schedule(0s, [this](TaskContext& task)
317 {
318 switch (task.GetRepeatCounter())
319 {
320 case 0:
321 RightHeadTalk(SAY_ATTACK_4);
322 task.Repeat(2s);
323 break;
324 case 1:
325 Talk(SAY_ATTACK_4_1);
326 task.Repeat(2s);
327 break;
328 case 2:
329 RightHeadTalk(SAY_ATTACK_4_2);
330 break;
331 default:
332 break;
333 }
334 });
335 break;
336 case ACTION_SLAY_1:
337 _scheduler.Schedule(0s, [this](TaskContext const& /*task*/)
338 {
340 });
341 break;
342 case ACTION_SLAY_2:
343 _scheduler.Schedule(0s, [this](TaskContext& task)
344 {
345 switch (task.GetRepeatCounter())
346 {
347 case 0:
349 task.Repeat(3s);
350 break;
351 case 1:
353 break;
354 default:
355 break;
356 }
357 });
358 break;
359 case ACTION_DEATH:
360 _scheduler.Schedule(0s, [this](TaskContext& task)
361 {
362 switch (task.GetRepeatCounter())
363 {
364 case 0:
366 task.Repeat(3s);
367 break;
368 case 1:
372 rightHead->DespawnOrUnsummon(4s);
373 break;
374 default:
375 break;
376 }
377 });
378 break;
379 default:
380 break;
381 }
382 }
383
384 void UpdateAI(uint32 diff) override
385 {
386 _scheduler.Update(diff);
387 }
388
389private:
392};
393
394// 30598, 36056 - Burning Maul
396{
397 bool Validate(SpellInfo const* /*spellInfo*/) override
398 {
400 }
401
402 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
403 {
404 if (Creature* creature = GetTarget()->ToCreature())
405 creature->LoadEquipment(EQUIP_ID_BURNING_MAUL);
406 }
407
408 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
409 {
410 if (Creature* creature = GetTarget()->ToCreature())
411 creature->LoadEquipment(creature->GetOriginalEquipmentId());
412 }
413
414 void OnProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
415 {
418 if (roll_chance(30))
420 }
421
428};
429
430// 30618 - Beatdown
432{
434 {
435 Unit* caster = GetCaster();
436 if (!caster->IsCreature())
437 return;
438
440
441 if (Unit* target = caster->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true))
442 caster->GetAI()->AttackStart(target);
443 }
444
449};
450
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PROC_TRIGGER_SPELL
#define AuraEffectProcFn(F, I, N)
#define SpellCastFn(F)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:290
@ EQUIP_ID_BURNING_MAUL
void AddSC_boss_warbringer_omrogg()
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
HookList< EffectProcHandler > OnEffectProc
HookList< AuraProcHandler > OnProc
HookList< EffectApplyHandler > OnEffectApply
bool IsCreature() const
Definition BaseEntity.h:172
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
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)
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void AttackStart(Unit *victim)
Definition UnitAI.cpp:29
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
Definition Unit.h:647
ThreatManager & GetThreatManager()
Definition Unit.h:1093
UnitAI * GetAI() const
Definition Unit.h:680
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
void OnProc(AuraEffect const *, ProcEventInfo &)
@ DATA_OMROGG
@ DATA_RIGHT_HEAD
@ DATA_LEFT_HEAD
#define RegisterShatteredHallsCreatureAI(ai_name)
boss_warbringer_omrogg(Creature *creature)
void OnSpellCast(SpellInfo const *spell) override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *) override
void JustEngagedWith(Unit *who) override
void RightHeadTalk(uint32 text)
void UpdateAI(uint32 diff) override
void DoAction(int32 action) override
npc_omrogg_heads(Creature *creature)