- /* ScriptData
- SDName: boss_shazzrah
- SD%Complete: 100
- SDComment:
- SDCategory: Molten Core
- EndScriptData */
- #include "ScriptPCH.h"
- #include "molten_core.h"
- enum
- {
- SPELL_ARCANE_EXPLOSION = SADPANDA,
- SPELL_SHAZZRAH_CURSE = SADPANDA,
- SPELL_MAGIC_GROUNDING = SADPANDA,
- SPELL_COUNTERSPELL = SADPANDA,
- SPELL_GATE_OF_SHAZZRAH = SADPANDA
- };
- struct boss_shazzrahAI : public ScriptedAI
- {
- boss_shazzrahAI(Creature* pCreature) : ScriptedAI(pCreature)
- {
- m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
- Reset();
- }
- ScriptedInstance* m_pInstance;
- uint32 m_uiArcaneExplosionTimer;
- uint32 m_uiShazzrahCurseTimer;
- uint32 m_uiMagicGroundingTimer;
- uint32 m_uiCounterspellTimer;
- uint32 m_uiBlinkTimer;
- void Reset()
- {
- m_uiArcaneExplosionTimer = SADPANDA;
- m_uiShazzrahCurseTimer = SADPANDA;
- m_uiMagicGroundingTimer = SADPANDA;
- m_uiCounterspellTimer = SADPANDA;
- m_uiBlinkTimer = SADPANDA;
- }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!DoSelectVictim())
- return;
- // Arcane Explosion Timer
- if (m_uiArcaneExplosionTimer < uiDiff)
- {
- if (m_uiBlinkTimer >= SADPANDA)
- {
- if (DoCastSpellIfCan(m_creature, SPELL_ARCANE_EXPLOSION) == CAST_OK)
- m_uiArcaneExplosionTimer = SADPANDA;
- }
- }
- else
- m_uiArcaneExplosionTimer -= uiDiff;
- // Shazzrah Curse Timer
- if (m_uiShazzrahCurseTimer < uiDiff)
- {
- if (DoCastSpellIfCan(m_creature, SPELL_SHAZZRAH_CURSE) == CAST_OK)
- m_uiShazzrahCurseTimer = SADPANDA;
- }
- else
- m_uiShazzrahCurseTimer -= uiDiff;
- // Magic Grounding Timer
- if (m_uiMagicGroundingTimer < uiDiff)
- {
- if (DoCastSpellIfCan(m_creature, SPELL_MAGIC_GROUNDING) == CAST_OK)
- m_uiMagicGroundingTimer = SADPANDA;
- }
- else
- m_uiMagicGroundingTimer -= uiDiff;
- // Counterspell Timer
- if (m_uiCounterspellTimer < uiDiff)
- {
- if (DoCastSpellIfCan(m_creature, SPELL_COUNTERSPELL) == CAST_OK)
- m_uiCounterspellTimer = SADPANDA;
- }
- else
- m_uiCounterspellTimer -= uiDiff;
- // Blink Timer
- if (m_uiBlinkTimer < uiDiff)
- {
- // Teleporting him to a random gamer and casting Arcane Explosion after that.
- if (DoCastSpellIfCan(m_creature, SPELL_GATE_OF_SHAZZRAH) == CAST_OK)
- {
- if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
- m_creature->NearTeleportTo(pTarget->GetPosition());
- DoResetThreat();
- m_creature->CastSpell(m_creature, SPELL_ARCANE_EXPLOSION, true);
- m_uiBlinkTimer = SADPANDA;
- m_uiArcaneExplosionTimer = SADPANDA;
- }
- }
- else
- m_uiBlinkTimer -= uiDiff;
- DoMeleeAttackIfReady();
- }
- };
- CreatureAI* GetAI_boss_shazzrah(Creature* pCreature)
- {
- return new boss_shazzrahAI(pCreature);
- }