void UpdateAI(const uint32 diff) { if (!me->isInCombat()) { if (RandChat_Timer <= diff) { DoScriptText(RandomTaunt[rand()%6].id, me); RandChat_Timer = 90000; } else RandChat_Timer -= diff; } if (!UpdateVictim()) return; if (NeedCheckCube) NeedCheckCubeStatus(); if (Berserk_Timer <= diff) { DoCast(me, SPELL_BERSERK, true); DoScriptText(EMOTE_BERSERK, me); Berserk_Timer = 60000; } else Berserk_Timer -= diff; if (Cleave_Timer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); Cleave_Timer = 10000; } else Cleave_Timer -= diff; if (BlastNova_Timer <= diff) { // to avoid earthquake interruption if (!me->HasUnitState(UNIT_STAT_STUNNED)) { DoScriptText(EMOTE_BLASTNOVA, me); DoCast(me, SPELL_BLASTNOVA); BlastNova_Timer = 60000; } } else BlastNova_Timer -= diff; if (Quake_Timer <= diff) { // to avoid blastnova interruption if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me, SPELL_QUAKE_TRIGGER, true); Quake_Timer = 50000; } } else Quake_Timer -= diff; if (Blaze_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { float x, y, z; target->GetPosition(x, y, z); Creature* summon = me->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (summon) { CAST_AI(mob_abyssal::mob_abyssalAI, summon->AI())->SetTrigger(2); DoCast(summon, SPELL_BLAZE_TARGET, true); summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } Blaze_Timer = 20000 + rand()%20000; } else Blaze_Timer -= diff; if (!Phase3 && HealthBelowPct(30) && !me->IsNonMeleeSpellCasted(false) // blast nova && !me->HasUnitState(UNIT_STAT_STUNNED)) // shadow cage and earthquake { Phase3 = true; DoScriptText(SAY_CHAMBER_DESTROY, me); DoCast(me, SPELL_CAMERA_SHAKE, true); DoCast(me, SPELL_DEBRIS_KNOCKDOWN, true); if (pInstance) pInstance->SetData(DATA_COLLAPSE, true); } if (Phase3) { if (Debris_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { float x, y, z; target->GetPosition(x, y, z); Creature* summon = me->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (summon) CAST_AI(mob_abyssal::mob_abyssalAI, summon->AI())->SetTrigger(1); } Debris_Timer = 10000; } else Debris_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { if (!m_bIsIntroDone) { IntroDone(); return; } if (m_uiRandChat_Timer < uiDiff) { DoScriptText(RandomTaunt[rand()%6].id, m_creature); m_uiRandChat_Timer = 90000; } else m_uiRandChat_Timer -= uiDiff; return; } if (m_bNeedCheckCube) NeedCheckCubeStatus(); if (m_uiBerserk_Timer < uiDiff) { DoScriptText(EMOTE_BERSERK, m_creature); m_creature->CastSpell(m_creature, SPELL_BERSERK, true); m_uiBerserk_Timer = 60000; } else m_uiBerserk_Timer -= uiDiff; //Cleave_Timer if (m_uiCleave_Timer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); m_uiCleave_Timer = 10000; } else m_uiCleave_Timer -= uiDiff; if (m_uiQuake_Timer < uiDiff) { // to avoid blastnova interruption if (!m_creature->IsNonMeleeSpellCasted(false)) { int32 i = SPELL_QUAKE_KNOCKBACK; m_creature->CastCustomSpell(m_creature, SPELL_QUAKE_TRIGGER, &i, 0, 0, false); m_uiQuake_Timer = 50000; } } else m_uiQuake_Timer -= uiDiff; if (m_uiBlastNova_Timer < uiDiff) { // to avoid earthquake interruption if (!m_creature->hasUnitState(UNIT_STAT_STUNNED)) { DoScriptText(EMOTE_BLASTNOVA, m_creature); DoCastSpellIfCan(m_creature, SPELL_BLASTNOVA); m_uiBlastNova_Timer = 60000; } } else m_uiBlastNova_Timer -= uiDiff; if (m_uiBlaze_Timer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { float x, y, z; pTarget->GetPosition(x, y, z); Creature *summon = m_creature->SummonCreature(NPC_BURNING_ABYSS, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (summon) { ((mob_abyssalAI*)summon->AI())->SetTrigger(2); m_creature->CastSpell(summon, SPELL_BLAZE_TARGET, true); summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } m_uiBlaze_Timer = urand(20000, 40000); } else m_uiBlaze_Timer -= uiDiff; if (!m_bIsPhase3 && m_creature->GetHealthPercent() < 30.0f && !m_creature->IsNonMeleeSpellCasted(false) // blast nova && !m_creature->hasUnitState(UNIT_STAT_STUNNED))// shadow cage and earthquake { m_bIsPhase3 = true; DoScriptText(SAY_CHAMBER_DESTROY, m_creature); } if (m_bIsPhase3) { if (m_uiPhase3_Timer < uiDiff) { switch (m_uiPhase3_Count) { case 0: m_creature->CastSpell(m_creature, SPELL_CAMERA_SHAKE, true); ++m_uiPhase3_Count; m_uiPhase3_Timer = 2000; break; case 1: if (m_pInstance) m_pInstance->SetData(TYPE_HALL_COLLAPSE, IN_PROGRESS); ++m_uiPhase3_Count; m_uiPhase3_Timer = 8000; break; case 2: m_creature->CastSpell(m_creature, SPELL_DEBRIS_KNOCKDOWN, true); ++m_uiPhase3_Count; m_uiPhase3_Timer = 15000; break; case 3: if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { float x, y, z; pTarget->GetPosition(x, y, z); Creature *summon = m_creature->SummonCreature(NPC_BURNING_ABYSS, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (summon) ((mob_abyssalAI*)summon->AI())->SetTrigger(1); m_uiPhase3_Timer = 15000; } break; } } else m_uiPhase3_Timer -= uiDiff; } DoMeleeAttackIfReady(); }