void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInArea(diff, 5767)) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CHECK_PLAYERS: { Map::PlayerList const &PlayerList = instance->instance->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (Player* pPlayer = i->getSource()) if (pPlayer->GetPositionZ() > 70.0f) pPlayer->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); } } events.ScheduleEvent(EVENT_CHECK_PLAYERS, 5000); break; } case EVENT_BERSERK: Talk(SAY_BERSERK); DoCast(me, SPELL_BERSERK); break; case EVENT_BLAZE_OF_GLORY: DoCast(me, SPELL_INCENDIARY_SOUL, true); DoCastVictim(SPELL_BLAZE_OF_GLORY); events.ScheduleEvent(EVENT_BLAZE_OF_GLORY, 9000); break; case EVENT_INFERNO_BLADE: Talk(SAY_INFERNO); DoCast(me, SPELL_INFERNO_BLADE); events.ScheduleEvent(EVENT_DECIMATION_BLADE, 30000); events.RescheduleEvent(EVENT_BLAZE_OF_GLORY, urand(7000, 9000)); break; case EVENT_DECIMATION_BLADE: Talk(SAY_DECIMATION); DoCast(me, SPELL_DECIMATION_BLADE); events.ScheduleEvent(EVENT_INFERNO_BLADE, 30000); events.RescheduleEvent(EVENT_BLAZE_OF_GLORY, urand(7000, 9000)); break; case EVENT_SHARDS_OF_TORMENT: Talk(SAY_SHARDS); me->CastCustomSpell(SPELL_SHARDS_OF_TORMENT_AOE, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 1, 2), me); events.ScheduleEvent(EVENT_SHARDS_OF_TORMENT, 34000); break; case EVENT_FINAL_COUNTDOWN: DoCastAOE(SPELL_FINAL_COUNTDOWN); events.ScheduleEvent(EVENT_FINAL_COUNTDOWN, 45000); break; } } if (me->HasAura(SPELL_INFERNO_BLADE)) { if (!me->HasUnitState(UNIT_STATE_CASTING) && me->isAttackReady() && me->IsWithinMeleeRange(me->getVictim())) { DoCastVictim(SPELL_INFERNO_BLADE_DMG, true); me->resetAttackTimer(); } } else if (me->HasAura(SPELL_DECIMATION_BLADE) || me->HasAura(SPELL_DECIMATION_BLADE_25)) { if (!me->HasUnitState(UNIT_STATE_CASTING) && me->isAttackReady() && me->IsWithinMeleeRange(me->getVictim())) { DoCastVictim(SPELL_DECIMATION_BLADE_DMG, true); me->resetAttackTimer(); } } else DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; if (Phase == 1 && HealthBelowPct(20)) { Phase = 2; DoScriptText(SAY_PHASE_2, me); } if (HealthBelowPct(2)) { me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667f, -295.101166f, 417.321381f, 0, 0, 0, 0, 0, 0); // All of them. or random? DoScriptText(SAY_DEATH_1, me); DoScriptText(SAY_DEATH_2, me); DoScriptText(SAY_DEATH_3, me); DoScriptText(SAY_DEATH_4, me); DoScriptText(SAY_DEATH_5, me); me->DisappearAndDie(); if (instance) instance->SetData(BOSS_ALGALON, DONE); return; } if (Phase == 1) { if (!Summon) { if (uiPhase_timer <= diff) { switch (uiStep) { case 1: DoScriptText(SAY_SUMMON_1, me); JumpToNextStep(3000); break; case 2: DoScriptText(SAY_SUMMON_2, me); JumpToNextStep(3000); break; case 3: DoScriptText(SAY_SUMMON_3, me); JumpToNextStep(3000); break; case 4: DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me); JumpToNextStep(3000); break; case 5: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_AGGRESSIVE); Summon = true; break; } } else uiPhase_timer -= diff; return; } if (QuantumStrike_Timer <= diff) { DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE, H_SPELL_QUANTUM_STRIKE), true); QuantumStrike_Timer = urand(4000, 14000); } else QuantumStrike_Timer -= diff; if (BigBang_Timer <= diff) { DoScriptText(RAND(SAY_BIG_BANG_1, SAY_BIG_BANG_2), me); DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG, H_SPELL_BIG_BANG), true); BigBang_Timer = 90000; } else BigBang_Timer -= diff; if (Ascend_Timer <= diff) { DoCast(me->getVictim(), SPELL_ASCEND, true); Ascend_Timer = 480000; } else Ascend_Timer -= diff; if (PhasePunch_Timer <= diff) { DoCast(me->getVictim(), SPELL_PHASE_PUNCH, true); PhasePunch_Timer = 8000; } else PhasePunch_Timer -= diff; if (CosmicSmash_Timer <= diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH, H_SPELL_COSMIC_SMASH), true); CosmicSmash_Timer = urand(30000, 60000); } else CosmicSmash_Timer -= diff; if (Berserk_Timer <= diff) { DoScriptText(SAY_BERSERK, me); DoCast(me->getVictim(), SPELL_BERSERK, true); Berserk_Timer = 360000; } else Berserk_Timer -= diff; DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(diff); } if (Phase == 2) { if (Enrage) { if (Ascend_Timer <= diff) { DoCast(me, SPELL_ASCEND); DoScriptText(SAY_BERSERK, me); Ascend_Timer = urand(360000, 365000); Enrage = false; } else Ascend_Timer -= diff; } } DoMeleeAttackIfReady(); }
mob_lightning_elementalAI(Creature *c) : ScriptedAI(c) { me->SetInCombatWithZone(); me->AddAura( RAID_MODE(SPELL_LIGHTNING_ELEMENTAL_PASSIVE, SPELL_LIGHTNING_ELEMENTAL_PASSIVE_H), me); }
void UpdateAI(const uint32 diff) { if(!UpdateVictimWithGaze() || !CheckInRoom()) return; if(me->GetDistance(me->GetHomePosition()) > 80.0f) { EnterEvadeMode(); return; } events.Update(diff); while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_WOUND: DoCast(me->getVictim(), SPELL_MORTAL_WOUND); events.ScheduleEvent(EVENT_WOUND, 10000); break; case EVENT_ENRAGE: DoCast(me, SPELL_ENRAGE); events.ScheduleEvent(EVENT_ENRAGE, 15000); break; case EVENT_DECIMATE: DoCastAOE(SPELL_DECIMATE); events.ScheduleEvent(EVENT_DECIMATE, RAID_MODE(120000,90000)); for(std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) { Creature* minion = Unit::GetCreature(*me, *itr); if(minion && minion->isAlive()) { int32 damage = int32(minion->GetHealth()) - int32(minion->CountPctFromMaxHealth(5)); if(damage > 0) me->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, minion, true); AttackGluth(minion); } } break; case EVENT_BERSERK: if(!me->HasAura(SPELL_BERSERK)) DoCast(me, SPELL_BERSERK); events.ScheduleEvent(EVENT_BERSERK, 1*60000); break; case EVENT_SUMMON: for(int32 i = 0; i < RAID_MODE(1, 2); ++i) DoSummon(MOB_ZOMBIE, PosSummon[rand() % RAID_MODE(1,3)]); events.ScheduleEvent(EVENT_SUMMON, 10000); break; } } if(me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE) { if(me->IsWithinMeleeRange(me->getVictim())) { me->Kill(me->getVictim()); me->ModifyHealth(int32(me->CountPctFromMaxHealth(5))); } } else DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->hasUnitState(UNIT_STAT_CASTING)) return; if (events.GetTimer() > 15000 && !IsInRange()) DoCastAOE(SPELL_PETRIFY_BREATH, true); if (!left && !right) DoCast(me, SPELL_STONE_SHOUT, true); switch(events.GetEvent()) { case EVENT_NONE: break; case EVENT_SMASH: if (left && right) if (me->IsWithinMeleeRange(me->getVictim())) DoCastVictim(SPELL_TWO_ARM_SMASH, true); else if(left || right) if (me->IsWithinMeleeRange(me->getVictim())) DoCastVictim(SPELL_ONE_ARM_SMASH, true); events.RescheduleEvent(EVENT_SMASH, 15000); break; case EVENT_SWEEP: if (left) DoCastAOE(SPELL_ARM_SWEEP, true); events.RescheduleEvent(EVENT_SWEEP, 15000); break; case EVENT_GRIP: if (right) { me->MonsterTextEmote(EMOTE_STONE, 0, true); DoScriptText(SAY_GRAB_PLAYER, me); for (uint32 n = 0; n < (uint32)RAID_MODE(1, 3); ++n) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) GripTargetGUID[n] = pTarget->GetGUID(); } if (pInstance) { if (Creature* RightArm = CAST_CRE(vehicle->GetPassenger(1))) if (RightArm->AI()) RightArm->AI()->DoAction(ACTION_GRIP); } } events.RescheduleEvent(EVENT_GRIP, 40000); break; case EVENT_SHOCKWAVE: if (left) { DoScriptText(SAY_SHOCKWAVE, me); DoCastAOE(SPELL_SHOCKWAVE, true); DoCastAOE(SPELL_SHOCKWAVE_VISUAL, true); } events.RescheduleEvent(EVENT_SHOCKWAVE, urand(15000, 25000)); break; case EVENT_EYEBEAM: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { if (EyeBeam[0] = me->SummonCreature(NPC_EYEBEAM_1, pTarget->GetPositionX(), pTarget->GetPositionY() + 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) { EyeBeam[0]->CastSpell(me, SPELL_EYEBEAM_VISUAL_1, true); EyeBeam[0]->AI()->AttackStart(pTarget); } if (EyeBeam[1] = me->SummonCreature(NPC_EYEBEAM_2, pTarget->GetPositionX(), pTarget->GetPositionY() - 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) { EyeBeam[1]->CastSpell(me, SPELL_EYEBEAM_VISUAL_2, true); EyeBeam[1]->AI()->AttackStart(pTarget); } } events.RescheduleEvent(EVENT_EYEBEAM, 20000); break; case EVENT_LEFT: if (Creature* LeftArm = me->SummonCreature(NPC_LEFT_ARM, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())) { LeftArm->EnterVehicle(vehicle, 0); DoCast(me, SPELL_ARM_RESPAWN, true); me->MonsterTextEmote(EMOTE_LEFT, 0, true); } events.CancelEvent(EVENT_LEFT); break; case EVENT_RIGHT: if (Creature* RightArm = me->SummonCreature(NPC_RIGHT_ARM, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())) { RightArm->EnterVehicle(vehicle, 1); DoCast(me, SPELL_ARM_RESPAWN, true); me->MonsterTextEmote(EMOTE_RIGHT, 0, true); } events.CancelEvent(EVENT_RIGHT); break; } DoMeleeAttackIfReady(); }
void UpdateAI(uint32 const diff) { if (!_phase) return; events.Update(diff); if ((_phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom()) return; if (_canTheHundredClub) { if (_checkFrostResistTimer <= diff) { CheckPlayersFrostResist(); _checkFrostResistTimer = 5 * IN_MILLISECONDS; } else _checkFrostResistTimer -= diff; } if (_phase == PHASE_GROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BERSERK: Talk(EMOTE_ENRAGE); DoCast(me, SPELL_BERSERK); return; case EVENT_CLEAVE: DoCastVictim(SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND); return; case EVENT_TAIL: DoCastAOE(SPELL_TAIL_SWEEP); events.ScheduleEvent(EVENT_TAIL, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND); return; case EVENT_DRAIN: DoCastAOE(SPELL_LIFE_DRAIN); events.ScheduleEvent(EVENT_DRAIN, 24 * IN_MILLISECONDS, 0, PHASE_GROUND); return; case EVENT_BLIZZARD: { //DoCastAOE(SPELL_SUMMON_BLIZZARD); if (Creature* summon = DoSummon(NPC_BLIZZARD, me, 0.0f, urand(25, 30) * IN_MILLISECONDS, TEMPSUMMON_TIMED_DESPAWN)) summon->GetMotionMaster()->MoveRandom(40); events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20, 7) * IN_MILLISECONDS, 0, PHASE_GROUND); break; } case EVENT_FLIGHT: if (HealthAbovePct(10)) { _phase = PHASE_FLIGHT; events.SetPhase(PHASE_FLIGHT); me->SetReactState(REACT_PASSIVE); me->AttackStop(); float x, y, z, o; me->GetHomePosition(x, y, z, o); me->GetMotionMaster()->MovePoint(1, x, y, z); return; } break; } } DoMeleeAttackIfReady(); } else { if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_LIFTOFF: Talk(EMOTE_AIR_PHASE); me->SetDisableGravity(true); me->SendMovementFlagUpdate(); events.ScheduleEvent(EVENT_ICEBOLT, 1500); _iceboltCount = RAID_MODE(2, 3); return; case EVENT_ICEBOLT: { std::vector<Unit*> targets; std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) targets.push_back((*i)->getTarget()); if (targets.empty()) _iceboltCount = 0; else { std::vector<Unit*>::const_iterator itr = targets.begin(); advance(itr, rand()%targets.size()); _iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); DoCast(*itr, SPELL_ICEBOLT); --_iceboltCount; } if (_iceboltCount) events.ScheduleEvent(EVENT_ICEBOLT, 1 * IN_MILLISECONDS); else events.ScheduleEvent(EVENT_BREATH, 1 * IN_MILLISECONDS); return; } case EVENT_BREATH: { Talk(EMOTE_BREATH); DoCastAOE(SPELL_FROST_MISSILE); events.ScheduleEvent(EVENT_EXPLOSION, 8 * IN_MILLISECONDS); return; } case EVENT_EXPLOSION: CastExplosion(); ClearIceBlock(); events.ScheduleEvent(EVENT_LAND, 3 * IN_MILLISECONDS); return; case EVENT_LAND: me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); Talk(EMOTE_GROUND_PHASE); me->SetDisableGravity(false); me->SendMovementFlagUpdate(); events.ScheduleEvent(EVENT_GROUND, 1500); return; case EVENT_GROUND: EnterPhaseGround(); return; case EVENT_BIRTH: me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_AGGRESSIVE); return; } } } }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; switch (m_uiStage) { case 0: if (m_uiFreezeSlashTimer <= uiDiff) { DoCastVictim(SPELL_FREEZE_SLASH); m_uiFreezeSlashTimer = 15*IN_MILLISECONDS; } else m_uiFreezeSlashTimer -= uiDiff; if (m_uiPenetratingColdTimer <= uiDiff) { me->CastCustomSpell(RAID_MODE(SPELL_PENETRATING_COLD_10_N, SPELL_PENETRATING_COLD_25_N, SPELL_PENETRATING_COLD_10_H, SPELL_PENETRATING_COLD_25_H) , SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5)); m_uiPenetratingColdTimer = 20*IN_MILLISECONDS; } else m_uiPenetratingColdTimer -= uiDiff; if (m_uiSummonNerubianTimer <= uiDiff && (IsHeroic() || !m_bReachedPhase3)) { me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4)); m_uiSummonNerubianTimer = 45*IN_MILLISECONDS; } else m_uiSummonNerubianTimer -= uiDiff; if (IsHeroic() && m_uiNerubianShadowStrikeTimer <= uiDiff) { Summons.DoAction(NPC_BURROWER, ACTION_SHADOW_STRIKE); m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; } else m_uiNerubianShadowStrikeTimer -= uiDiff; if (m_uiSubmergeTimer <= uiDiff && !m_bReachedPhase3 && !me->HasAura(SPELL_BERSERK)) { m_uiStage = 1; m_uiSubmergeTimer = 60*IN_MILLISECONDS; } else m_uiSubmergeTimer -= uiDiff; break; case 1: DoCast(me, SPELL_SUBMERGE_ANUBARAK); DoCast(me, SPELL_CLEAR_ALL_DEBUFFS); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoScriptText(SAY_BURROWER, me); m_uiScarabSummoned = 0; m_uiSummonScarabTimer = 4*IN_MILLISECONDS; m_uiStage = 2; break; case 2: if (m_uiPursuingSpikeTimer <= uiDiff) { DoCast(SPELL_SPIKE_CALL); // Just to make sure it won't happen again in this phase m_uiPursuingSpikeTimer = 90*IN_MILLISECONDS; } else m_uiPursuingSpikeTimer -= uiDiff; if (m_uiSummonScarabTimer <= uiDiff) { /* WORKAROUND * - The correct implementation is more likely the comment below but it needs spell knowledge */ std::list<uint64>::iterator i = m_vBurrowGUID.begin(); uint32 at = urand(0, m_vBurrowGUID.size()-1); for (uint32 k = 0; k < at; k++) ++i; if (Creature* pBurrow = Unit::GetCreature(*me, *i)) pBurrow->CastSpell(pBurrow, 66340, false); m_uiScarabSummoned++; m_uiSummonScarabTimer = 4*IN_MILLISECONDS; if (m_uiScarabSummoned == 4) m_uiSummonScarabTimer = RAID_MODE(4, 20)*IN_MILLISECONDS; /*It seems that this spell have something more that needs to be taken into account //Need more sniff info DoCast(SPELL_SUMMON_BEATLES); // Just to make sure it won't happen again in this phase m_uiSummonScarabTimer = 90*IN_MILLISECONDS;*/ } else m_uiSummonScarabTimer -= uiDiff; if (m_uiSubmergeTimer <= uiDiff) { m_uiStage = 3; m_uiSubmergeTimer = 80*IN_MILLISECONDS; } else m_uiSubmergeTimer -= uiDiff; break; case 3: m_uiStage = 0; DoCast(SPELL_SPIKE_TELE); if (Creature* pSpike = Unit::GetCreature(*me, m_uiSpikeGUID)) me->NearTeleportTo(pSpike->GetPositionX(), pSpike->GetPositionY(), pSpike->GetPositionZ(), pSpike->GetOrientation()); Summons.DespawnEntry(NPC_SPIKE); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_ANUBARAK); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_EMERGE_ANUBARAK); me->GetMotionMaster()->MoveChase(me->getVictim()); m_uiSummonNerubianTimer = 10*IN_MILLISECONDS; m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; m_uiSummonScarabTimer = 2*IN_MILLISECONDS; break; } if (!IsHeroic()) { if (m_uiSummonFrostSphereTimer <= uiDiff) { uint8 startAt = urand(0, 5); uint8 i = startAt; do { if (Unit* pSphere = Unit::GetCreature(*me, m_aSphereGUID[i])) { if (!pSphere->HasAura(SPELL_FROST_SPHERE)) { if (Creature* summon = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i])) m_aSphereGUID[i] = summon->GetGUID(); break; } } i = (i+1)%6; } while (i != startAt); m_uiSummonFrostSphereTimer = urand(20, 30)*IN_MILLISECONDS; } else m_uiSummonFrostSphereTimer -= uiDiff; } if (HealthBelowPct(30) && m_uiStage == 0 && !m_bReachedPhase3) { m_bReachedPhase3 = true; DoCastAOE(RAID_MODE(SPELL_LEECHING_SWARM_10_N, SPELL_LEECHING_SWARM_25_N, SPELL_LEECHING_SWARM_10_H, SPELL_LEECHING_SWARM_25_H)); DoScriptText(EMOTE_LEECHING_SWARM, me); DoScriptText(SAY_LEECHING_SWARM, me); } if (m_uiBerserkTimer <= uiDiff && !me->HasAura(SPELL_BERSERK)) { DoCast(me, SPELL_BERSERK); } else m_uiBerserkTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateCombatState()) return; events.Update(diff); if (Phase == 1) { while (uint32 eventId = events.GetEvent()) { switch(eventId) { case EVENT_WASTE: DoSummon(NPC_WASTE, Pos[RAND(0,3,6,9)]); events.RepeatEvent(urand(2000,5000)); break; case EVENT_ABOMIN: if (nAbomination < 8) { DoSummon(NPC_ABOMINATION, Pos[RAND(1,4,7,10)]); nAbomination++; events.RepeatEvent(20000); } else events.PopEvent(); break; case EVENT_WEAVER: if (nWeaver < 8) { DoSummon(NPC_WEAVER, Pos[RAND(0,3,6,9)]); nWeaver++; events.RepeatEvent(25000); } else events.PopEvent(); break; case EVENT_TRIGGER: if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) pKTTrigger->SetPhaseMask(2, true); events.PopEvent(); break; case EVENT_PHASE: events.Reset(); DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); spawns.DespawnAll(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); me->CastStop(); DoStartMovement(me->getVictim()); events.ScheduleEvent(EVENT_BOLT, urand(5000,10000)); events.ScheduleEvent(EVENT_NOVA, 15000); events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000)); Phase = 2; break; default: events.PopEvent(); break; } } } else { //start phase 3 when we are 45% health if (Phase != 3) { if (HealthBelowPct(45)) { Phase = 3 ; DoScriptText(SAY_REQUEST_AID, me); //here Lich King should respond to KelThuzad but I don't know which Creature to make talk //so for now just make Kelthuzad says it. DoScriptText(SAY_ANSWER_REQUEST, me); for (uint8 i = 0; i <= 3; ++i) { if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) { if (pPortal->getLootState() == GO_READY) pPortal->UseDoorOrButton(); } } } } else if (nGuardiansOfIcecrownCount < RAID_MODE(2,4)) { if (uiGuardiansOfIcecrownTimer <= diff) { // TODO : Add missing text if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2,5,8,11)])) pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); ++nGuardiansOfIcecrownCount; uiGuardiansOfIcecrownTimer = 5000; } else uiGuardiansOfIcecrownTimer -= diff; } if (me->hasUnitState(UNIT_STAT_CASTING)) return; if (uint32 eventId = events.GetEvent()) { switch(eventId) { case EVENT_BOLT: DoCastVictim(RAID_MODE(SPELL_FROST_BOLT,H_SPELL_FROST_BOLT)); events.RepeatEvent(urand(5000,10000)); break; case EVENT_NOVA: DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE,H_SPELL_FROST_BOLT_AOE)); events.RepeatEvent(urand(15000,30000)); break; case EVENT_CHAIN: { uint32 count = urand(1,3); for (uint8 i = 1; i <= count; i++) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); if (pTarget && !pTarget->isCharmed() && (chained.find(pTarget->GetGUID()) == chained.end())) { DoCast(pTarget, SPELL_CHAINS_OF_KELTHUZAD); float scale = pTarget->GetFloatValue(OBJECT_FIELD_SCALE_X); chained.insert(std::make_pair(pTarget->GetGUID(), scale)); pTarget->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm } } if (!chained.empty()) DoScriptText(RAND(SAY_CHAIN_1,SAY_CHAIN_2), me); events.RepeatEvent(urand(100000,180000)); break; } case EVENT_CHAINED_SPELL: { std::map<uint64, float>::iterator itr; for (itr = chained.begin(); itr != chained.end();) { if (Unit* player = Unit::GetPlayer((*itr).first)) { if (!player->isCharmed()) { player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); std::map<uint64, float>::iterator next = itr; ++next; chained.erase(itr); itr = next; continue; } if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) { switch(player->getClass()) { case CLASS_DRUID: if (urand(0,1)) player->CastSpell(pTarget, SPELL_MOONFIRE, false); else player->CastSpell(me, SPELL_LIFEBLOOM, false); break; case CLASS_HUNTER: player->CastSpell(pTarget, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); break; case CLASS_MAGE: player->CastSpell(pTarget, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); break; case CLASS_WARLOCK: player->CastSpell(pTarget, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); break; case CLASS_WARRIOR: player->CastSpell(pTarget, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); break; case CLASS_PALADIN: if (urand(0,1)) player->CastSpell(pTarget, SPELL_HAMMER_OF_JUSTICE, false); else player->CastSpell(me, SPELL_HOLY_SHOCK, false); break; case CLASS_PRIEST: if (urand(0,1)) player->CastSpell(pTarget, SPELL_VAMPIRIC_TOUCH, false); else player->CastSpell(me, SPELL_RENEW, false); break; case CLASS_SHAMAN: if (urand(0,1)) player->CastSpell(pTarget, SPELL_EARTH_SHOCK, false); else player->CastSpell(me, SPELL_HEALING_WAVE, false); break; case CLASS_ROGUE: player->CastSpell(pTarget, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); break; case CLASS_DEATH_KNIGHT: if (urand(0,1)) player->CastSpell(pTarget, SPELL_PLAGUE_STRIKE, true); else player->CastSpell(pTarget, SPELL_HOWLING_BLAST, true); break; } } } ++itr; } if (chained.empty()) events.PopEvent(); else events.RepeatEvent(5000); break; } case EVENT_DETONATE: { std::vector<Unit*> unitList; std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) { if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA && (*itr)->getTarget()->GetPower(POWER_MANA)) unitList.push_back((*itr)->getTarget()); } if (!unitList.empty()) { std::vector<Unit*>::const_iterator itr = unitList.begin(); advance(itr, rand()%unitList.size()); DoCast(*itr, SPELL_MANA_DETONATION); DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me); } events.RepeatEvent(urand(20000,50000)); break; } case EVENT_FISSURE: if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(pTarget, SPELL_SHADOW_FISURE); events.RepeatEvent(urand(10000,45000)); break; case EVENT_BLAST: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) DoCast(pTarget, SPELL_FROST_BLAST); if (rand()%2) DoScriptText(SAY_FROST_BLAST, me); events.RepeatEvent(urand(30000,90000)); break; default: events.PopEvent(); break; } } DoMeleeAttackIfReady(); } }
boss_sindragosaAI(Creature* pCreature) : BossAI(pCreature, DATA_SINDRAGOSA) { pInstance = me->GetInstanceScript(); count = RAID_MODE(2,5,2,5); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; if (!enraged && HealthBelowPct(30)) { enraged = true; events.ScheduleEvent(EVENT_FRENZY, 0); // will be cast immediately } events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_WRAP: // TODO : Add missing text for (uint8 i = 0; i < RAID_MODE(1, 2); ++i) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) { pTarget->RemoveAura( RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25)); uint8 pos = rand() % MAX_POS_WRAP; pTarget->GetMotionMaster()->MoveJump( PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20); if (Creature *wrap = DoSummon(MOB_WEB_WRAP, PosWrap[pos], 0, TEMPSUMMON_CORPSE_DESPAWN)) wrap->AI()->SetGUID(pTarget->GetGUID()); } } events.ScheduleEvent(EVENT_WRAP, 40000); break; case EVENT_SPRAY: DoCastAOE( RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25)); events.ScheduleEvent(EVENT_SPRAY, 40000); break; case EVENT_SHOCK: DoCastAOE( RAID_MODE(SPELL_POISON_SHOCK_10, SPELL_POISON_SHOCK_25)); events.ScheduleEvent(EVENT_SHOCK, urand(10000, 20000)); break; case EVENT_POISON: DoCast( me->getVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10, SPELL_NECROTIC_POISON_25)); events.ScheduleEvent(EVENT_POISON, urand(10000, 20000)); break; case EVENT_FRENZY: DoCast(me, RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25), true); events.ScheduleEvent(EVENT_FRENZY, 600000); break; case EVENT_SUMMON: // TODO : Add missing text uint8 amount = urand(8, 10); for (uint8 i = 0; i < amount; ++i) DoSummon(MOB_SPIDERLING, me, 0, TEMPSUMMON_CORPSE_DESPAWN); events.ScheduleEvent(EVENT_SUMMON, 40000); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FROZEN_ORB: { me->CastSpell(me, SPELL_FROZEN_ORB, CastSpellExtraArgs().AddSpellMod(SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 3))); events.Repeat(Seconds(32)); break; } case EVENT_WHITEOUT: DoCastSelf(SPELL_WHITEOUT); events.Repeat(Seconds(38)); break; case EVENT_FREEZING_GROUND: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_FREEZING_GROUND); events.Repeat(Seconds(38)); break; default: break; } if (me->HasUnitState(UNIT_STATE_CASTING)) return; } DoMeleeAttackIfReady(); }
void Reset() { DoCast(me, RAID_MODE(SPELL_FLAME_GROUND_10, SPELL_FLAME_GROUND_25)); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_JET: Talk(EMOTE_JETS); DoCast(me, SPELL_FLAME_JETS); events.ScheduleEvent(EVENT_JET, urand(35000, 40000)); break; case EVENT_SLAG_POT: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { Talk(SAY_SLAG_POT); _slagPotGUID = target->GetGUID(); DoCast(target, SPELL_GRAB); events.DelayEvents(3000); events.ScheduleEvent(EVENT_GRAB_POT, 500); } events.ScheduleEvent(EVENT_SLAG_POT, RAID_MODE(30000, 15000)); break; case EVENT_GRAB_POT: if (Unit* slagPotTarget = ObjectAccessor::GetUnit(*me, _slagPotGUID)) { slagPotTarget->EnterVehicle(me, 0); events.CancelEvent(EVENT_GRAB_POT); events.ScheduleEvent(EVENT_CHANGE_POT, 1000); } break; case EVENT_CHANGE_POT: if (Unit* slagPotTarget = ObjectAccessor::GetUnit(*me, _slagPotGUID)) { DoCast(slagPotTarget, SPELL_SLAG_POT, true); slagPotTarget->EnterVehicle(me, 1); events.CancelEvent(EVENT_CHANGE_POT); events.ScheduleEvent(EVENT_END_POT, 10000); } break; case EVENT_END_POT: if (Unit* slagPotTarget = ObjectAccessor::GetUnit(*me, _slagPotGUID)) { slagPotTarget->ExitVehicle(); slagPotTarget = NULL; _slagPotGUID.Clear(); events.CancelEvent(EVENT_END_POT); } break; case EVENT_SCORCH: Talk(SAY_SCORCH); if (Unit* target = me->GetVictim()) me->SummonCreature(NPC_GROUND_SCORCH, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 45000); DoCast(SPELL_SCORCH); events.ScheduleEvent(EVENT_SCORCH, 25000); break; case EVENT_CONSTRUCT: Talk(SAY_SUMMON); DoSummon(NPC_IRON_CONSTRUCT, ConstructSpawnPosition[urand(0, CONSTRUCT_SPAWN_POINTS - 1)], 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT); DoCast(SPELL_STRENGHT); DoCast(me, SPELL_ACTIVATE_CONSTRUCT); events.ScheduleEvent(EVENT_CONSTRUCT, RAID_MODE(40000, 30000)); break; case EVENT_BERSERK: DoCast(me, SPELL_BERSERK, true); Talk(SAY_BERSERK); break; } } DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(diff); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (enterHardMode) { SetPhaseOne(); enterHardMode = false; } // Handles spell casting. These spells only occur during phase 1 and hard mode if (phase == 1 || hardMode) { if (uiSearingLightTimer <= diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) { DoCast(pTarget, RAID_MODE(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25)); uiSearingLightTarget = pTarget->GetGUID(); } uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; if (hardMode) searing_light_active = true; uiSearingLightTimer = TIMER_SEARING_LIGHT; } else uiSearingLightTimer -= diff; if (uiGravityBombTimer <= diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) { DoCast(pTarget, RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); uiGravityBombTarget = pTarget->GetGUID(); } uiGravityBombTimer = TIMER_GRAVITY_BOMB; gravity_bomb_active = true; } else uiGravityBombTimer -= diff; if (uiTympanicTantrumTimer <= diff) { DoScriptText(SAY_TYMPANIC_TANTRUM, me); DoCast(SPELL_TYMPANIC_TANTRUM); uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); } else uiTympanicTantrumTimer -= diff; } if (!hardMode) { if (phase == 1) { if (HealthBelowPct(75) && heart_exposed == 0) { exposeHeart(); } else if (HealthBelowPct(50) && heart_exposed == 1) { exposeHeart(); } else if (HealthBelowPct(25) && heart_exposed == 2) { exposeHeart(); } DoMeleeAttackIfReady(); } else { //Stop moving me->StopMoving(); //Start summoning adds if (uiSpawnAddTimer <= diff) { DoScriptText(SAY_SUMMON, me); // Spawn Pummeller switch (rand() % 4) { case 0: me->SummonCreature(NPC_XM024_PUMMELLER, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 1: me->SummonCreature(NPC_XM024_PUMMELLER, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 2: me->SummonCreature(NPC_XM024_PUMMELLER, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 3: me->SummonCreature(NPC_XM024_PUMMELLER, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; } // Spawn 5 Bombs for (int8 n = 0; n < 5; n++) { //Some randomes are added so they wont spawn in a pile switch(rand() % 4) { case 0: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(LR_X - 3, LR_X + 3)), float(irand(LR_Y - 3, LR_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 1: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(LL_X - 3, LL_X + 3)), float(irand(LL_Y - 3, LL_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 2: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(UR_X - 3, UR_X + 3)), float(irand(UR_Y - 3, UR_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 3: me->SummonCreature(NPC_XS013_SCRAPBOT, float(irand(UL_X - 3, UL_X + 3)), float(irand(UL_Y - 3, UL_Y + 3)), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; } } //Spawn 5 Scrapbots switch (rand() % 4) { case 0: me->SummonCreature(NPC_XE321_BOOMBOT, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 1: me->SummonCreature(NPC_XE321_BOOMBOT, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 2: me->SummonCreature(NPC_XE321_BOOMBOT, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 3: me->SummonCreature(NPC_XE321_BOOMBOT, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; } uiSpawnAddTimer = TIMER_SPAWN_ADD; } else uiSpawnAddTimer -= diff; // Is the phase over? if (uiHeartPhaseTimer <= diff) { DoScriptText(SAY_HEART_CLOSED, me); SetPhaseOne(); } else uiHeartPhaseTimer -= diff; } } else { // Adding life sparks when searing light debuff runs out if hard mode if (searing_light_active) { if (uiSpawnLifeSparkTimer <= diff) { if (Unit *pSearingLightTarget = me->GetUnit(*me, uiSearingLightTarget)) pSearingLightTarget->SummonCreature(NPC_LIFE_SPARK, pSearingLightTarget->GetPositionX(), pSearingLightTarget->GetPositionY(), pSearingLightTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; searing_light_active = false; } else uiSpawnLifeSparkTimer -= diff; } DoMeleeAttackIfReady(); } if (gravity_bomb_active) { if (uiGravityBombAuraTimer <= diff) { if (Unit *pGravityBombTarget = me->GetUnit(*me, uiGravityBombTarget)) { pGravityBombTarget->RemoveAurasDueToSpell(RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); if (hardMode) { //Remains spawned for 3 minutes pGravityBombTarget->SummonCreature(NPC_VOID_ZONE, pGravityBombTarget->GetPositionX(), pGravityBombTarget->GetPositionY(), pGravityBombTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); } } gravity_bomb_active = false; uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; //gravityBomb(); } else uiGravityBombAuraTimer -= diff; } //Enrage stuff if (!enraged) { if (uiEnrageTimer <= diff) { DoScriptText(SAY_BERSERK, me); DoCast(me, SPELL_ENRAGE); enraged = true; } else uiEnrageTimer -= diff; } }
void UpdateAI(uint32 diff) { if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING) || !phase) return; if (m_uiPowerTimer <= diff) { instance->NormaliseAltPower(); } else m_uiPowerTimer -= diff; if (m_berserkTimer <= diff) { DoCast(me, SPELL_BERSERK); m_berserkTimer = 600000; } else m_berserkTimer -= diff; if (Creature* firelord = me->FindNearestCreature(NPC_FIRE_LORD, 5.0f, true)) // Flame Lord near. { DoCast(me, SPELL_ABSORB_FIRE); firelord->DespawnOrUnsummon(); } if (Creature* shadowlord = me->FindNearestCreature(NPC_SHADOW_LORD, 5.0f, true)) // Shadow Lord near. { DoCast(me, SPELL_ABSORB_SHADOW); shadowlord->DespawnOrUnsummon(); } if (me->HealthBelowPct(26) && !phaseTwo) // Switch phase. { EnterPhaseTwo(); phaseTwo = true; } if (me->HealthBelowPct(3) && IsHeroic()&& !movedMid) // Heroic move mid before platform breaks. { movedMid = true; events.CancelEvent(EVENT_FURY_OF_CHOGALL); events.CancelEvent(EVENT_DARK_CREATIONS); events.CancelEvent(EVENT_CORR_OLD_GOD); events.CancelEvent(EVENT_SUMMON_TENTACLES); me->GetMotionMaster()->MovePoint(1, -1162.254f, -798.731f, 835.844f); } events.Update(diff); if (phase == PHASE_ONE) // First phase { std::list<Unit*> targets; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CONVERSION: Talk(RAND(SAY_CONV_1, SAY_CONV_2, SAY_CONV_3)); SelectTargetList(targets, NonTankTargetSelector(me), RAID_MODE(1, 2, 2, 4), SELECT_TARGET_RANDOM); if (!targets.empty()) for (std::list<Unit*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) (*itr)->CastSpell(me, SPELL_WORSHIPPING, true); events.ScheduleEvent(EVENT_CONVERSION, urand(30000, 35000), PHASE_ONE); break; case EVENT_FLAME_ORDERS: DoCast(me, SPELL_FLAME_ORDERS); // just once. DoCast(me, SPELL_F_O_PERIODIC); // every 50 sec. break; case EVENT_SHADOW_ORDERS: DoCast(me, SPELL_SHADOW_ORDERS); // just once. DoCast(me, SPELL_S_O_PERIODIC); // every 50 sec. break; case EVENT_FURY_OF_CHOGALL: DoCastVictim(SPELL_FURY_OF_CHOGALL); events.ScheduleEvent(EVENT_FURY_OF_CHOGALL, urand(45000, 49000), PHASE_ONE); break; case EVENT_SUMMON_ADHERENT: Talk(SAY_ADHERENT); Talk(RAND(SAY_ADHER_1, SAY_ADHER_2, SAY_ADHER_3)); DoCast(me, SPELL_SUM_ADHER_SE); // Needs script. events.ScheduleEvent(EVENT_SUMMON_ADHERENT, 90000, PHASE_ONE); break; case EVENT_FESTER_BLOOD: DoCast(me, SPELL_FESTER_BLOOD); // Needs script. events.ScheduleEvent(EVENT_FESTER_BLOOD, 130000, PHASE_ONE); break; } } } else if (phase == PHASE_TWO) // Second phase { std::list<Unit*> targets; if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FURY_OF_CHOGALL: DoCastVictim(SPELL_FURY_OF_CHOGALL); events.ScheduleEvent(EVENT_FURY_OF_CHOGALL, urand(45000, 49000), PHASE_TWO); break; case EVENT_DARK_CREATIONS: Talk(RAND(SAY_DARKCR_1, SAY_DARKCR_2, SAY_DARKCR_3, SAY_DARKCR_4, SAY_DARKCR_5)); DoCast(me, SPELL_DARK_CREAT_VIS); for (int i = 0; i < 4; i++) me->SummonCreature(NPC_DARKENED_CREATION, TentacleLocations[i].GetPositionX(), TentacleLocations[i].GetPositionY(), TentacleLocations[i].GetPositionZ(), TEMPSUMMON_CORPSE_DESPAWN); events.ScheduleEvent(EVENT_DARK_CREATIONS, urand(28000, 34000), PHASE_TWO); break; case EVENT_CORR_OLD_GOD: // Needs script. if(Creature* trigger = me->FindNearestCreature(NPC_CHOGALL_COG_TRIGGER, 200.0f, true)) trigger->CastSpell(trigger, SPELL_CORR_OLD_GOD, true); break; case EVENT_SUMMON_TENTACLES: if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) me->SummonCreature(NPC_SPIKED_TENTACLE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN); events.ScheduleEvent(EVENT_SUMMON_TENTACLES, urand(30000, 35000), PHASE_TWO); break; } } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; EncounterTime += diff; ConstructTimer += diff; while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_JET: me->MonsterTextEmote(EMOTE_JETS, 0, true); DoCastAOE(SPELL_FLAME_JETS); events.RescheduleEvent(EVENT_JET,urand(35000,40000)); break; case EVENT_SLAG_POT: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { DoScriptText(SAY_SLAG_POT, me); SlagPotGUID = pTarget->GetGUID(); DoCast(pTarget, SPELL_GRAB); events.DelayEvents(3000); events.ScheduleEvent(EVENT_GRAB_POT, 500); } events.RescheduleEvent(EVENT_SLAG_POT,RAID_MODE(30000, 15000)); break; case EVENT_GRAB_POT: if (Unit* SlagPotTarget = Unit::GetUnit(*me, SlagPotGUID)) { SlagPotTarget->EnterVehicle(me, 0); events.CancelEvent(EVENT_GRAB_POT); events.ScheduleEvent(EVENT_CHANGE_POT, 1000); } break; case EVENT_CHANGE_POT: if (Unit* SlagPotTarget = Unit::GetUnit(*me, SlagPotGUID)) { SlagPotTarget->AddAura(SPELL_SLAG_POT, SlagPotTarget); SlagPotTarget->EnterVehicle(me, 1); events.CancelEvent(EVENT_CHANGE_POT); events.ScheduleEvent(EVENT_END_POT, 10000); } break; case EVENT_END_POT: if (Unit* SlagPotTarget = Unit::GetUnit(*me, SlagPotGUID)) { SlagPotTarget->ExitVehicle(); SlagPotTarget = NULL; SlagPotGUID = NULL; events.CancelEvent(EVENT_END_POT); } break; case EVENT_SCORCH: DoScriptText(RAND(SAY_SCORCH_1, SAY_SCORCH_2), me); if (Unit *pTarget = me->getVictim()) me->SummonCreature(NPC_GROUND_SCORCH, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 45000); DoCast(SPELL_SCORCH); events.RescheduleEvent(EVENT_SCORCH,25000); break; case EVENT_CONSTRUCT: DoScriptText(SAY_SUMMON, me); DoSummon(NPC_IRON_CONSTRUCT, Pos[rand()%20], 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT); DoCast(SPELL_STRENGHT); DoCast(me, SPELL_ACTIVATE_CONSTRUCT); events.RescheduleEvent(EVENT_CONSTRUCT,RAID_MODE(40000, 30000)); break; case EVENT_BERSERK: DoCast(me, SPELL_BERSERK, true); DoScriptText(SAY_BERSERK, me); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!phase) return; events.Update(diff); if ((phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom()) return; if (CanTheHundredClub) { if (CheckFrostResistTimer <= diff) { CheckPlayersFrostResist(); CheckFrostResistTimer = (rand() % 5 + 5) * 1000; } else CheckFrostResistTimer -= diff; } if (phase == PHASE_GROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_BERSERK: DoScriptText(EMOTE_ENRAGE, me); DoCast(me, SPELL_BERSERK); return; case EVENT_CLEAVE: DoCast(me->getVictim(), SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); return; case EVENT_TAIL: DoCastAOE(SPELL_TAIL_SWEEP); events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); return; case EVENT_DRAIN: DoCastAOE(SPELL_LIFE_DRAIN); events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); return; case EVENT_BLIZZARD: { //DoCastAOE(SPELL_SUMMON_BLIZZARD); if (Creature* summon = DoSummon(MOB_BLIZZARD, me, 0.0f, urand(25000, 30000), TEMPSUMMON_TIMED_DESPAWN)) summon->GetMotionMaster()->MoveRandom(40); events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20000, 7000), 0, PHASE_GROUND); break; } case EVENT_FLIGHT: phase = PHASE_FLIGHT; events.SetPhase(PHASE_FLIGHT); me->SetReactState(REACT_PASSIVE); me->AttackStop(); float x, y, z, o; me->GetHomePosition(x, y, z, o); me->GetMotionMaster()->MovePoint(1, x, y, z); return; } } DoMeleeAttackIfReady(); } else { if (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_LIFTOFF: me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->SendMovementFlagUpdate(); events.ScheduleEvent(EVENT_ICEBOLT, 1500); iceboltCount = RAID_MODE(2, 3); return; case EVENT_ICEBOLT: { std::vector<Unit*> targets; std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) targets.push_back((*i)->getTarget()); if (targets.empty()) iceboltCount = 0; else { std::vector<Unit*>::const_iterator itr = targets.begin(); advance(itr, rand()%targets.size()); iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); DoCast(*itr, SPELL_ICEBOLT); --iceboltCount; } if (iceboltCount) events.ScheduleEvent(EVENT_ICEBOLT, 1000); else events.ScheduleEvent(EVENT_BREATH, 1000); return; } case EVENT_BREATH: { DoScriptText(EMOTE_BREATH, me); DoCastAOE(SPELL_FROST_MISSILE); events.ScheduleEvent(EVENT_EXPLOSION, 8000); return; } case EVENT_EXPLOSION: CastExplosion(); ClearIceBlock(); events.ScheduleEvent(EVENT_LAND, 3000); return; case EVENT_LAND: me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->SendMovementFlagUpdate(); events.ScheduleEvent(EVENT_GROUND, 1500); return; case EVENT_GROUND: EnterPhaseGround(); return; case EVENT_BIRTH: me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_AGGRESSIVE); return; } }//if (uint32 eventId = events.ExecuteEvent()) }//if (phase == PHASE_GROUND) }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; //Common to PHASE_START && PHASE_END if (Phase == PHASE_START || Phase == PHASE_END) { //Specific to PHASE_START || PHASE_END if (Phase == PHASE_START) { if (HealthBelowPct(65)) { if (Unit* target = me->GetVictim()) tankGUID = target->GetGUID(); SetCombatMovement(false); Phase = PHASE_BREATH; me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->GetMotionMaster()->MovePoint(10, Phase2Location); return; } } events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BELLOWING_ROAR: // Phase PHASE_END { DoCastVictim(SPELL_BELLOWING_ROAR); // Eruption GameObject* Floor = NULL; Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check); me->VisitNearbyGridObject(30, searcher); if (Floor) instance->SetGuidData(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID()); events.ScheduleEvent(EVENT_BELLOWING_ROAR, 30000); break; } case EVENT_FLAME_BREATH: // Phase PHASE_START and PHASE_END DoCastVictim(SPELL_FLAME_BREATH); events.ScheduleEvent(EVENT_FLAME_BREATH, urand(10000, 20000)); break; case EVENT_TAIL_SWEEP: // Phase PHASE_START and PHASE_END DoCastAOE(SPELL_TAIL_SWEEP); events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(15000, 20000)); break; case EVENT_CLEAVE: // Phase PHASE_START and PHASE_END DoCastVictim(SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, urand(2000, 5000)); break; case EVENT_WING_BUFFET: // Phase PHASE_START and PHASE_END DoCastVictim(SPELL_WING_BUFFET); events.ScheduleEvent(EVENT_WING_BUFFET, urand(15000, 30000)); break; default: break; } } DoMeleeAttackIfReady(); } else { if (HealthBelowPct(40)) { Phase = PHASE_END; instance->SetData(DATA_ONYXIA_PHASE, PHASE_END); Talk(SAY_PHASE_3_TRANS); SetCombatMovement(true); IsMoving = false; Position const pos = me->GetHomePosition(); me->GetMotionMaster()->MovePoint(9, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + 12.0f); events.ScheduleEvent(EVENT_BELLOWING_ROAR, 30000); return; } if (!me->isMoving()) if (Creature* trigger = ObjectAccessor::GetCreature(*me, triggerGUID)) me->SetFacingToObject(trigger); events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_DEEP_BREATH: // Phase PHASE_BREATH if (!IsMoving) { if (me->IsNonMeleeSpellCast(false)) me->InterruptNonMeleeSpells(false); Talk(EMOTE_BREATH); if (PointData) /// @todo: In what cases is this null? What should we do? DoCast(me, PointData->SpellId); events.ScheduleEvent(EVENT_DEEP_BREATH, 75000); } else events.ScheduleEvent(EVENT_DEEP_BREATH, 1000); break; case EVENT_MOVEMENT: // Phase PHASE_BREATH if (!IsMoving && !(me->HasUnitState(UNIT_STATE_CASTING))) { SetNextRandomPoint(); PointData = GetMoveData(); if (!PointData) return; me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ); IsMoving = true; events.ScheduleEvent(EVENT_MOVEMENT, 25000); } else events.ScheduleEvent(EVENT_MOVEMENT, 500); break; case EVENT_FIREBALL: // Phase PHASE_BREATH if (!IsMoving) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_FIREBALL); events.ScheduleEvent(EVENT_FIREBALL, 8000); } else events.ScheduleEvent(EVENT_FIREBALL, 1000); break; case EVENT_LAIR_GUARD: // Phase PHASE_BREATH me->SummonCreature(NPC_LAIRGUARD, SpawnLocations[2], TEMPSUMMON_CORPSE_DESPAWN); events.ScheduleEvent(EVENT_LAIR_GUARD, 30000); break; case EVENT_WHELP_SPAWN: // Phase PHASE_BREATH me->SummonCreature(NPC_WHELP, SpawnLocations[0], TEMPSUMMON_CORPSE_DESPAWN); me->SummonCreature(NPC_WHELP, SpawnLocations[1], TEMPSUMMON_CORPSE_DESPAWN); if (SummonWhelpCount >= RAID_MODE(20, 40)) { SummonWhelpCount = 0; events.ScheduleEvent(EVENT_WHELP_SPAWN, 90000); } else events.ScheduleEvent(EVENT_WHELP_SPAWN, 500); break; default: break; } } } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CURSE: DoCastAOE(SPELL_CURSE_PLAGUEBRINGER); events.ScheduleEvent(EVENT_CURSE, urand(50000, 60000)); return; case EVENT_WARRIOR: Talk(SAY_SUMMON); SummonUndead(MOB_WARRIOR, RAID_MODE(2, 3)); events.ScheduleEvent(EVENT_WARRIOR, 30000); return; case EVENT_BLINK: DoCastAOE(SPELL_CRIPPLE, true); DoCastAOE(SPELL_BLINK); DoResetThreat(); events.ScheduleEvent(EVENT_BLINK, 40000); return; case EVENT_BALCONY: me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->AttackStop(); me->RemoveAllAuras(); me->NearTeleportTo(TELE_X, TELE_Y, TELE_Z, TELE_O); events.Reset(); events.ScheduleEvent(EVENT_WAVE, urand(2000, 5000)); waveCount = 0; return; case EVENT_WAVE: Talk(SAY_SUMMON); switch (balconyCount) { case 0: SummonUndead(MOB_CHAMPION, RAID_MODE(2, 4)); break; case 1: SummonUndead(MOB_CHAMPION, RAID_MODE(1, 2)); SummonUndead(MOB_GUARDIAN, RAID_MODE(1, 2)); break; case 2: SummonUndead(MOB_GUARDIAN, RAID_MODE(2, 4)); break; default:SummonUndead(MOB_CHAMPION, RAID_MODE(5, 10)); SummonUndead(MOB_GUARDIAN, RAID_MODE(5, 10));break; } ++waveCount; events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, urand(30000, 45000)); return; case EVENT_GROUND: { ++balconyCount; float x, y, z, o; me->GetHomePosition(x, y, z, o); me->NearTeleportTo(x, y, z, o); events.ScheduleEvent(EVENT_BALCONY, 110000); EnterPhaseGround(); return; } } } if (me->HasReactState(REACT_AGGRESSIVE)) DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (me->getVictim() && !me->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) me->Kill(me->getVictim()); events.Update(diff); if (HealthBelowPct(50) && !PermaGround) EnterPermaGround(); if (EnrageTimer <= diff && !Enraged) { DoCast(me, SPELL_BERSERK); Enraged = true; } else EnrageTimer -= diff; if (phase == PHASE_GROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_FLIGHT: phase = PHASE_FLIGHT; events.SetPhase(PHASE_FLIGHT); me->SetFlying(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->RemoveAllAuras(); me->GetMotionMaster()->MovePoint(0, RazorFlight); events.ScheduleEvent(EVENT_FIREBALL, 7000, 0, PHASE_FLIGHT); events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT); events.ScheduleEvent(EVENT_SUMMON, 5000, 0, PHASE_FLIGHT); events.ScheduleEvent(EVENT_GROUND, 75000, 0, PHASE_FLIGHT); ++FlyCount; return; case EVENT_LAND: me->SetFlying(false); me->NearTeleportTo(586.966f, -175.534f, 391.517f, 1.692f); DoCast(me, SPELL_STUN, true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (Creature *pCommander = me->GetCreature(*me, instance->GetData64(DATA_EXP_COMMANDER))) pCommander->AI()->DoAction(ACTION_GROUND_PHASE); events.ScheduleEvent(EVENT_HARPOON, 0, 0, PHASE_GROUND); events.ScheduleEvent(EVENT_BREATH, 30000, 0, PHASE_GROUND); events.ScheduleEvent(EVENT_BUFFET, 33000, 0, PHASE_GROUND); events.ScheduleEvent(EVENT_FLIGHT, 35000, 0, PHASE_GROUND); return; case EVENT_HARPOON: for (uint8 n = 0; n < RAID_MODE(2, 4); ++n) if (Harpoon[n]) Harpoon[n]->CastSpell(me, SPELL_HARPOON, true); events.ScheduleEvent(EVENT_HARPOON, 1500, 0, PHASE_GROUND); return; case EVENT_BREATH: me->MonsterTextEmote(EMOTE_BREATH, 0, true); DoCastAOE(SPELL_FLAMEBREATH); events.CancelEvent(EVENT_HARPOON); events.CancelEvent(EVENT_BREATH); return; case EVENT_BUFFET: DoCastAOE(SPELL_WINGBUFFET); for (uint8 n = 0; n < RAID_MODE(2, 4); ++n) if (Harpoon[n]) Harpoon[n]->CastSpell(Harpoon[n], SPELL_FLAMED, true); events.CancelEvent(EVENT_BUFFET); return; } } } if (phase == PHASE_PERMAGROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_FLAME: DoCastAOE(SPELL_FLAMEBUFFET); events.ScheduleEvent(EVENT_FLAME, 10000, 0, PHASE_PERMAGROUND); return; case EVENT_BREATH: me->MonsterTextEmote(EMOTE_BREATH, 0, true); DoCastVictim(SPELL_FLAMEBREATH); events.ScheduleEvent(EVENT_BREATH, 20000, 0, PHASE_PERMAGROUND); return; case EVENT_FIREBALL: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) DoCast(pTarget, SPELL_FIREBALL); events.ScheduleEvent(EVENT_FIREBALL, 3000, 0, PHASE_PERMAGROUND); return; case EVENT_DEVOURING: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) DoCast(pTarget, SPELL_DEVOURING_FLAME); events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_PERMAGROUND); return; case EVENT_BUFFET: DoCastAOE(SPELL_WINGBUFFET); events.CancelEvent(EVENT_BUFFET); return; case EVENT_FUSE: DoCastVictim(SPELL_FUSEARMOR); events.ScheduleEvent(EVENT_FUSE, 10000, 0, PHASE_PERMAGROUND); return; } } DoMeleeAttackIfReady(); } else { if (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_GROUND: phase = PHASE_GROUND; events.SetPhase(PHASE_GROUND); if (Harpoon[0]) Harpoon[0]->MonsterTextEmote(EMOTE_HARPOON, 0, true); me->GetMotionMaster()->MovePoint(0, RazorGround); events.ScheduleEvent(EVENT_LAND, 5500, 0, PHASE_GROUND); return; case EVENT_FIREBALL: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) DoCast(pTarget, SPELL_FIREBALL); events.ScheduleEvent(EVENT_FIREBALL, 3000, 0, PHASE_FLIGHT); return; case EVENT_DEVOURING: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) DoCast(pTarget, SPELL_DEVOURING_FLAME); events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT); return; case EVENT_SUMMON: SummonAdds(); events.ScheduleEvent(EVENT_SUMMON, 45000, 0, PHASE_FLIGHT); return; } } } }
void JustDied(Unit* killer) { DoCast(killer, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25)); }
void Reset() { DoCast(me, RAID_MODE(SPELL_STATIC_CHARGED_10, SPELL_STATIC_CHARGED_25)); _shockTimer = 0; // first one is immediate. }
void ReleaseGrabbedPlayers() { for (uint8 i = 0; i < RAID_MODE(1, 3); ++i) if (Unit* grabbed = Unit::GetUnit(*me, uiGrippedTargets[i])) me->CastSpell(grabbed, SPELL_STONE_GRIP_CANCEL, false); }
void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_ENRAGE: DoScriptText(SAY_BRUNDIR_BERSERK, me); DoCast(SPELL_BERSERK); break; case EVENT_PULSE: if (me->getVictim() && me->getVictim()->ToPlayer()) DoAttackerGroupInCombat(me->getVictim()->ToPlayer()); events.ScheduleEvent(EVENT_PULSE, 5000); break; case EVENT_CHAIN_LIGHTNING: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) DoCast(target, RAID_MODE(SPELL_CHAIN_LIGHTNING_N, SPELL_CHAIN_LIGHTNING_H)); events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(3000, 5000), 1); break; case EVENT_OVERLOAD: DoCast(RAID_MODE(SPELL_OVERLOAD, SPELL_OVERLOAD_H)); events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 80000), 1); break; case EVENT_LIGHTNING_WHIRL: DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL, SPELL_LIGHTNING_WHIRL_H)); events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000, 40000), 1); break; case EVENT_THREAT_WIPE: DoResetThreat(); events.ScheduleEvent(EVENT_THREAT_WIPE, 5000); break; case EVENT_LIGHTNING_TENDRILS_START: me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H)); me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->SendMovementFlagUpdate(); events.DelayEvents(35000, 1); events.ScheduleEvent(EVENT_LIGHTNING_TENDRILS_END, 30000); events.ScheduleEvent(EVENT_THREAT_WIPE, 0); break; case EVENT_LIGHTNING_TENDRILS_END: me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->SendMovementFlagUpdate(); me->RemoveAurasDueToSpell(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H)); events.ScheduleEvent(EVENT_LIGHTNING_TENDRILS_START, urand(40000, 80000)); events.CancelEvent(EVENT_THREAT_WIPE); break; } } if (!me->HasAura(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H))) DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; if (me->HasUnitState(UNIT_STAT_CASTING)) return; events.Update(diff); if (!bConflagration) { while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CAST_CONFLAGRATION: bConflagration = true; events.ScheduleEvent(EVENT_CAST_CONFLAGRATION_FLY, 1000); break; case EVENT_CAST_ENRAGE: DoCast(SPELL_ENRAGE); events.ScheduleEvent(EVENT_CAST_ENRAGE, urand(25000,35000)); break; case EVENT_CAST_FLAME_BREATH: DoCast(RAID_MODE(SPELL_FLAME_BREATH_10,SPELL_FLAME_BREATH_25,SPELL_FLAME_BREATH_10,SPELL_FLAME_BREATH_25)); events.ScheduleEvent(EVENT_CAST_FLAME_BREATH, urand(10000,15000)); break; } } } else { while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CAST_CONFLAGRATION_FLY: me->GetMotionMaster()->MovePoint(1, (float)3159.04, (float)676.08, (float)103.05); SelectTargetList(playerList, RAID_MODE(TARGETS_10,TARGETS_25,TARGETS_10,TARGETS_25), SELECT_TARGET_RANDOM, 0, true); for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { Unit *pTemp = (*itr); me->CastSpell(pTemp, SPELL_FLAME_BEACON, true); } events.ScheduleEvent(EVENT_CAST_CONFLAGRATION_CAST, 5000); break; case EVENT_CAST_CONFLAGRATION_CAST: for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { Unit *pTemp = (*itr); me->CastSpell(pTemp, SPELL_CONFLAGRATION, true); } playerList.clear(); me->GetMotionMaster()->MoveTargetedHome(); bConflagration = false; events.ScheduleEvent(EVENT_CAST_CONFLAGRATION, urand(45000,55000)); break; } } } DoMeleeAttackIfReady(); }
void UpdateAI(uint32 Diff) { if (!UpdateVictim()) return; events.Update(Diff); if (HealthBelowPct(50) && !PermaGround) EnterPermaGround(); if (EnrageTimer <= Diff && !Enraged) { DoCast(me, SPELL_BERSERK); Enraged = true; } else EnrageTimer -= Diff; if (HarpoonCounter == RAID_MODE(2, 4)) { HarpoonCounter = 0; me->GetMotionMaster()->MoveLand(1, RazorGround); } if (phase == PHASE_GROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FLIGHT: phase = PHASE_FLIGHT; events.SetPhase(PHASE_FLIGHT); me->SetCanFly(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->GetMotionMaster()->MoveTakeoff(0, RazorFlight); events.ScheduleEvent(EVENT_FIREBALL, 7000, 0, PHASE_FLIGHT); events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT); events.ScheduleEvent(EVENT_SUMMON, 5000, 0, PHASE_FLIGHT); ++FlyCount; return; case EVENT_LAND: me->SetCanFly(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); if (Creature* commander = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_EXPEDITION_COMMANDER) : 0)) commander->AI()->DoAction(ACTION_GROUND_PHASE); events.ScheduleEvent(EVENT_BREATH, 30000, 0, PHASE_GROUND); events.ScheduleEvent(EVENT_BUFFET, 33000, 0, PHASE_GROUND); events.ScheduleEvent(EVENT_FLIGHT, 35000, 0, PHASE_GROUND); return; case EVENT_BREATH: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); me->RemoveAllAuras(); me->SetReactState(REACT_AGGRESSIVE); Talk(EMOTE_BREATH); DoCastAOE(SPELL_FLAMEBREATH); events.CancelEvent(EVENT_BREATH); return; case EVENT_BUFFET: DoCastAOE(SPELL_WINGBUFFET); if (Creature* controller = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_RAZORSCALE_CONTROL) : 0)) controller->CastSpell(controller, SPELL_FLAMED, true); events.CancelEvent(EVENT_BUFFET); return; } } } if (phase == PHASE_PERMAGROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FLAME: DoCastAOE(SPELL_FLAMEBUFFET); events.ScheduleEvent(EVENT_FLAME, 10000, 0, PHASE_PERMAGROUND); return; case EVENT_BREATH: Talk(EMOTE_BREATH); DoCastVictim(SPELL_FLAMEBREATH); events.ScheduleEvent(EVENT_BREATH, 20000, 0, PHASE_PERMAGROUND); return; case EVENT_FIREBALL: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true)) DoCast(target, SPELL_FIREBALL); events.ScheduleEvent(EVENT_FIREBALL, 3000, 0, PHASE_PERMAGROUND); return; case EVENT_DEVOURING: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true)) DoCast(target, SPELL_DEVOURING_FLAME); events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_PERMAGROUND); return; case EVENT_BUFFET: DoCastAOE(SPELL_WINGBUFFET); events.CancelEvent(EVENT_BUFFET); return; case EVENT_FUSE: DoCast(me->getVictim(), SPELL_FUSEARMOR); events.ScheduleEvent(EVENT_FUSE, 10000, 0, PHASE_PERMAGROUND); return; } } DoMeleeAttackIfReady(); } else { if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FIREBALL: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true)) DoCast(target, SPELL_FIREBALL); events.ScheduleEvent(EVENT_FIREBALL, 3000, 0, PHASE_FLIGHT); return; case EVENT_DEVOURING: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true)) me->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_DEVOURING_FLAME, true); events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT); return; case EVENT_SUMMON: SummonMoleMachines(); events.ScheduleEvent(EVENT_SUMMON, 45000, 0, PHASE_FLIGHT); return; } } } }
void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FREEZE: DoCastAOE(SPELL_FREEZE); events.ScheduleEvent(EVENT_FREEZE, urand(30000, 45000)); break; case EVENT_ICICLE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) DoCast(target, SPELL_ICICLE); events.ScheduleEvent(EVENT_ICICLE, RAID_MODE(5500, 3500)); break; case EVENT_FLASH_FREEZE: DoScriptText(SAY_FLASH_FREEZE, me); DoScriptText(EMOTE_FREEZE, me); for (uint8 n = 0; n < RAID_MODE(2, 3); ++n) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) target->CastSpell(target, SPELL_ICICLE_SNOWDRIFT, true); DoCast(SPELL_FLASH_FREEZE); events.ScheduleEvent(EVENT_FLASH_FREEZE_EFFECT, 500); break; case EVENT_FLASH_FREEZE_EFFECT: { std::list<Creature*> IcicleSnowdriftList; GetCreatureListWithEntryInGrid(IcicleSnowdriftList, me, NPC_SNOWPACKED_ICICLE, 100.0f); for (std::list<Creature*>::iterator itr = IcicleSnowdriftList.begin(); itr != IcicleSnowdriftList.end(); ++itr) (*itr)->CastSpell(me, SPELL_FLASH_FREEZE_VISUAL, true); FlashFreeze(); events.CancelEvent(EVENT_FLASH_FREEZE_EFFECT); events.ScheduleEvent(EVENT_FLASH_FREEZE, urand(25000, 35000)); break; } case EVENT_BLOWS: DoScriptText(SAY_STALACTITE, me); DoScriptText(EMOTE_BLOWS, me); DoCast(me, SPELL_FROZEN_BLOWS); events.ScheduleEvent(EVENT_BLOWS, urand(60000, 65000)); break; case EVENT_RARE_CACHE: DoScriptText(SAY_HARD_MODE_FAILED, me); iCouldSayThatThisCacheWasRare = false; events.CancelEvent(EVENT_RARE_CACHE); break; case EVENT_BERSERK: DoScriptText(SAY_BERSERK, me); DoCast(me, SPELL_BERSERK, true); events.CancelEvent(EVENT_BERSERK); break; } } if (gettingColdInHereTimer <= diff && gettingColdInHere) { std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Aura* BitingColdAura = target->GetAura(SPELL_BITING_COLD_TRIGGERED)) if ((target->GetTypeId() == TYPEID_PLAYER) && (BitingColdAura->GetStackAmount() > 2)) me->AI()->SetData(DATA_GETTING_COLD_IN_HERE, 0); gettingColdInHereTimer = 1000; } else gettingColdInHereTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) { if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING)) return; if (!phase) return; if (m_uiPowerTimer <= diff) { instance->NormaliseAltPower(); } else m_uiPowerTimer -= diff; events.Update(diff); if (phase == PHASE_GROUND) // Ground phase { ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_AGGRO_NEF: if (Creature* nefarianHelperheroic = me->FindNearestCreature(NPC_NEFARIAN_HELPER_HEROIC, 150.0f, true)) nefarianHelperheroic->AI()->Talk(28); return; case EVENT_SONAR_PULSE: DoCast(me, SPELL_SONAR_PULSE); me->SummonCreature(NPC_SONAR_PULSES, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 1.5f, TEMPSUMMON_TIMED_DESPAWN, 30000); me->SummonCreature(NPC_SONAR_PULSES, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 3.0f, TEMPSUMMON_TIMED_DESPAWN, 30000); me->SummonCreature(NPC_SONAR_PULSES, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 4.5f, TEMPSUMMON_TIMED_DESPAWN, 30000); me->SummonCreature(NPC_SONAR_PULSES, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 6.0f, TEMPSUMMON_TIMED_DESPAWN, 30000); events.ScheduleEvent(EVENT_SONAR_PULSE, 50000); break; case EVENT_MODULATION: DoCast(me, SPELL_MODULATION); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) unit->SetPower(POWER_ALTERNATE_POWER, unit->GetPower(POWER_ALTERNATE_POWER) + 7); events.ScheduleEvent(EVENT_MODULATION, 20000); break; case EVENT_SONIC_BREATH: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) { target->AddAura(SPELL_TRACKING, target); DoCast(target, SPELL_SONIC_BREATH); } events.ScheduleEvent(EVENT_REMOVE_TRACKING, 8500); events.ScheduleEvent(EVENT_SONIC_BREATH, 40000); break; case EVENT_REMOVE_TRACKING: if(instance) instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TRACKING); return; case EVENT_SEARING_FLAMES: Talk(SAY_SEARING); DoCast(me, SPELL_SEARING_FLAMES); events.ScheduleEvent(EVENT_SEARING_FLAMES, 50000); break; case EVENT_LIFTOFF: Talk(SAY_AIR_PHASE); me->HandleEmote(EMOTE_ONESHOT_LIFTOFF); me->SetDisableGravity(true); events.ScheduleEvent(EVENT_FLIGHT, 1500); events.ScheduleEvent(EVENT_AIR, 2000); return; case EVENT_FLIGHT: me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->GetMotionMaster()->MovePoint(1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 20.0f); return; case EVENT_AIR: EnterPhaseAir(); return; case EVENT_FIEND: me->SummonCreature(NPC_OBNOXIOUS_FIEND, 93.767f, -224.105f, 74.911f, 6.26f, TEMPSUMMON_CORPSE_DESPAWN, 3000); if (Creature* nefarianHelperheroic = me->FindNearestCreature(NPC_NEFARIAN_HELPER_HEROIC, 150.0f, true)) nefarianHelperheroic->AI()->Talk(27); events.ScheduleEvent(EVENT_FIEND, 38500); break; } } DoMeleeAttackIfReady(); } else if (phase == PHASE_FLIGHT) // Air phase { std::list<Unit*> targets; ThreatContainer::StorageType const &m_threatlist = me->getThreatManager().getThreatList(); // if has vertigo, remove all roaring flame npc's wait 8 sec then get player who rang gong. if (me->HasAura(SPELL_VERTIGO)) events.ScheduleEvent(EVENT_ROARING_FLAME_SUMMON, 8000, PHASE_FLIGHT); if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_ROARING_FLAME_SUMMON: for (ThreatContainer::StorageType::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && unit->HasAura(SPELL_NOISY)) // You rang? :) { me->SummonCreature(NPC_ROARING_FLAME_TARGET, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000); } else { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) me->SummonCreature(NPC_ROARING_FLAME_TARGET, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000); } } events.ScheduleEvent(EVENT_ROARING_FLAME, 500); return; case EVENT_ROARING_FLAME: if (Unit* roaring = me->FindNearestCreature(NPC_ROARING_FLAME_TARGET, 100.0f)) DoCast(roaring, SPELL_ROARING_FLAME_BREATH_DUMMY); return; case EVENT_SONAR_BOMB: SelectTargetList(targets, RAID_MODE(3, 6), SELECT_TARGET_RANDOM, 100.0f, true); if (!targets.empty()) for (std::list<Unit*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) DoCast(*itr, SPELL_SONAR_BOMB); events.ScheduleEvent(EVENT_SONAR_BOMB, 18000); break; case EVENT_LAND: me->HandleEmote(EMOTE_ONESHOT_LAND); me->SetDisableGravity(false); events.ScheduleEvent(EVENT_RETURN, 1000); events.ScheduleEvent(EVENT_GROUND, 1500); return; case EVENT_RETURN: me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->GetMotionMaster()->MovePoint(1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() - 20.0f); return; case EVENT_GROUND: EnterPhaseGround(); return; } } } }
void UpdateAI(uint32 const diff) { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo) { thirtyPercentReached = true; if (instance) instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); } if (me->HasUnitState(UNIT_STAT_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_SUMMON: if (waves[waveCount].entry) { if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) DoGothikSummon(waves[waveCount].entry); else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) DoGothikSummon(waves[waveCount].entry); else if (waves[waveCount].mode == 1) DoGothikSummon(waves[waveCount].entry); // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11) if (waveCount == 11) { if (!CheckGroupSplitted()) { if (instance) instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); summons.DoAction(0, 0); summons.DoZoneInCombat(); mergedSides = true; } } if (waves[waveCount].mode == 1) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); else if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); else events.ScheduleEvent(EVENT_SUMMON, 0); ++waveCount; } else { phaseTwo = true; DoScriptText(SAY_TELEPORT, me); DoTeleportTo(PosGroundLiveSide); me->SetReactState(REACT_AGGRESSIVE); summons.DoAction(0, 0); summons.DoZoneInCombat(); events.ScheduleEvent(EVENT_BOLT, 1000); events.ScheduleEvent(EVENT_HARVEST, urand(3000, 15000)); events.ScheduleEvent(EVENT_TELEPORT, 20000); } break; case EVENT_BOLT: DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); events.ScheduleEvent(EVENT_BOLT, 1000); break; case EVENT_HARVEST: DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true); events.ScheduleEvent(EVENT_HARVEST, urand(20000, 25000)); break; case EVENT_TELEPORT: if (!thirtyPercentReached) { me->AttackStop(); if (IN_LIVE_SIDE(me)) DoTeleportTo(PosGroundDeadSide); else DoTeleportTo(PosGroundLiveSide); me->getThreatManager().resetAggro(NotOnSameSide(me)); if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0)) { me->getThreatManager().addThreat(target, 100.0f); AttackStart(target); } events.ScheduleEvent(EVENT_TELEPORT, 20000); } break; } } if (!phaseTwo) DoMeleeAttackIfReady(); }
void Reset() { me->SetDisplayId(MODEL_INVISIBLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE); DoCast(RAID_MODE(SPELL_SLEEPING_FERAL_ESSENCE_10, SPELL_SLEEPING_FERAL_ESSENCE_25)); }