@@ -23,61 +23,51 @@ EndScriptData */
2323
2424#include " precompiled.h"
2525#include " shadow_labyrinth.h"
26- #include " escort_ai.h"
2726
28- #define SAY_INTRO -1555000
29-
30- #define SAY_AGGRO1 -1555001
31- #define SAY_AGGRO2 -1555002
32- #define SAY_AGGRO3 -1555003
33-
34- #define SAY_HELP -1555004
35-
36- #define SAY_SLAY1 -1555005
37- #define SAY_SLAY2 -1555006
38-
39- #define SAY_DEATH -1555007
40-
41- #define SPELL_BANISH 30231
42- #define SPELL_CORROSIVE_ACID 33551
43- #define SPELL_FEAR 33547
44- #define SPELL_ENRAGE 34970
27+ enum
28+ {
29+ SAY_AGGRO_1 = -1555001 ,
30+ SAY_AGGRO_2 = -1555002 ,
31+ SAY_AGGRO_3 = -1555003 ,
32+ SAY_HELP = -1555004 ,
33+ SAY_SLAY_1 = -1555005 ,
34+ SAY_SLAY_2 = -1555006 ,
35+ SAY_DEATH = -1555007 ,
36+
37+ SPELL_CORROSIVE_ACID = 33551 ,
38+ SPELL_FEAR = 33547 ,
39+ SPELL_ENRAGE = 34970
40+ };
4541
46- struct MANGOS_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI
42+ struct MANGOS_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI
4743{
48- boss_ambassador_hellmawAI (Creature* pCreature) : npc_escortAI (pCreature)
44+ boss_ambassador_hellmawAI (Creature* pCreature) : ScriptedAI (pCreature)
4945 {
5046 m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData ();
5147 m_bIsRegularMode = pCreature->GetMap ()->IsRegularDifficulty ();
5248 Reset ();
49+
50+ if (m_pInstance && m_creature->isAlive ())
51+ {
52+ if (m_pInstance->GetData (TYPE_OVERSEER ) != DONE )
53+ DoCastSpellIfCan (m_creature, SPELL_BANISH , CAST_TRIGGERED );
54+ }
5355 }
5456
5557 ScriptedInstance* m_pInstance;
5658 bool m_bIsRegularMode;
5759
58- uint32 EventCheck_Timer;
59- uint32 CorrosiveAcid_Timer;
60- uint32 Fear_Timer;
61- uint32 Enrage_Timer;
62- bool Intro;
63- bool IsBanished;
64- bool Enraged;
60+ uint32 m_uiCorrosiveAcidTimer;
61+ uint32 m_uiFearTimer;
62+ uint32 m_uiEnrageTimer;
63+ bool m_bIsEnraged;
6564
6665 void Reset ()
6766 {
68- EventCheck_Timer = 5000 ;
69- CorrosiveAcid_Timer = urand (5000 , 10000 );
70- Fear_Timer = urand (25000 , 30000 );
71- Enrage_Timer = 180000 ;
72- Intro = false ;
73- IsBanished = true ;
74- Enraged = false ;
75-
76- if (m_pInstance && m_creature->isAlive ())
77- {
78- if (m_pInstance->GetData (TYPE_OVERSEER ) != DONE )
79- m_creature->CastSpell (m_creature, SPELL_BANISH , true );
80- }
67+ m_uiCorrosiveAcidTimer = urand (5000 , 10000 );
68+ m_uiFearTimer = urand (25000 , 30000 );
69+ m_uiEnrageTimer = 3 *MINUTE *IN_MILLISECONDS ;
70+ m_bIsEnraged = false ;
8171 }
8272
8373 void JustReachedHome ()
@@ -86,107 +76,62 @@ struct MANGOS_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI
8676 m_pInstance->SetData (TYPE_HELLMAW , FAIL );
8777 }
8878
89- void WaypointReached (uint32 i)
90- {
91- }
92-
93- void DoIntro ()
94- {
95- if (m_creature->HasAura (SPELL_BANISH , EFFECT_INDEX_0 ))
96- m_creature->RemoveAurasDueToSpell (SPELL_BANISH );
97-
98- IsBanished = false ;
99- Intro = true ;
100-
101- if (m_pInstance)
102- {
103- if (m_pInstance->GetData (TYPE_HELLMAW ) != FAIL )
104- {
105- DoScriptText (SAY_INTRO , m_creature);
106- Start (false , NULL , NULL , false , true );
107- }
108-
109- m_pInstance->SetData (TYPE_HELLMAW , IN_PROGRESS );
110- }
111- }
112-
113- void MoveInLineOfSight (Unit *who)
114- {
115- if (m_creature->HasAura (SPELL_BANISH , EFFECT_INDEX_0 ))
116- return ;
117-
118- npc_escortAI::MoveInLineOfSight (who);
119- }
120-
121- void Aggro (Unit *who)
79+ void Aggro (Unit* pWho)
12280 {
12381 switch (urand (0 , 2 ))
12482 {
125- case 0 : DoScriptText (SAY_AGGRO1 , m_creature); break ;
126- case 1 : DoScriptText (SAY_AGGRO2 , m_creature); break ;
127- case 2 : DoScriptText (SAY_AGGRO3 , m_creature); break ;
83+ case 0 : DoScriptText (SAY_AGGRO_1 , m_creature); break ;
84+ case 1 : DoScriptText (SAY_AGGRO_2 , m_creature); break ;
85+ case 2 : DoScriptText (SAY_AGGRO_3 , m_creature); break ;
12886 }
87+
88+ if (m_pInstance)
89+ m_pInstance->SetData (TYPE_HELLMAW , IN_PROGRESS );
12990 }
13091
131- void KilledUnit (Unit *victim )
92+ void KilledUnit (Unit* pVictim )
13293 {
133- DoScriptText (urand (0 , 1 ) ? SAY_SLAY1 : SAY_SLAY2 , m_creature);
94+ DoScriptText (urand (0 , 1 ) ? SAY_SLAY_1 : SAY_SLAY_2 , m_creature);
13495 }
13596
136- void JustDied (Unit *victim )
97+ void JustDied (Unit* pKiller )
13798 {
13899 DoScriptText (SAY_DEATH , m_creature);
139100
140101 if (m_pInstance)
141102 m_pInstance->SetData (TYPE_HELLMAW , DONE );
142103 }
143104
144- void UpdateEscortAI (const uint32 diff )
105+ void UpdateAI (const uint32 uiDiff )
145106 {
146- if (!Intro && !HasEscortState (STATE_ESCORT_ESCORTING ))
147- {
148- if (EventCheck_Timer < diff)
149- {
150- if (m_pInstance)
151- {
152- if (m_pInstance->GetData (TYPE_OVERSEER ) == DONE )
153- {
154- DoIntro ();
155- return ;
156- }
157- }
158- EventCheck_Timer = 5000 ;
159- return ;
160- }
161- else
162- {
163- EventCheck_Timer -= diff;
164- return ;
165- }
166- }
167-
168107 if (!m_creature->SelectHostileTarget () || !m_creature->getVictim ())
169108 return ;
170109
171- if (CorrosiveAcid_Timer < diff )
110+ if (m_uiCorrosiveAcidTimer < uiDiff )
172111 {
173- DoCastSpellIfCan (m_creature->getVictim (),SPELL_CORROSIVE_ACID );
174- CorrosiveAcid_Timer = urand (15000 , 25000 );
175- }else CorrosiveAcid_Timer -= diff;
112+ if (DoCastSpellIfCan (m_creature, SPELL_CORROSIVE_ACID ) == CAST_OK )
113+ m_uiCorrosiveAcidTimer = urand (15000 , 25000 );
114+ }
115+ else
116+ m_uiCorrosiveAcidTimer -= uiDiff;
176117
177- if (Fear_Timer < diff )
118+ if (m_uiFearTimer < uiDiff )
178119 {
179- DoCastSpellIfCan (m_creature,SPELL_FEAR );
180- Fear_Timer = urand (20000 , 35000 );
181- }else Fear_Timer -= diff;
120+ if (DoCastSpellIfCan (m_creature, SPELL_FEAR ) == CAST_OK )
121+ m_uiFearTimer = urand (20000 , 35000 );
122+ }
123+ else
124+ m_uiFearTimer -= uiDiff;
182125
183- if (!m_bIsRegularMode)
126+ if (!m_bIsRegularMode && !m_bIsEnraged )
184127 {
185- if (!Enraged && Enrage_Timer < diff )
128+ if (m_uiEnrageTimer < uiDiff )
186129 {
187- DoCastSpellIfCan (m_creature,SPELL_ENRAGE );
188- Enraged = true ;
189- }else Enrage_Timer -= diff;
130+ if (DoCastSpellIfCan (m_creature, SPELL_ENRAGE ) == CAST_OK )
131+ m_bIsEnraged = true ;
132+ }
133+ else
134+ m_uiEnrageTimer -= uiDiff;
190135 }
191136
192137 DoMeleeAttackIfReady ();
@@ -200,9 +145,10 @@ CreatureAI* GetAI_boss_ambassador_hellmaw(Creature* pCreature)
200145
201146void AddSC_boss_ambassador_hellmaw ()
202147{
203- Script *newscript;
204- newscript = new Script;
205- newscript->Name = " boss_ambassador_hellmaw" ;
206- newscript->GetAI = &GetAI_boss_ambassador_hellmaw;
207- newscript->RegisterSelf ();
148+ Script* pNewScript;
149+
150+ pNewScript = new Script;
151+ pNewScript->Name = " boss_ambassador_hellmaw" ;
152+ pNewScript->GetAI = &GetAI_boss_ambassador_hellmaw;
153+ pNewScript->RegisterSelf ();
208154}
0 commit comments