void UpdateAI(uint32 diff) { // Some nice visuals dropSludgeTimer += diff; if (!me->IsInCombat() && dropSludgeTimer >= 5000) { if (me->IsWithinDist3d(3178, -3305, 319, 5.0f) && !summons.HasEntry(NPC_SEWAGE_SLIME)) me->CastSpell(3128.96f+irand(-20, 20), -3312.96f+irand(-20, 20), 293.25f, SPELL_BOMBARD_SLIME, false); dropSludgeTimer = 0; } if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; switch (events.GetEvent()) { case EVENT_SPELL_POISON_CLOUD: me->CastSpell(me, SPELL_POISON_CLOUD, true); events.RepeatEvent(15000); break; case EVENT_SPELL_BERSERK: me->CastSpell(me, SPELL_BERSERK, true); events.PopEvent(); break; case EVENT_SPELL_SLIME_SPRAY: me->MonsterTextEmote("Grobbulus sprays slime across the room!", 0, true); me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25), false); events.RepeatEvent(20000); break; case EVENT_SPELL_MUTATING_INJECTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_MUTATING_INJECTION)) me->CastSpell(target, SPELL_MUTATING_INJECTION, false); events.RepeatEvent(8000 + uint32(120 * me->GetHealthPct())); break; } DoMeleeAttackIfReady(); }