Skip to content

Commit 2c141bd

Browse files
committed
[2672] Small cleanup for Warbringer Omrogg - Shattered Halls
1 parent 8db426a commit 2c141bd

2 files changed

Lines changed: 101 additions & 82 deletions

File tree

scripts/outland/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp

Lines changed: 100 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ struct MANGOS_DLL_DECL mob_omrogg_headsAI : public ScriptedAI
102102
{
103103
mob_omrogg_headsAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
104104

105-
uint32 m_uiDeath_Timer;
105+
uint32 m_uiDeathTimer;
106106
bool m_bDeathYell;
107107

108108
void Reset()
109109
{
110-
m_uiDeath_Timer = 4000;
110+
m_uiDeathTimer = 2000;
111111
m_bDeathYell = false;
112112
}
113113

@@ -121,12 +121,14 @@ struct MANGOS_DLL_DECL mob_omrogg_headsAI : public ScriptedAI
121121
if (!m_bDeathYell)
122122
return;
123123

124-
if (m_uiDeath_Timer < uiDiff)
124+
if (m_uiDeathTimer < uiDiff)
125125
{
126126
DoScriptText(YELL_DIE_R, m_creature);
127-
m_uiDeath_Timer = false;
128-
m_creature->SetDeathState(JUST_DIED);
129-
}else m_uiDeath_Timer -= uiDiff;
127+
m_uiDeathTimer = 10000;
128+
m_creature->ForcedDespawn(1000);
129+
}
130+
else
131+
m_uiDeathTimer -= uiDiff;
130132
}
131133
};
132134

@@ -154,43 +156,28 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
154156
bool m_bThreatYell2;
155157
bool m_bKillingYell;
156158

157-
uint32 m_uiDelay_Timer;
158-
uint32 m_uiBlastWave_Timer;
159+
uint32 m_uiDelayTimer;
160+
uint32 m_uiBlastWaveTimer;
159161
uint32 m_uiBlastCount;
160-
uint32 m_uiFear_Timer;
161-
uint32 m_uiBurningMaul_Timer;
162-
uint32 m_uiThunderClap_Timer;
163-
uint32 m_uiResetThreat_Timer;
162+
uint32 m_uiFearTimer;
163+
uint32 m_uiBurningMaulTimer;
164+
uint32 m_uiThunderClapTimer;
165+
uint32 m_uiResetThreatTimer;
164166

165167
void Reset()
166168
{
167-
if (Creature* pLeftHead = m_creature->GetMap()->GetCreature(m_leftHeadGuid))
168-
{
169-
pLeftHead->SetDeathState(JUST_DIED);
170-
m_leftHeadGuid.Clear();
171-
}
172-
173-
if (Creature* pRightHead = m_creature->GetMap()->GetCreature(m_rightHeadGuid))
174-
{
175-
pRightHead->SetDeathState(JUST_DIED);
176-
m_rightHeadGuid.Clear();
177-
}
178-
179-
m_bAggroYell = false;
180-
m_bThreatYell = false;
181-
m_bThreatYell2 = false;
182-
m_bKillingYell = false;
183-
184-
m_uiDelay_Timer = 4000;
185-
m_uiBlastWave_Timer = 0;
186-
m_uiBlastCount = 0;
187-
m_uiFear_Timer = 8000;
188-
m_uiBurningMaul_Timer = 25000;
189-
m_uiThunderClap_Timer = 15000;
190-
m_uiResetThreat_Timer = 30000;
191-
192-
if (m_pInstance)
193-
m_pInstance->SetData(TYPE_OMROGG, NOT_STARTED); //End boss can use this later. O'mrogg must be defeated(DONE) or he will come to aid.
169+
m_bAggroYell = false;
170+
m_bThreatYell = false;
171+
m_bThreatYell2 = false;
172+
m_bKillingYell = false;
173+
174+
m_uiDelayTimer = 4000;
175+
m_uiBlastWaveTimer = 0;
176+
m_uiBlastCount = 0;
177+
m_uiFearTimer = 8000;
178+
m_uiBurningMaulTimer = 25000;
179+
m_uiThunderClapTimer = 15000;
180+
m_uiResetThreatTimer = 30000;
194181
}
195182

