void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; DismountPlayers(); DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if(!started && !waiting_teleport && PlayerInRange(30.0f) && pInstance->GetData(DATA_VAROS_EVENT) == DONE) { phase++; just_summoned = false; summoning_casted = false; ui_SummonSimulation_Timer = 4000; waiting_teleport = true; if(phase == 4) started=true; } switch(phase) { case 0: return; case 1: if(!summoning_casted) { DoScriptText(SAY_SUMMON_1,me); DoCast(SPELL_SUMMON_MENAGERIE_1); summoning_casted = true; } if (!just_summoned && ui_SummonSimulation_Timer <= uiDiff) { temp_summ = DoSummon(NPC_PHANTASMAL_WATER, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_AIR, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_FIRE, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_FIRE, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); just_summoned = true; ui_SummonSimulation_Timer = 4000; me->GetMotionMaster()->Clear(false); DoResetThreat(); me->CombatStop(true); me->NearTeleportTo(BossLocSpawn[0].x, BossLocSpawn[0].y, BossLocSpawn[0].z, BossLocSpawn[0].o); waiting_teleport = false; }else ui_SummonSimulation_Timer -= uiDiff; break; case 2: if(!summoning_casted) { DoScriptText(SAY_SUMMON_2,me); DoCast(SPELL_SUMMON_MENAGERIE_2); summoning_casted = true; } if (!just_summoned && ui_SummonSimulation_Timer <= uiDiff) { temp_summ = DoSummon(NPC_PHANTASMAL_NAGA, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_MURLOC, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_OGRE, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_OGRE, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); just_summoned = true; ui_SummonSimulation_Timer = 4000; me->GetMotionMaster()->Clear(false); DoResetThreat(); me->CombatStop(true); me->NearTeleportTo(BossLocSpawn[1].x, BossLocSpawn[1].y, BossLocSpawn[1].z, BossLocSpawn[1].o); waiting_teleport = false; }else ui_SummonSimulation_Timer -= uiDiff; break; case 3: if(!summoning_casted) { DoScriptText(SAY_SUMMON_3,me); DoCast(SPELL_SUMMON_MENAGERIE_3); summoning_casted = true; } if (!just_summoned && ui_SummonSimulation_Timer <= uiDiff) { temp_summ = DoSummon(NPC_PHANTASMAL_MAMMOTH, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_WOLVE, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_WOLVE, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_CLUODSCRAPER, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); temp_summ = DoSummon(NPC_PHANTASMAL_CLUODSCRAPER, me, (rand()%RANGE)+1, 30000, TEMPSUMMON_DEAD_DESPAWN); if(temp_summ) if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) temp_summ->Attack(pTarget,true); just_summoned = true; ui_SummonSimulation_Timer = 4000; me->GetMotionMaster()->Clear(false); DoResetThreat(); me->CombatStop(true); me->NearTeleportTo(BossLocSpawn[2].x, BossLocSpawn[2].y, BossLocSpawn[2].z, BossLocSpawn[2].o); waiting_teleport = false; }else ui_SummonSimulation_Timer -= uiDiff; break; case 4: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_AGGRESSIVE); me->RemoveAllAuras(); //Return since we have no target if (!UpdateVictim()) return; if(casting_explosion && !done_casting_explosion) { me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); me->NearTeleportTo(BossLocSpawn[3].x, BossLocSpawn[3].y, BossLocSpawn[3].z, BossLocSpawn[3].o); DoScriptText(RAND(SAY_EXPLOSION_1,SAY_EXPLOSION_2), me); DoCast(SPELL_EMPOWERED_ARCANE_EXPLOSION); done_casting_explosion = true; } if(casting_explosion && ui_ArcaneExplosionDuration <= uiDiff){ Unit* victim = me->getVictim(); if(victim) me->NearTeleportTo(victim->GetPositionX()+4,victim->GetPositionY(),victim->GetPositionZ(),0); me->SetUnitMovementFlags(MOVEMENTFLAG_NONE); casting_explosion = false; } else if (casting_explosion) ui_ArcaneExplosionDuration -= uiDiff; if(ui_FrostBomb_Timer <= uiDiff) { DoCast(me->getVictim(),SPELL_FROSTBOMB); ui_FrostBomb_Timer = 60000; } else ui_FrostBomb_Timer -= uiDiff; if(ui_TimeBomb_Timer <= uiDiff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { DoCast(pTarget, SPELL_TIME_BOMB); ui_TimeBomb_Timer = 15000; } } else ui_TimeBomb_Timer -= uiDiff; if(ui_ArcaneExplosion_Timer <= uiDiff) { casting_explosion = true; done_casting_explosion = false; ui_ArcaneExplosion_Timer = 50000; ui_ArcaneExplosionDuration=DUNGEON_MODE(9000,7000); //DoCast(SPELL_TELEPORT); //NO WORK! } else ui_ArcaneExplosion_Timer -= uiDiff; DoMeleeAttackIfReady(); DismountPlayers(); break; } }