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 "SpellMgr.h"
25#include "SpellScript.h"
26#include "shattered_halls.h"
27
65
67{
68 SPELL_FEAR = 30584,
71 SPELL_BURNING_MAUL = 30598, // Triggers 30620, what it does? (no, it doesn't trigger 30600)
72
73 SPELL_BLAST_WAVE = 30600
74};
75
83
97
102
103// 16809 - Warbringer O'mrogg
105{
107
108 void JustEngagedWith(Unit* who) override
109 {
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 {
123 if (spell->Id == SPELL_BEATDOWN)
124 {
126
128 AttackStart(target);
129
130 // Apparently this and all other are handled by GameEvents since this spell sends GameEvent
133 }
134
135 if (spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_BURNING_MAUL, me))
137 }
138
139 void KilledUnit(Unit* /*victim*/) override
140 {
142 leftHead->AI()->DoAction(RAND(ACTION_SLAY_1, ACTION_SLAY_2));
143 }
144
145 void JustDied(Unit* /*killer*/) override
146 {
147 _JustDied();
148
150 leftHead->AI()->DoAction(ACTION_DEATH);
151 }
152
153 void UpdateAI(uint32 diff) override
154 {
155 if (!UpdateVictim())
156 return;
157
158 events.Update(diff);
159
161 return;
162
163 while (uint32 eventId = events.ExecuteEvent())
164 {
165 switch (eventId)
166 {
167 case EVENT_FEAR:
169 events.Repeat(15s, 35s);
170 break;
173 events.Repeat(15s, 30s);
174 break;
175 case EVENT_BEATDOWN:
177 events.Repeat(25s, 40s);
178 break;
181 events.Repeat(60s, 70s);
182 break;
183 default:
184 break;
185 }
186
188 return;
189 }
190
192 }
193};
194
195// 19523 - O'mrogg's Left Head
196// 19524 - O'mrogg's Right Head
198{
199 npc_omrogg_heads(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
200
202 {
204 rightHead->AI()->Talk(text);
205 }
206
207 void DoAction(int32 action) override
208 {
209 switch (action)
210 {
211 case ACTION_AGGRO_1:
212 _scheduler.Schedule(0s, [this](TaskContext task)
213 {
214 switch (task.GetRepeatCounter())
215 {
216 case 0:
217 Talk(SAY_AGGRO_1);
218 task.Repeat(3s);
219 break;
220 case 1:
221 RightHeadTalk(SAY_AGGRO_1_1);
222 task.Repeat(3s);
223 break;
224 case 2:
225 Talk(SAY_AGGRO_1_2);
226 break;
227 default:
228 break;
229 }
230 });
231 break;
232 case ACTION_AGGRO_2:
233 _scheduler.Schedule(0s, [this](TaskContext task)
234 {
235 switch (task.GetRepeatCounter())
236 {
237 case 0:
238 Talk(SAY_AGGRO_2);
239 task.Repeat(3s);
240 break;
241 case 1:
242 RightHeadTalk(SAY_AGGRO_2_1);
243 break;
244 default:
245 break;
246 }
247 });
248 break;
249 case ACTION_AGGRO_3:
250 _scheduler.Schedule(0s, [this](TaskContext task)
251 {
252 switch (task.GetRepeatCounter())
253 {
254 case 0:
255 Talk(SAY_AGGRO_3);
256 task.Repeat(3s);
257 break;
258 case 1:
259 RightHeadTalk(SAY_AGGRO_3_1);
260 break;
261 default:
262 break;
263 }
264 });
265 break;
266 case ACTION_ATTACK_1:
267 _scheduler.Schedule(0s, [this](TaskContext task)
268 {
269 switch (task.GetRepeatCounter())
270 {
271 case 0:
272 Talk(SAY_ATTACK_1);
273 task.Repeat(3s);
274 break;
275 case 1:
276 RightHeadTalk(SAY_ATTACK_1_1);
277 task.Repeat(3s);
278 break;
279 case 2:
280 Talk(SAY_ATTACK_1_2);
281 break;
282 default:
283 break;
284 }
285 });
286 break;
287 case ACTION_ATTACK_2:
288 _scheduler.Schedule(0s, [this](TaskContext task)
289 {
290 switch (task.GetRepeatCounter())
291 {
292 case 0:
293 Talk(SAY_ATTACK_2);
294 task.Repeat(3s);
295 break;
296 case 1:
297 RightHeadTalk(SAY_ATTACK_2_1);
298 break;
299 default:
300 break;
301 }
302 });
303 break;
304 case ACTION_ATTACK_3:
305 _scheduler.Schedule(0s, [this](TaskContext task)
306 {
307 switch (task.GetRepeatCounter())
308 {
309 case 0:
310 Talk(SAY_ATTACK_3);
311 task.Repeat(3s);
312 break;
313 case 1:
314 RightHeadTalk(SAY_ATTACK_3_1);
315 task.Repeat(3s);
316 break;
317 case 2:
318 Talk(SAY_ATTACK_3_2);
319 break;
320 default:
321 break;
322 }
323 });
324 break;
325 case ACTION_ATTACK_4:
326 _scheduler.Schedule(0s, [this](TaskContext task)
327 {
328 switch (task.GetRepeatCounter())
329 {
330 case 0:
331 RightHeadTalk(SAY_ATTACK_4);
332 task.Repeat(2s);
333 break;
334 case 1:
335 Talk(SAY_ATTACK_4_1);
336 task.Repeat(2s);
337 break;
338 case 2:
339 RightHeadTalk(SAY_ATTACK_4_2);
340 break;
341 default:
342 break;
343 }
344 });
345 break;
346 case ACTION_SLAY_1:
347 _scheduler.Schedule(0s, [this](TaskContext /*task*/)
348 {
350 });
351 break;
352 case ACTION_SLAY_2:
353 _scheduler.Schedule(0s, [this](TaskContext task)
354 {
355 switch (task.GetRepeatCounter())
356 {
357 case 0:
359 task.Repeat(3s);
360 break;
361 case 1:
363 break;
364 default:
365 break;
366 }
367 });
368 break;
369 case ACTION_DEATH:
370 _scheduler.Schedule(0s, [this](TaskContext task)
371 {
372 switch (task.GetRepeatCounter())
373 {
374 case 0:
376 task.Repeat(3s);
377 break;
378 case 1:
382 rightHead->DespawnOrUnsummon(4s);
383 break;
384 default:
385 break;
386 }
387 });
388 break;
389 default:
390 break;
391 }
392 }
393
394 void UpdateAI(uint32 diff) override
395 {
396 _scheduler.Update(diff);
397 }
398
399private:
402};
403
405// That's a lot of damage if all melee attacks are successful so we cast it not always for now. No ProcCategoryRecovery for both spells
406// 30598, 36056 - Burning Maul
408{
410
411 bool Validate(SpellInfo const* /*spellInfo*/) override
412 {
414 }
415
416 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
417 {
418 if (Creature* creature = GetTarget()->ToCreature())
419 creature->LoadEquipment(EQUIP_ID_BURNING_MAUL);
420 }
421
422 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
423 {
424 if (Creature* creature = GetTarget()->ToCreature())
425 creature->LoadEquipment(creature->GetOriginalEquipmentId());
426 }
427
428 void OnProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
429 {
430 if (roll_chance_i(50))
432 }
433
440};
441
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PROC_TRIGGER_SPELL
#define sSpellMgr
Definition SpellMgr.h:738
#define AuraEffectProcFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ EQUIP_ID_BURNING_MAUL
void AddSC_boss_warbringer_omrogg()
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
HookList< EffectProcHandler > OnEffectProc
HookList< AuraProcHandler > OnProc
HookList< EffectApplyHandler > OnEffectApply
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
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)
uint32 Id
Definition SpellInfo.h:289
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
Definition Unit.h:769
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
void OnProc(AuraEffect const *, ProcEventInfo &)
PrepareAuraScript(spell_omrogg_burning_maul)
@ DATA_OMROGG
@ DATA_RIGHT_HEAD
@ DATA_LEFT_HEAD
#define RegisterShatteredHallsCreatureAI(ai_name)
void AttackStart(Unit *) override
void ResetThreatList(Unit *who=nullptr)
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)