196183
void DoYellForThreat()
@@ -207,7 +194,7 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
207194

208195
DoScriptText(Threat[m_iThreat].id, pSource);
209196

210-
m_uiDelay_Timer = 3500;
197+
m_uiDelayTimer = 3500;
211198
m_bThreatYell = true;
212199
}
213200

@@ -222,7 +209,7 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
222209

223210
DoScriptText(GoCombat[m_iAggro].id, pLeftHead);
224211

225-
m_uiDelay_Timer = 3500;
212+
m_uiDelayTimer = 3500;
226213
m_bAggroYell = true;
227214
}
228215

@@ -234,13 +221,8 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
234221
{
235222
if (pSummoned->GetEntry() == NPC_LEFT_HEAD)
236223
m_leftHeadGuid = pSummoned->GetObjectGuid();
237-
238-
if (pSummoned->GetEntry() == NPC_RIGHT_HEAD)
224+
else if (pSummoned->GetEntry() == NPC_RIGHT_HEAD)
239225
m_rightHeadGuid = pSummoned->GetObjectGuid();
240-
241-
//summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
242-
//summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
243-
pSummoned->SetVisibility(VISIBILITY_OFF);
244226
}
245227

246228
void KilledUnit(Unit* pVictim)
@@ -259,7 +241,7 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
259241
{
260242
case 0:
261243
DoScriptText(Killing[m_iKilling].id, pSource);
262-
m_uiDelay_Timer = 3500;
244+
m_uiDelayTimer = 3500;
263245
m_bKillingYell = true;
264246
break;
265247
case 1:
@@ -278,7 +260,7 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
278260
return;
279261

280262
DoScriptText(YELL_DIE_L, pLeftHead);
281-
pLeftHead->SetDeathState(JUST_DIED);
263+
pLeftHead->ForcedDespawn(1000);
282264

283265
if (mob_omrogg_headsAI* pHeadAI = dynamic_cast<mob_omrogg_headsAI*>(pRightHead->AI()))
284266
pHeadAI->DoDeathYell();
@@ -287,11 +269,29 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
287269
m_pInstance->SetData(TYPE_OMROGG, DONE);
288270
}
289271

272+
void JustReachedHome()
273+
{
274+
if (Creature* pLeftHead = m_creature->GetMap()->GetCreature(m_leftHeadGuid))
275+
{
276+
pLeftHead->ForcedDespawn();
277+
m_leftHeadGuid.Clear();
278+
}
279+
280+
if (Creature* pRightHead = m_creature->GetMap()->GetCreature(m_rightHeadGuid))
281+
{
282+
pRightHead->ForcedDespawn();
283+
m_rightHeadGuid.Clear();
284+
}
285+
286+
if (m_pInstance)
287+
m_pInstance->SetData(TYPE_OMROGG, FAIL);
288+
}
289+
290290
void UpdateAI(const uint32 uiDiff)
291291
{
292-
if (m_uiDelay_Timer < uiDiff)
292+
if (m_uiDelayTimer < uiDiff)
293293
{
294-
m_uiDelay_Timer = 3500;
294+
m_uiDelayTimer = 3500;
295295

296296
Creature* pLeftHead = m_creature->GetMap()->GetCreature(m_leftHeadGuid);
297297
Creature* pRightHead = m_creature->GetMap()->GetCreature(m_rightHeadGuid);
@@ -329,52 +329,71 @@ struct MANGOS_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
329329
DoScriptText(KillingDelay[m_iKilling].id, pSource);
330330
m_bKillingYell = false;
331331
}
332-
}else m_uiDelay_Timer -= uiDiff;
332+
}
333+
else
334+
m_uiDelayTimer -= uiDiff;
333335

334336
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
335337
return;
336338

