@@ -46,186 +46,142 @@ enum CreatureId
4646 NPC_FALLOUT_SLIME =16290
4747};
4848
49- class boss_grobbulus :public CreatureScript
49+ struct boss_grobbulus :public BossAI
5050{
51- public:
52- boss_grobbulus () : CreatureScript(" boss_grobbulus" ) { }
53-
54- struct boss_grobbulusAI :public BossAI
51+ boss_grobbulus (Creature* creature) : BossAI(creature, BOSS_GROBBULUS) { }
52+
53+ void JustEngagedWith (Unit* who)override
54+ {
55+ BossAI::JustEngagedWith (who);
56+ events.ScheduleEvent (EVENT_CLOUD, 15s);
57+ events.ScheduleEvent (EVENT_INJECT, 20s);
58+ events.ScheduleEvent (EVENT_SPRAY,randtime (Seconds (15 ),Seconds (30 )));// not sure
59+ events.ScheduleEvent (EVENT_BERSERK, 12min);
60+ }
61+
62+ void SpellHitTarget (WorldObject* target, SpellInfoconst * spellInfo)override
63+ {
64+ if (spellInfo->Id == SPELL_SLIME_SPRAY)
65+ me->SummonCreature (NPC_FALLOUT_SLIME, *target, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT);
66+ }
67+
68+ void UpdateAI (uint32 diff)override
69+ {
70+ if (!UpdateVictim ())
71+ return ;
72+
73+ events.Update (diff);
74+
75+ while (uint32 eventId = events.ExecuteEvent ())
5576 {
56- boss_grobbulusAI (Creature* creature) : BossAI(creature, BOSS_GROBBULUS) { }
57-
58- void JustEngagedWith (Unit* who)override
59- {
60- BossAI::JustEngagedWith (who);
61- events.ScheduleEvent (EVENT_CLOUD, 15s);
62- events.ScheduleEvent (EVENT_INJECT, 20s);
63- events.ScheduleEvent (EVENT_SPRAY,randtime (Seconds (15 ),Seconds (30 )));// not sure
64- events.ScheduleEvent (EVENT_BERSERK, 12min);
65- }
66-
67- void SpellHitTarget (WorldObject* target, SpellInfoconst * spellInfo)override
68- {
69- if (spellInfo->Id == SPELL_SLIME_SPRAY)
70- me->SummonCreature (NPC_FALLOUT_SLIME, *target, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT);
71- }
72-
73- void UpdateAI (uint32 diff)override
77+ switch (eventId)
7478 {
75- if (!UpdateVictim ())
79+ case EVENT_CLOUD:
80+ DoCastAOE (SPELL_POISON_CLOUD);
81+ events.Repeat (Seconds (15 ));
7682return ;
77-
78- events.Update (diff);
79-
80- while (uint32 eventId = events.ExecuteEvent ())
81- {
82- switch (eventId)
83- {
84- case EVENT_CLOUD:
85- DoCastAOE (SPELL_POISON_CLOUD);
86- events.Repeat (Seconds (15 ));
87- return ;
88- case EVENT_BERSERK:
89- DoCastAOE (SPELL_BERSERK,true );
90- return ;
91- case EVENT_SPRAY:
92- DoCastAOE (SPELL_SLIME_SPRAY);
93- events.Repeat (randtime (Seconds (15 ),Seconds (30 )));
94- return ;
95- case EVENT_INJECT:
96- if (Unit* target =SelectTarget (SelectTargetMethod::Random,1 ,0 .0f ,true ,true , -SPELL_MUTATING_INJECTION))
97- DoCast (target, SPELL_MUTATING_INJECTION);
98- events.Repeat (Seconds (8 ) +Milliseconds (uint32 (std::round (120 * me->GetHealthPct ()))));
99- return ;
100- default :
101- break ;
102- }
103- }
104-
105- DoMeleeAttackIfReady ();
83+ case EVENT_BERSERK:
84+ DoCastAOE (SPELL_BERSERK,true );
85+ return ;
86+ case EVENT_SPRAY:
87+ DoCastAOE (SPELL_SLIME_SPRAY);
88+ events.Repeat (randtime (Seconds (15 ),Seconds (30 )));
89+ return ;
90+ case EVENT_INJECT:
91+ if (Unit* target =SelectTarget (SelectTargetMethod::Random,1 ,0 .0f ,true ,true , -SPELL_MUTATING_INJECTION))
92+ DoCast (target, SPELL_MUTATING_INJECTION);
93+ events.Repeat (Seconds (8 ) +Milliseconds (uint32 (std::round (120 * me->GetHealthPct ()))));
94+ return ;
95+ default :
96+ break ;
10697 }
107- };
108-
109- CreatureAI*GetAI (Creature* creature)const override
110- {
111- return GetNaxxramasAI<boss_grobbulusAI>(creature);
11298 }
99+
100+ DoMeleeAttackIfReady ();
101+ }
113102};
114103
115- class npc_grobbulus_poison_cloud :public CreatureScript
104+ struct npc_grobbulus_poison_cloud :public ScriptedAI
116105{
117- public:
118- npc_grobbulus_poison_cloud () : CreatureScript(" npc_grobbulus_poison_cloud" ) { }
119-
120- struct npc_grobbulus_poison_cloudAI :public ScriptedAI
121- {
122- npc_grobbulus_poison_cloudAI (Creature* creature) : ScriptedAI(creature)
123- {
124- SetCombatMovement (false );
125- creature->SetReactState (REACT_PASSIVE);
126- }
127-
128- void IsSummonedBy (WorldObject*/* summoner*/ )override
129- {
130- // no visual when casting in ctor or Reset()
131- DoCast (me, SPELL_POISON_CLOUD_PASSIVE,true );
132- DoCast (me, SPELL_PACIFY_SELF,true );
133- }
134-
135- void UpdateAI (uint32/* diff*/ )override { }
136- };
137-
138- CreatureAI*GetAI (Creature* creature)const override
139- {
140- return GetNaxxramasAI<npc_grobbulus_poison_cloudAI>(creature);
141- }
106+ npc_grobbulus_poison_cloud (Creature* creature) : ScriptedAI(creature)
107+ {
108+ SetCombatMovement (false );
109+ creature->SetReactState (REACT_PASSIVE);
110+ }
111+
112+ void IsSummonedBy (WorldObject*/* summoner*/ )override
113+ {
114+ // no visual when casting in ctor or Reset()
115+ DoCast (me, SPELL_POISON_CLOUD_PASSIVE,true );
116+ DoCast (me, SPELL_PACIFY_SELF,true );
117+ }
118+
119+ void UpdateAI (uint32/* diff*/ )override { }
142120};
143121
144122// 28169 - Mutating Injection
145- class spell_grobbulus_mutating_injection :public SpellScriptLoader
123+ class spell_grobbulus_mutating_injection :public AuraScript
146124{
147- public:
148- spell_grobbulus_mutating_injection () : SpellScriptLoader(" spell_grobbulus_mutating_injection" ) { }
125+ PrepareAuraScript (spell_grobbulus_mutating_injection);
149126
150- class spell_grobbulus_mutating_injection_AuraScript :public AuraScript
151- {
152- PrepareAuraScript (spell_grobbulus_mutating_injection_AuraScript);
127+ bool Validate (SpellInfoconst */* spellInfo*/ )override
128+ {
129+ return ValidateSpellInfo ({ SPELL_MUTATING_EXPLOSION, SPELL_POISON_CLOUD });
130+ }
153131
154- bool Validate (SpellInfoconst */* spellInfo*/ )override
155- {
156- return ValidateSpellInfo ({ SPELL_MUTATING_EXPLOSION, SPELL_POISON_CLOUD });
157- }
158-
159- void HandleRemove (AuraEffectconst * aurEff, AuraEffectHandleModes/* mode*/ )
160- {
161- AuraRemoveMode removeMode =GetTargetApplication ()->GetRemoveMode ();
162- if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE)
163- return ;
164-
165- if (Unit* caster =GetCaster ())
166- {
167- caster->CastSpell (GetTarget (), SPELL_MUTATING_EXPLOSION,true );
168- GetTarget ()->CastSpell (GetTarget (), SPELL_POISON_CLOUD, { aurEff,GetCasterGUID () });
169- }
170- }
171-
172- void Register ()override
173- {
174- AfterEffectRemove +=AuraEffectRemoveFn (spell_grobbulus_mutating_injection_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
175- }
176- };
132+ void HandleRemove (AuraEffectconst * aurEff, AuraEffectHandleModes/* mode*/ )
133+ {
134+ AuraRemoveMode removeMode =GetTargetApplication ()->GetRemoveMode ();
135+ if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE)
136+ return ;
177137
178- AuraScript* GetAuraScript () const override
138+ if (Unit* caster = GetCaster ())
179139 {
180- return new spell_grobbulus_mutating_injection_AuraScript ();
140+ caster->CastSpell (GetTarget (), SPELL_MUTATING_EXPLOSION,true );
141+ GetTarget ()->CastSpell (GetTarget (), SPELL_POISON_CLOUD, { aurEff,GetCasterGUID () });
181142 }
143+ }
144+
145+ void Register ()override
146+ {
147+ AfterEffectRemove +=AuraEffectRemoveFn (spell_grobbulus_mutating_injection::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
148+ }
182149};
183150
184151// 28158, 54362 - Poison (Grobbulus)
185- class spell_grobbulus_poison_cloud :public SpellScriptLoader
152+ class spell_grobbulus_poison_cloud :public AuraScript
186153{
187- public:
188- spell_grobbulus_poison_cloud () : SpellScriptLoader(" spell_grobbulus_poison_cloud" ) { }
189-
190- class spell_grobbulus_poison_cloud_AuraScript :public AuraScript
191- {
192- PrepareAuraScript (spell_grobbulus_poison_cloud_AuraScript);
193-
194- bool Validate (SpellInfoconst * spellInfo)override
195- {
196- return ValidateSpellInfo ({ spellInfo->Effects [EFFECT_0].TriggerSpell });
197- }
198-
199- void PeriodicTick (AuraEffectconst * aurEff)
200- {
201- PreventDefaultAction ();
202- if (!aurEff->GetTotalTicks ())
203- return ;
204-
205- uint32 triggerSpell =GetSpellInfo ()->Effects [aurEff->GetEffIndex ()].TriggerSpell ;
206- int32 mod =int32 (((float (aurEff->GetTickNumber ()) / aurEff->GetTotalTicks ()) *0 .9f +0 .1f ) *10000 *2 /3 );
207-
208- CastSpellExtraArgsargs (aurEff);
209- args.AddSpellMod (SPELLVALUE_RADIUS_MOD, mod);
210- GetTarget ()->CastSpell (nullptr , triggerSpell, args);
211- }
212-
213- void Register ()override
214- {
215- OnEffectPeriodic +=AuraEffectPeriodicFn (spell_grobbulus_poison_cloud_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
216- }
217- };
218-
219- AuraScript*GetAuraScript ()const override
220- {
221- return new spell_grobbulus_poison_cloud_AuraScript ();
222- }
154+ PrepareAuraScript (spell_grobbulus_poison_cloud);
155+
156+ bool Validate (SpellInfoconst * spellInfo)override
157+ {
158+ return ValidateSpellInfo ({ spellInfo->Effects [EFFECT_0].TriggerSpell });
159+ }
160+
161+ void PeriodicTick (AuraEffectconst * aurEff)
162+ {
163+ PreventDefaultAction ();
164+ if (!aurEff->GetTotalTicks ())
165+ return ;
166+
167+ uint32 triggerSpell =GetSpellInfo ()->Effects [aurEff->GetEffIndex ()].TriggerSpell ;
168+ int32 mod =int32 (((float (aurEff->GetTickNumber ()) / aurEff->GetTotalTicks ()) *0 .9f +0 .1f ) *10000 *2 /3 );
169+
170+ CastSpellExtraArgsargs (aurEff);
171+ args.AddSpellMod (SPELLVALUE_RADIUS_MOD, mod);
172+ GetTarget ()->CastSpell (nullptr , triggerSpell, args);
173+ }
174+
175+ void Register ()override
176+ {
177+ OnEffectPeriodic +=AuraEffectPeriodicFn (spell_grobbulus_poison_cloud::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
178+ }
223179};
224180
225181void AddSC_boss_grobbulus ()
226182{
227- new boss_grobbulus ( );
228- new npc_grobbulus_poison_cloud ( );
229- new spell_grobbulus_mutating_injection ( );
230- new spell_grobbulus_poison_cloud ( );
183+ RegisterNaxxramasCreatureAI (boss_grobbulus );
184+ RegisterNaxxramasCreatureAI (npc_grobbulus_poison_cloud );
185+ RegisterSpellScript (spell_grobbulus_mutating_injection );
186+ RegisterSpellScript (spell_grobbulus_poison_cloud );
231187}