1. /* ScriptData
  2. SDName: boss_shazzrah
  3. SD%Complete: 100
  4. SDComment:
  5. SDCategory: Molten Core
  6. EndScriptData */
  7. #include "ScriptPCH.h"
  8. #include "molten_core.h"
  9. enum
  10. {
  11. SPELL_ARCANE_EXPLOSION = SADPANDA,
  12. SPELL_SHAZZRAH_CURSE = SADPANDA,
  13. SPELL_MAGIC_GROUNDING = SADPANDA,
  14. SPELL_COUNTERSPELL = SADPANDA,
  15. SPELL_GATE_OF_SHAZZRAH = SADPANDA
  16. };
  17. struct boss_shazzrahAI : public ScriptedAI
  18. {
  19. boss_shazzrahAI(Creature* pCreature) : ScriptedAI(pCreature)
  20. {
  21. m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
  22. Reset();
  23. }
  24. ScriptedInstance* m_pInstance;
  25. uint32 m_uiArcaneExplosionTimer;
  26. uint32 m_uiShazzrahCurseTimer;
  27. uint32 m_uiMagicGroundingTimer;
  28. uint32 m_uiCounterspellTimer;
  29. uint32 m_uiBlinkTimer;
  30. void Reset()
  31. {
  32. m_uiArcaneExplosionTimer = SADPANDA;
  33. m_uiShazzrahCurseTimer = SADPANDA;
  34. m_uiMagicGroundingTimer = SADPANDA;
  35. m_uiCounterspellTimer = SADPANDA;
  36. m_uiBlinkTimer = SADPANDA;
  37. }
  38. void UpdateAI(const uint32 uiDiff)
  39. {
  40. if (!DoSelectVictim())
  41. return;
  42. // Arcane Explosion Timer
  43. if (m_uiArcaneExplosionTimer < uiDiff)
  44. {
  45. if (m_uiBlinkTimer >= SADPANDA)
  46. {
  47. if (DoCastSpellIfCan(m_creature, SPELL_ARCANE_EXPLOSION) == CAST_OK)
  48. m_uiArcaneExplosionTimer = SADPANDA;
  49. }
  50. }
  51. else
  52. m_uiArcaneExplosionTimer -= uiDiff;
  53. // Shazzrah Curse Timer
  54. if (m_uiShazzrahCurseTimer < uiDiff)
  55. {
  56. if (DoCastSpellIfCan(m_creature, SPELL_SHAZZRAH_CURSE) == CAST_OK)
  57. m_uiShazzrahCurseTimer = SADPANDA;
  58. }
  59. else
  60. m_uiShazzrahCurseTimer -= uiDiff;
  61. // Magic Grounding Timer
  62. if (m_uiMagicGroundingTimer < uiDiff)
  63. {
  64. if (DoCastSpellIfCan(m_creature, SPELL_MAGIC_GROUNDING) == CAST_OK)
  65. m_uiMagicGroundingTimer = SADPANDA;
  66. }
  67. else
  68. m_uiMagicGroundingTimer -= uiDiff;
  69. // Counterspell Timer
  70. if (m_uiCounterspellTimer < uiDiff)
  71. {
  72. if (DoCastSpellIfCan(m_creature, SPELL_COUNTERSPELL) == CAST_OK)
  73. m_uiCounterspellTimer = SADPANDA;
  74. }
  75. else
  76. m_uiCounterspellTimer -= uiDiff;
  77. // Blink Timer
  78. if (m_uiBlinkTimer < uiDiff)
  79. {
  80. // Teleporting him to a random gamer and casting Arcane Explosion after that.
  81. if (DoCastSpellIfCan(m_creature, SPELL_GATE_OF_SHAZZRAH) == CAST_OK)
  82. {
  83. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  84. m_creature->NearTeleportTo(pTarget->GetPosition());
  85. DoResetThreat();
  86. m_creature->CastSpell(m_creature, SPELL_ARCANE_EXPLOSION, true);
  87. m_uiBlinkTimer = SADPANDA;
  88. m_uiArcaneExplosionTimer = SADPANDA;
  89. }
  90. }
  91. else
  92. m_uiBlinkTimer -= uiDiff;
  93. DoMeleeAttackIfReady();
  94. }
  95. };
  96. CreatureAI* GetAI_boss_shazzrah(Creature* pCreature)
  97. {
  98. return new boss_shazzrahAI(pCreature);
  99. }