337-
if (m_uiBlastCount && m_uiBlastWave_Timer <= uiDiff)
339+
if (m_uiBlastCount && m_uiBlastWaveTimer)
338340
{
339-
DoCastSpellIfCan(m_creature,SPELL_BLAST_WAVE);
340-
m_uiBlastWave_Timer = 5000;
341-
++m_uiBlastCount;
342-
343-
if (m_uiBlastCount == 3)
344-
m_uiBlastCount = 0;
345-
}else m_uiBlastWave_Timer -= uiDiff;
341+
if (m_uiBlastWaveTimer <= uiDiff)
342+
{
343+
if (DoCastSpellIfCan(m_creature, SPELL_BLAST_WAVE) == CAST_OK)
344+
{
345+
m_uiBlastWaveTimer = 5000;
346+
++m_uiBlastCount;
347+
348+
if (m_uiBlastCount == 3)
349+
m_uiBlastCount = 0;
350+
}
351+
}
352+
else
353+
m_uiBlastWaveTimer -= uiDiff;
354+
}
346355

347-
if (m_uiBurningMaul_Timer < uiDiff)
356+
if (m_uiBurningMaulTimer < uiDiff)
348357
{
349-
DoScriptText(EMOTE_ENRAGE, m_creature);
350-
DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_BURNING_MAUL : SPELL_BURNING_MAUL_H);
351-
m_uiBurningMaul_Timer = 40000;
352-
m_uiBlastWave_Timer = 16000;
353-
m_uiBlastCount = 1;
354-
}else m_uiBurningMaul_Timer -= uiDiff;
355-
356-
if (m_uiResetThreat_Timer < uiDiff)
358+
if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_BURNING_MAUL : SPELL_BURNING_MAUL_H) == CAST_OK)
359+
{
360+
DoScriptText(EMOTE_ENRAGE, m_creature);
361+
m_uiBurningMaulTimer = 40000;
362+
m_uiBlastWaveTimer = 16000;
363+
m_uiBlastCount = 1;
364+
}
365+
}
366+
else
367+
m_uiBurningMaulTimer -= uiDiff;
368+
369+
if (m_uiResetThreatTimer < uiDiff)
357370
{
358-
if (Unit *target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
371+
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
359372
{
360373
DoYellForThreat();
361374
DoResetThreat();
362-
m_creature->AddThreat(target);
375+
AttackStart(pTarget);
363376
}
364-
m_uiResetThreat_Timer = urand(25000, 40000);
365-
}else m_uiResetThreat_Timer -= uiDiff;
377+
m_uiResetThreatTimer = urand(25000, 40000);
378+
}
379+
else
380+
m_uiResetThreatTimer -= uiDiff;
366381

367-
if (m_uiFear_Timer < uiDiff)
382+
if (m_uiFearTimer < uiDiff)
368383
{
369-
DoCastSpellIfCan(m_creature,SPELL_FEAR);
370-
m_uiFear_Timer = urand(15000, 35000);
371-
}else m_uiFear_Timer -= uiDiff;
384+
if (DoCastSpellIfCan(m_creature, SPELL_FEAR) == CAST_OK)
385+
m_uiFearTimer = urand(15000, 35000);
386+
}
387+
else
388+
m_uiFearTimer -= uiDiff;
372389

373-
if (m_uiThunderClap_Timer < uiDiff)
390+
if (m_uiThunderClapTimer < uiDiff)
374391
{
375-
DoCastSpellIfCan(m_creature,SPELL_THUNDERCLAP);
376-
m_uiThunderClap_Timer = urand(15000, 30000);
377-
}else m_uiThunderClap_Timer -= uiDiff;
392+
if (DoCastSpellIfCan(m_creature, SPELL_THUNDERCLAP) == CAST_OK)
393+
m_uiThunderClapTimer = urand(15000, 30000);
394+
}
395+
else
396+
m_uiThunderClapTimer -= uiDiff;
378397

379398
DoMeleeAttackIfReady();
380399
}

sd2_revision_nr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#ifndef __SD2_REVISION_NR_H__
22
#define __SD2_REVISION_NR_H__
3-
#define SD2_REVISION_NR "2671"
3+
#define SD2_REVISION_NR "2672"
44
#endif // __SD2_REVISION_NR_H__

0 commit comments

Comments
 (0)