void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { if (pSpell->Id == SPELL_SUBMERGE) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // Refresh spheres only on normal difficulty if (m_pInstance && !m_pInstance->IsHeroicDifficulty()) DoRefreshSpheres(); DoCastSpellIfCan(m_creature, SPELL_CLEAR_ALL_DEBUFFS, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SUMMON_SPIKES, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SUMMON_SCARAB, CAST_TRIGGERED); } }
void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) override { if (pSpell->Id == SPELL_SUBMERGE) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // Extra check here, because AnubArak must be submerged by default if (m_Phase != PHASE_SUBMERGING) return; m_Phase = PHASE_UNDERGROUND; // Refresh spheres only on normal difficulty if (m_pInstance && !m_pInstance->IsHeroicDifficulty()) DoRefreshSpheres(); DoCastSpellIfCan(m_creature, SPELL_CLEAR_ALL_DEBUFFS, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SUMMON_SPIKES, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SUMMON_SCARAB, CAST_TRIGGERED); } }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; switch (m_Phase) { case PHASE_GROUND: // Switch to underground phase on timer if (m_PhaseSwitchTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_SUBMERGE) == CAST_OK) { DoScriptText(SAY_SUBMERGE, m_creature); DoScriptText(EMOTE_BURROW, m_creature); m_PhaseSwitchTimer = 65000; m_Phase = PHASE_UNDERGROUND; return; } } else m_PhaseSwitchTimer -= uiDiff; // Switch to phase 3 when below 30% if (m_creature->GetHealthPercent() <= 30.0f) { if (DoCastSpellIfCan(m_creature, SPELL_LEECHING_SWARM) == CAST_OK) { DoScriptText(SAY_LEECHING_SWARM, m_creature); DoScriptText(EMOTE_LEECHING_SWARM, m_creature); m_Phase = PHASE_LEECHING_SWARM; } } // No break - the spells are used in both phase 1 and 3 case PHASE_LEECHING_SWARM: if (m_uiFreezingSlashTimer < uiDiff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FREEZING_SLASH) == CAST_OK) m_uiFreezingSlashTimer = 20000; } else m_uiFreezingSlashTimer -= uiDiff; if (m_uiPenetratingColdTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_PENETRATING_COLD) == CAST_OK) m_uiPenetratingColdTimer = 15000; } else m_uiPenetratingColdTimer -= uiDiff; // The Borrowers are summoned in Ground phase only on normal mode or during Ground and Swarm phase on heroic mode if (m_Phase == PHASE_GROUND || (m_pInstance && m_pInstance->IsHeroicDifficulty())) { if (m_uiBurrowerSummonTimer < uiDiff) { // The number of targets is handled in core, based on difficulty if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_NERUBIAN_BURROWER) == CAST_OK) m_uiBurrowerSummonTimer = 45000; } else m_uiBurrowerSummonTimer -= uiDiff; } DoMeleeAttackIfReady(); break; case PHASE_UNDERGROUND: // Underground phase is finished if (m_PhaseSwitchTimer < uiDiff) { DoCastSpellIfCan(m_creature, SPELL_EMERGE, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_TELEPORT_TO_SPIKE, CAST_TRIGGERED); DoScriptText(EMOTE_EMERGE, m_creature); DoDespawnPursuingSpikes(); m_creature->RemoveAurasDueToSpell(SPELL_SUBMERGE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // Refresh spheres only on normal difficulty if (m_pInstance && !m_pInstance->IsHeroicDifficulty()) DoRefreshSpheres(); m_PhaseSwitchTimer = 80000; m_Phase = PHASE_GROUND; } else m_PhaseSwitchTimer -= uiDiff; break; } if (m_uiBerserkTimer) { if (m_uiBerserkTimer <= uiDiff) { if (m_Phase != PHASE_UNDERGROUND) { if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK) { DoScriptText(SAY_BERSERK, m_creature); m_uiBerserkTimer = 0; } } } else m_uiBerserkTimer -= uiDiff; } }