void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (phase == 1) { if (FrostAura_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_FROST_AURA); FrostAura_Timer = 5000; }else FrostAura_Timer -= diff; if (LifeDrain_Timer < diff) { if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCastSpellIfCan(target,SPELL_LIFE_DRAIN); LifeDrain_Timer = 24000; }else LifeDrain_Timer -= diff; if (Blizzard_Timer < diff) { if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCastSpellIfCan(target,SPELL_BLIZZARD); Blizzard_Timer = 20000; }else Blizzard_Timer -= diff; // Cleave if (m_uiCleaveTimer < diff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); m_uiCleaveTimer = 7000 + rand()%3000; } else m_uiCleaveTimer -= diff; // Tail Sweep if (m_uiTailSweepTimer < diff) { DoCast(m_creature->getVictim(), m_bIsRegularMode ? SPELL_TAIL_LASH : SPELL_TAIL_LASH_H); m_uiTailSweepTimer = 15000 + rand()%5000; } else m_uiTailSweepTimer -= diff; if (m_creature->GetHealthPercent() > 10.0f) { if (Fly_Timer < diff) { phase = 2; m_creature->InterruptNonMeleeSpells(false); m_creature->StopMoving(); m_creature->HandleEmote(EMOTE_ONESHOT_LIFTOFF); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); m_creature->MonsterMove(SAPPHIRON_X, SAPPHIRON_Y, SAPPHIRON_Z + 20, 1); //DoCast(m_creature,11010); //m_creature->SetHover(true); //DoCast(m_creature,18430); Icebolt_Timer = 4000; Icebolt_Count = 0; landoff = false; }else Fly_Timer -= diff; } } if (phase == 2) { if (Icebolt_Timer < diff && Icebolt_Count < 5) { if (Icebolt_Count == 1 || Icebolt_Count == 3) if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) { DoCast(target, SPELL_ICEBOLT); targets.push_back(target); } ++Icebolt_Count; Icebolt_Timer = 4000; }else Icebolt_Timer -= diff; if (Icebolt_Count == 5 && !landoff) { if (FrostBreath_Timer < diff) { // apply immune ThreatList const& tList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator iter = tList.begin();iter != tList.end(); ++iter) { Unit* pUnit = m_creature->GetMap()->GetUnit((*iter)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER) && pUnit->isAlive()) { if (!pUnit->HasAura(SPELL_ICEBOLT)) { for(std::vector<Unit*>::iterator itr = targets.begin(); itr!= targets.end(); ++itr) { if (*itr) { if(!(*itr)->isAlive()) return; if (pUnit->GetDistance2d(*itr) <= 5 && (*itr)->HasAura(SPELL_ICEBOLT)) pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); } } } } } DoScriptText(EMOTE_BREATH, m_creature); DoCast(m_creature->getVictim(),m_bIsRegularMode ? SPELL_FROST_BREATH : SPELL_FROST_BREATH_H); land_Timer = 2000; landoff = true; FrostBreath_Timer = 6000; }else FrostBreath_Timer -= diff; } if (landoff) { if (land_Timer < diff) { phase = 1; m_creature->HandleEmote(EMOTE_ONESHOT_LAND); m_creature->SetHover(false); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); ThreatList const& tList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator iter = tList.begin();iter != tList.end(); ++iter) { Unit* pUnit = m_creature->GetMap()->GetUnit((*iter)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); } targets.clear(); Fly_Timer = 67000; isAtGround = false; land_time = 3500; }else land_Timer -= diff; } } if(phase == 1 && isAtGround == false) { if(land_time < diff) { isAtGround = true; DoStartMovement(m_creature->getVictim()); }else land_time -=diff; } if (Beserk_Timer < diff) { if (DoCastSpellIfCan(m_creature, SPELL_BESERK) == CAST_OK) { DoScriptText(EMOTE_GENERIC_ENRAGED, m_creature); Beserk_Timer = 300000; } }else Beserk_Timer -= diff; if (phase!=2 && isAtGround == true) DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BERSERK: Talk(SAY_BRUNDIR_BERSERK); DoCast(SPELL_BERSERK); events.CancelEvent(EVENT_BERSERK); break; case EVENT_CHAIN_LIGHTNING: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CHAIN_LIGHTNING); events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(7000, 10000)); break; case EVENT_OVERLOAD: Talk(EMOTE_BRUNDIR_OVERLOAD); Talk(SAY_BRUNDIR_SPECIAL); DoCast(SPELL_OVERLOAD); events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 120000)); break; case EVENT_LIGHTNING_WHIRL: DoCast(SPELL_LIGHTNING_WHIRL); events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(15000, 20000)); break; case EVENT_LIGHTNING_TENDRILS: Talk(SAY_BRUNDIR_FLIGHT); DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M)); DoCast(SPELL_LIGHTNING_TENDRILS_VISUAL); me->AttackStop(); //me->SetLevitate(true); me->GetMotionMaster()->Initialize(); me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FINAL_FLIGHT_Z); events.DelayEvents(35000); events.ScheduleEvent(EVENT_FLIGHT, 2500); events.ScheduleEvent(EVENT_ENDFLIGHT, 32500); events.ScheduleEvent(EVENT_LIGHTNING_TENDRILS, 90000); break; case EVENT_FLIGHT: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) me->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), FINAL_FLIGHT_Z); events.ScheduleEvent(EVENT_FLIGHT, 6000); break; case EVENT_ENDFLIGHT: me->GetMotionMaster()->Initialize(); me->GetMotionMaster()->MovePoint(0, 1586.920166f, 119.848984f, FINAL_FLIGHT_Z); events.CancelEvent(EVENT_FLIGHT); events.CancelEvent(EVENT_ENDFLIGHT); events.ScheduleEvent(EVENT_LAND, 4000); break; case EVENT_LAND: me->GetMotionMaster()->Initialize(); me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FLOOR_Z); events.CancelEvent(EVENT_LAND); events.ScheduleEvent(EVENT_GROUND, 2500); break; case EVENT_GROUND: //me->SetLevitate(false); me->RemoveAurasDueToSpell(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M)); me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_VISUAL); DoStartMovement(me->getVictim()); events.CancelEvent(EVENT_GROUND); me->getThreatManager().resetAllAggro(); break; case EVENT_MOVE_POSITION: if (me->IsWithinMeleeRange(me->getVictim())) { float x = float(irand(-25, 25)); float y = float(irand(-25, 25)); me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + x, me->GetPositionY() + y, FLOOR_Z); // Prevention to go outside the room or into the walls if (Creature* trigger = me->FindNearestCreature(NPC_WORLD_TRIGGER, 100.0f, true)) if (me->GetDistance(trigger) >= 50.0f) me->GetMotionMaster()->MovePoint(0, trigger->GetPositionX(), trigger->GetPositionY(), FLOOR_Z); } events.ScheduleEvent(EVENT_MOVE_POSITION, urand(7500, 10000)); break; default: break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiDeathCheckTimer < diff) { Map* pMap = m_creature->GetMap(); if(pMap) { Map::PlayerList const &lPlayers = pMap->GetPlayers(); for (Map::PlayerList::const_iterator iter = lPlayers.begin(); iter != lPlayers.end(); ++iter) { Player* pPlayer = iter->getSource(); if(!pPlayer->isAlive()) m_bIsPlayerDeath = true; } } m_uiDeathCheckTimer = 1000; }else m_uiDeathCheckTimer -= diff; if (m_uiEvadeCheckCooldown < diff) { if (m_creature->GetDistance2d(2769.68f, -3684.61f) > 48.0f) EnterEvadeMode(); m_uiEvadeCheckCooldown = 2000; }else m_uiEvadeCheckCooldown -= diff; if (m_bDelay) { m_bDelay = false; DoCast(m_creature, SPELL_PLAGUED_CLOUD); } if (Phase_Timer < diff) { if (m_bCombatPhase) { m_creature->InterruptNonMeleeSpells(true); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); m_creature->GetMap()->CreatureRelocation(m_creature, PLATFORM_X, PLATFORM_Y, PLATFORM_Z, PLATFORM_O); m_creature->SendMonsterMove(PLATFORM_X, PLATFORM_Y, PLATFORM_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0); SetCombatMovement(false); m_bDelay = true; Phase_Timer = 45000; } else { SetCombatMovement(true); DoStartMovement(m_creature->getVictim()); Phase_Timer = 90000; Disruption_Timer = 0; } m_bCombatPhase = !m_bCombatPhase; m_uiSafeSection = 0; Erupt_Timer = 10000; m_bEruptDirection = false; } else Phase_Timer -= diff; if (Erupt_Timer < diff) { for (std::list<uint64>::iterator itr = m_PlagueFissureGUID[m_uiSafeSection].begin(); itr != m_PlagueFissureGUID[m_uiSafeSection].end(); ++itr) { if (GameObject* pGo = m_creature->GetMap()->GetGameObject(*itr)) if (pGo) { WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4); data << pGo->GetGUID(); data << 0; pGo->SendMessageToSet(&data,true); if (Creature* pTemp = m_creature->SummonCreature(14667, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100)) { pTemp->SetLevel(80); pTemp->CastSpell(pTemp, SPELL_ERUPTION, true); } } } if (m_uiSafeSection == 0 || m_uiSafeSection == 3) m_bEruptDirection = !m_bEruptDirection; m_bEruptDirection ? ++m_uiSafeSection : --m_uiSafeSection; m_bCombatPhase ? Erupt_Timer = 10000 : Erupt_Timer = 3000; // Teleport "cheaters" to center of room (until LOS with GOs will be implemented) Map* map = m_creature->GetMap(); if (map->IsDungeon()) { Map::PlayerList const &PlayerList = map->GetPlayers(); if (!PlayerList.isEmpty()) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if ((i->getSource()->GetDistance2d(2769.68f, -3684.61f) > 48.0f) && (i->getSource()->GetDistance2d(2769.68f, -3684.61f) < 100.0f)) i->getSource()->TeleportTo(533, 2769.68f, -3684.61f, 273.66f, 5.5f); } } else Erupt_Timer -= diff; if (m_bCombatPhase) { if (Disruption_Timer < diff) { DoCast(m_creature, SPELL_DISRUPTION); Disruption_Timer = 10000; } else Disruption_Timer -= diff; if (Feaver_Timer < diff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsRegularMode ? SPELL_FEAVER : H_SPELL_FEAVER); Feaver_Timer = 20000; } else Feaver_Timer -= diff; DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 uiDiff) override { // Banish the boss before combat if (m_uiBanishTimer) { if (m_uiBanishTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_LEOTHERAS_BANISH) == CAST_OK) m_uiBanishTimer = 0; } else m_uiBanishTimer -= uiDiff; } // Return since we have no target if (!SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiFinalFormTimer) { if (m_uiFinalFormTimer <= uiDiff) { DoSpawnCreature(NPC_SHADOW_LEO, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); SetCombatMovement(true); DoStartMovement(m_creature->getVictim()); m_uiFinalFormTimer = 0; } else m_uiFinalFormTimer -= uiDiff; // Wait until we finish the transition return; } // Human form spells if (!m_bDemonForm) { if (m_uiWhirlwindTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_WHIRLWIND) == CAST_OK) m_uiWhirlwindTimer = 32000; } else m_uiWhirlwindTimer -= uiDiff; if (!m_bIsFinalForm) { if (m_uiSwitchTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_METAMORPHOSIS) == CAST_OK) { DoScriptText(SAY_SWITCH_TO_DEMON, m_creature); SetCombatMovement(false); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); DoResetThreat(); m_bDemonForm = true; m_uiInnerDemonTimer = 27500; m_uiSwitchTimer = 60000; } } else m_uiSwitchTimer -= uiDiff; } DoMeleeAttackIfReady(); } // Demon form spells else { if (m_uiInnerDemonTimer) { if (m_uiInnerDemonTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_INSIDIOUS_WHISPER, CAST_INTERRUPT_PREVIOUS) == CAST_OK) { DoScriptText(SAY_INNER_DEMONS, m_creature); m_uiInnerDemonTimer = 0; } } else m_uiInnerDemonTimer -= uiDiff; } if (m_uiChaosBlastTimer < uiDiff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAOS_BLAST) == CAST_OK) m_uiChaosBlastTimer = urand(2000, 3000); } else m_uiChaosBlastTimer -= uiDiff; if (m_uiSwitchTimer < uiDiff) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); // switch to nightelf form m_creature->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS); SetCombatMovement(true); DoStartMovement(m_creature->getVictim()); DoResetThreat(); m_bDemonForm = false; m_uiWhirlwindTimer = 18500; m_uiSwitchTimer = 45000; } else m_uiSwitchTimer -= uiDiff; } // Prepare to summon the Shadow of Leotheras if (!m_bIsFinalForm && m_creature->GetHealthPercent() < 15.0f) { DoScriptText(SAY_FINAL_FORM, m_creature); m_uiFinalFormTimer = 10000; // reset him to human form if necessary if (m_bDemonForm) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); // switch to nightelf form m_creature->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS); DoResetThreat(); m_bDemonForm = false; } m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->HandleEmote(EMOTE_ONESHOT_KNEEL); SetCombatMovement(false); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_bIsFinalForm = true; } // Hard enrage timer if (m_uiEnrageTimer) { if (m_uiEnrageTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK) m_uiEnrageTimer = 0; } else m_uiEnrageTimer -= uiDiff; } }
void HandleFlightSequence() { switch (uiFlightCount) { case 0: //me->AttackStop(); me->GetMotionMaster()->Clear(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->StopMoving(); DoScriptText(YELL_TAKEOFF, me); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); break; case 1: me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); break; case 2: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); if (!target) { EnterEvadeMode(); return; } Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if (Vapor) { Vapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); } events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; } case 3: { DespawnSummons(MOB_VAPOR_TRAIL); //DoCast(me, SPELL_VAPOR_SELECT); need core support Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); if (!target) { EnterEvadeMode(); return; } //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support Creature* pVapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if (pVapor) { if (pVapor->AI()) pVapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); } events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; } case 4: DespawnSummons(MOB_VAPOR_TRAIL); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); break; case 5: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); if (!target) { EnterEvadeMode(); return; } breathX = target->GetPositionX(); breathY = target->GetPositionY(); float x, y, z; target->GetContactPoint(me, x, y, z, 70); me->GetMotionMaster()->MovePoint(0, x, y, z+10); break; } case 6: me->SetOrientation(me->GetAngle(breathX, breathY)); me->StopMoving(); //DoTextEmote("takes a deep breath.", NULL); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; case 7: { DoCast(me, SPELL_FOG_BREATH, true); float x, y, z; me->GetPosition(x, y, z); x = 2 * breathX - x; y = 2 * breathY - y; me->GetMotionMaster()->MovePoint(0, x, y, z); events.ScheduleEvent(EVENT_SUMMON_FOG, 1); break; } case 8: me->CastStop(SPELL_FOG_BREATH); me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); ++uiBreathCount; events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); if (uiBreathCount < 3) uiFlightCount = 4; break; case 9: if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO)) DoStartMovement(target); else { EnterEvadeMode(); return; } break; case 10: me->SetLevitate(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); EnterPhase(PHASE_GROUND); AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); break; } ++uiFlightCount; }
void UpdateAI(const uint32 uiDiff) override { if (!SelectCustomHostileTarget()) return; if (m_uiBerserkTimer) { if (m_uiBerserkTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK) m_uiBerserkTimer = 0; } else m_uiBerserkTimer -= uiDiff; } switch (m_uiPhase) { case PHASE_AIR: if (m_uiFireballTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_FIREBALL : SPELL_FIREBALL_H) == CAST_OK) m_uiFireballTimer = 2000; } } else m_uiFireballTimer -= uiDiff; if (m_uiDevouringFlameTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, SPELL_DEVOURING_FLAME) == CAST_OK) m_uiDevouringFlameTimer = 10000; } } else m_uiDevouringFlameTimer -= uiDiff; // harpoon is repaired; move to next one, or to home position if all are completed if (m_uiRepairHarpoonTimer) { if (m_uiRepairHarpoonTimer <= uiDiff) { // handle fire extinguish after a grounded phase if (!m_uiCurrentHarpoon) { // extinguish fires if (m_pInstance) { if (Creature* pCommander = m_pInstance->GetSingleCreatureFromStorage(NPC_EXPEDITION_COMMANDER)) { if (Creature* pEngineer = GetClosestCreatureWithEntry(pCommander, NPC_EXPEDITION_ENGINEER, 15.0f)) DoScriptText(SAY_EXTINGUISH_FIRE, pEngineer); } } // move engineers to the first harpoon again DoMoveEngineersToHarpoon(); m_uiRepairHarpoonTimer = 20000; } else { DoScriptText(EMOTE_HARPOON_READY, m_creature); // despawn the current broken harpoon and spawn the repaired one if (GameObject* pHarpoon = m_creature->GetMap()->GetGameObject(m_vHarpoonsGuids[m_uiCurrentHarpoon - 1])) { pHarpoon->SetRespawnTime(HOUR); pHarpoon->SetLootState(GO_JUST_DEACTIVATED); DoRepairHarpoon(pHarpoon); } // if all harpoons have been repaired stop if (m_uiCurrentHarpoon == m_uiMaxHarpoons) { for (GuidList::const_iterator itr = m_lEngineersGuids.begin(); itr != m_lEngineersGuids.end(); ++itr) { if (Creature* pEngineer = m_creature->GetMap()->GetCreature(*itr)) pEngineer->GetMotionMaster()->MoveTargetedHome(); } m_uiRepairHarpoonTimer = 0; } // move to next harpoon else { DoMoveEngineersToHarpoon(); m_uiRepairHarpoonTimer = 20000; } } } else m_uiRepairHarpoonTimer -= uiDiff; } // spawn Mole Machines with dwarfes if (m_uiDwarfSpawnTimer < uiDiff) { DoSpawnMoleMachines(); m_uiDwarfSpawnTimer = 40000; } else m_uiDwarfSpawnTimer -= uiDiff; break; case PHASE_TRANSITION: if (m_uiShackleTimer < uiDiff) { // cast trap visual for (GuidList::const_iterator itr = m_lTrappersGuids.begin(); itr != m_lTrappersGuids.end(); ++itr) { if (Creature* pTrapper = m_creature->GetMap()->GetCreature(*itr)) pTrapper->CastSpell(m_creature, SPELL_SHACKLE, TRIGGERED_NONE); } // stun Razorscale if (DoCastSpellIfCan(m_creature, SPELL_STUN) == CAST_OK) { m_creature->SetLevitate(false); m_creature->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_FLY_ANIM); m_uiPhase = PHASE_GROUNDED; m_uiGroundedTimer = 30000; m_uiGroundedStep = 0; m_uiShackleTimer = 5000; } } else m_uiShackleTimer -= uiDiff; break; case PHASE_GROUNDED: if (m_uiGroundedTimer < uiDiff) { switch (m_uiGroundedStep) { case 0: m_creature->RemoveAurasDueToSpell(SPELL_STUN); if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_FLAME_BREATH : SPELL_FLAME_BREATH_H) == CAST_OK) { DoScriptText(EMOTE_BREATH, m_creature); m_uiGroundedTimer = 2500; } break; case 1: if (DoCastSpellIfCan(m_creature, SPELL_WING_BUFFET) == CAST_OK) m_uiGroundedTimer = 1500; break; case 2: if (DoCastSpellIfCan(m_creature, SPELL_FIREBOLT) == CAST_OK) m_uiGroundedTimer = 2000; break; case 3: // if fully grounded then go to ground phase if (m_bIsGrounded) { SetCombatMovement(true); DoResetThreat(); DoStartMovement(m_creature->getVictim()); m_uiPhase = PHASE_ONLY_GROUND; } // resume air phase else { m_creature->SetLevitate(true); m_creature->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_FLY_ANIM); float fX, fY, fZ; m_creature->GetRespawnCoord(fX, fY, fZ); // use upgraded speed rate for FlyOrLand. This isn't supported by DB but it's confirmed to happen on retail uint32 uiSpeedRate = m_creature->GetSpeedRate(MOVE_RUN); m_creature->SetSpeedRate(MOVE_RUN, SPEED_RATE_RAZORSCALE); m_creature->GetMotionMaster()->MoveFlyOrLand(1, fX, fY, fZ, true); m_creature->SetSpeedRate(MOVE_RUN, uiSpeedRate); // reset timers m_uiPhase = PHASE_AIR; m_uiCurrentHarpoon = 0; m_uiHarpoonsUsed = 0; m_uiRepairHarpoonTimer = 20000; m_uiFireballTimer = 5000; m_uiDevouringFlameTimer = 10000; ++m_uiFlyPhaseCount; // set achiev criteria as failed if (m_uiFlyPhaseCount >= 2 && m_pInstance) m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_QUICK_SHAVE, false); } // make the Trappers evade or move to home position for (GuidList::const_iterator itr = m_lTrappersGuids.begin(); itr != m_lTrappersGuids.end(); ++itr) { if (Creature* pTrapper = m_creature->GetMap()->GetCreature(*itr)) pTrapper->AI()->EnterEvadeMode(); } break; } ++m_uiGroundedStep; } else m_uiGroundedTimer -= uiDiff; // make boss land at 50% hp if (!m_bIsGrounded && m_creature->GetHealthPercent() < 50.0f) { DoScriptText(EMOTE_GROUNDED, m_creature); m_creature->RemoveAurasDueToSpell(SPELL_STUN); m_uiGroundedStep = 1; m_uiGroundedTimer = 0; m_bIsGrounded = true; } break; case PHASE_ONLY_GROUND: if (m_uiDevouringFlameTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, SPELL_DEVOURING_FLAME) == CAST_OK) m_uiDevouringFlameTimer = 10000; } } else m_uiDevouringFlameTimer -= uiDiff; if (m_uiFuseArmorTimer < uiDiff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FUSE_ARMOR) == CAST_OK) m_uiFuseArmorTimer = 13000; } else m_uiFuseArmorTimer -= uiDiff; if (m_uiFlameBuffetTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_FLAME_BUFFET : SPELL_FLAME_BUFFET_H) == CAST_OK) m_uiFlameBuffetTimer = 10000; } else m_uiFlameBuffetTimer -= uiDiff; if (m_uiFlameBreathTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_FLAME_BREATH : SPELL_FLAME_BREATH_H) == CAST_OK) { DoScriptText(EMOTE_BREATH, m_creature); m_uiFlameBreathTimer = 15000; } } else m_uiFlameBreathTimer -= uiDiff; DoMeleeAttackIfReady(); break; } }
void UpdateAI(const uint32 diff) { if (SayTimer <= diff) { if (Event) SayTimer = NextStep(++Step); } else SayTimer -= diff; if (Attack) { Player* player = Unit::GetPlayer(*me, PlayerGUID); me->setFaction(14); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (player) { Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { Creepjack->Attack(player, true); Creepjack->setFaction(14); Creepjack->GetMotionMaster()->MoveChase(player); Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); if (Malone) { Malone->Attack(player, true); Malone->setFaction(14); Malone->GetMotionMaster()->MoveChase(player); Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } DoStartMovement(player); AttackStart(player); } Attack = false; } if (HealthBelowPct(5) && !Done) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveAllAuras(); Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { CAST_CRE(Creepjack)->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); Creepjack->GetMotionMaster()->MoveTargetedHome(); Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); if (Malone) { CAST_CRE(Malone)->AI()->EnterEvadeMode(); Malone->setFaction(1194); Malone->GetMotionMaster()->MoveTargetedHome(); Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } me->setFaction(1194); Done = true; DoScriptText(SAY_GIVEUP, me, NULL); me->DeleteThreatList(); me->CombatStop(); me->GetMotionMaster()->MoveTargetedHome(); Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player) CAST_PLR(player)->GroupEventHappens(QUEST_WBI, me); } DoMeleeAttackIfReady(); }
void HandleFlightSequence() { switch (FlightCount) { case 0: sLog->outError(LOG_FILTER_TSCR, "prevent fly phase"); me->GetMotionMaster()->Clear(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY + MOVEMENTFLAG_ONTRANSPORT); me->StopMoving(); Talk(YELL_TAKEOFF); Timer[EVENT_FLIGHT_SEQUENCE] = 2000; break; case 1: sLog->outError(LOG_FILTER_TSCR, "Move to Fly point"); me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 2: { sLog->outError(LOG_FILTER_TSCR, "Summon Vapor case 2"); Unit* target; target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID)); if (target) { Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if (Vapor) { Vapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); } } else Timer[EVENT_FLIGHT_SEQUENCE] = 10000; break; } case 3: { DespawnSummons(MOB_VAPOR_TRAIL); sLog->outError(LOG_FILTER_TSCR, "Summon Vapor case3"); Unit* target; target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID)); if (target) { Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if (Vapor) { Vapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); } } else Timer[EVENT_FLIGHT_SEQUENCE] = 10000; break; } case 4: DespawnSummons(MOB_VAPOR_TRAIL); Timer[EVENT_FLIGHT_SEQUENCE] = 1; break; case 5: { float x, y, z; GetRandFlyPos(x,y,z); me->GetMotionMaster()->MovePoint(0, x,y,z); Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; } case 6: me->SetOrientation(me->GetAngle(me->GetPositionX(), MIDDLE_Y)); me->StopMoving(); Timer[EVENT_FLIGHT_SEQUENCE] = 10000; break; case 7: me->CastSpell(me, SPELL_FOG_BREATH, true); { float x, y, z; GetNextFlyPos(x,y,z); me->GetMotionMaster()->MovePoint(5, x, y, z); } Timer[EVENT_SUMMON_FOG] = 1; Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 8: me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); BreathCount++; Timer[EVENT_SUMMON_FOG] = 0; Timer[EVENT_FLIGHT_SEQUENCE] = 1; if (BreathCount < 3) FlightCount = 5; break; case 9: if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0)) { float x, y, z; target->GetContactPoint(me, x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); } else { float x,y,z; x = 1435; y = MIDDLE_Y; z = 0; me->UpdateGroundPositionZ(x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); } Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 10: me->SetDisableGravity(true); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); EnterPhase(PHASE_GROUND); DoStartMovement(SelectTarget(SELECT_TARGET_TOPAGGRO, 0)); break; default: break; } FlightCount++; }
void UpdateAI(uint32 const diff) { if(!UpdateVictim()) return; events.Update(diff); if(me->HasUnitState(UNIT_STATE_CASTING)) return; if(uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_CURSE_OF_BLOOD: DoCastVictim(SPELL_CURSE_OF_BLOOD); events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, urand(8000, 10000), 0, PHASE_NORMAL); break; case EVENT_FORCE_GRIP: vehicle->SetVehicleId(VEHICLE_GRIP); DoCastVictim(SPELL_FORCE_GRIP); events.ScheduleEvent(EVENT_FORCE_GRIP, urand(15000, 20000), 0, PHASE_NORMAL); break; case EVENT_GRAVITY_WELL: DoCastRandom(SPELL_SUMMON_GRAVITY_WELL, 100.0f, false); events.ScheduleEvent(EVENT_GRAVITY_WELL, urand(15000, 20000), 0, PHASE_NORMAL); break; case EVENT_SEISMIC_SHARD: if(Unit * target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) { target->GetPosition(&shardPos); DoCast(SPELL_SEISMIC_SHARD_PULL); me->CastSpell(shardPos.GetPositionX(), shardPos.GetPositionY(), shardPos.GetPositionZ(), SPELL_SEISMIC_SHARD_TAR, false); DoCast(SPELL_SEISMIC_SHARD_THROW); events.ScheduleEvent(EVENT_SEISMIC_SHARD_THROW, 3000); } if(seismicShards < 2) { ++seismicShards; events.ScheduleEvent(EVENT_SEISMIC_SHARD, 7000); } break; case EVENT_SEISMIC_SHARD_THROW: if(Unit* passenger = vehicle->GetPassenger((first ? 0 : 1))) { if (passenger) { passenger->ExitVehicle(); passenger->CastSpell(shardPos.GetPositionX(), shardPos.GetPositionY(), shardPos.GetPositionZ(), SPELL_SEISMIC_SHARD_CHARGE, false); passenger->ToCreature()->DespawnOrUnsummon(3000); first = false; } } break; case EVENT_ENERGY_SHIELD: Talk(SAY_SHIELD); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); vehicle->SetVehicleId(VEHICLE_NORMAL); me->SetReactState(REACT_PASSIVE); me->SetUInt64Value(UNIT_FIELD_TARGET, 0); events.SetPhase(PHASE_SHIELD); DoCast(SPELL_ENERGY_SHIELD); seismicShards = 0; events.ScheduleEvent(EVENT_ENERGY_SHIELD_END, 2000); break; case EVENT_ENERGY_SHIELD_END: // fly up me->GetMotionMaster()->MoveJump(me->GetHomePosition(), 30.0f, 30.0f, POINT_PLATFORM); break; case EVENT_SHIELD_PHASE_END: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->RemoveAurasDueToSpell(SPELL_SEISMIC_SHARD); me->RemoveAurasDueToSpell(SPELL_ENERGY_SHIELD); if(Unit * victim = me->GetVictim()) { me->SetReactState(REACT_AGGRESSIVE); DoStartMovement(victim); } events.SetPhase(PHASE_NORMAL); events.RescheduleEvent(EVENT_CURSE_OF_BLOOD, urand(8000, 10000), 0, PHASE_NORMAL); events.RescheduleEvent(EVENT_GRAVITY_WELL, urand(15000, 20000), 0, PHASE_NORMAL); events.RescheduleEvent(EVENT_FORCE_GRIP, urand(10000, 12000), 0, PHASE_NORMAL); events.ScheduleEvent(EVENT_ENERGY_SHIELD, urand(40000, 45000), 0, PHASE_NORMAL); break; case EVENT_ADDS_SUMMON: { if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) { uint8 amount = 3; uint8 pos = urand(0, 1); if(events.IsInPhase(PHASE_SHIELD)) amount = urand(8, 10); for(int i=0; i < amount; ++i) { Position tarPos; me->GetRandomPoint(summonPos[pos], 5.0f, tarPos); if(Creature * summon = me->SummonCreature(NPC_FOLLOWER, tarPos, TEMPSUMMON_DEAD_DESPAWN, 1000)) { summon->AI()->AttackStart(target); summon->AI()->DoZoneInCombat(); } } } events.ScheduleEvent(EVENT_ADDS_SUMMON, urand(10000, 12000)); } break; default: break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_bDelay) { DoStartMovement(m_creature->getVictim()); m_bDelay = false; } if (isTeleported) { if (Teleport_Timer < diff) { m_creature->MonsterTextEmote("%s teleports back into the battle!", 0, true); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, CENTER_Z, 0); m_creature->SendMonsterMove(CENTER_X, CENTER_Y, CENTER_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0); isTeleported = false; m_bDelay = true; Teleport_Timer = 120000; } else Teleport_Timer -= diff; if (SecondPhase_Timer < diff) { m_creature->MonsterTextEmote("%s raises more skeletons!", 0, true); for (uint8 i = 1; i <= (m_bIsRegularMode ? 2 : 4); ++i) { uint32 uiAdd = NPC_PLAGUED_CHAMPION; if (SecondPhaseCounter != 1 && i%2 == 0) uiAdd = NPC_PLAGUED_GUARDIAN; uint8 uiI = urand(0, 4); m_creature->SummonCreature(uiAdd, adds_coords[uiI][0], adds_coords[uiI][1], adds_coords[uiI][2], adds_coords[uiI][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); } SecondPhase_Timer = 35000; } else SecondPhase_Timer -= diff; return; } //Blink_Timer if (!m_bIsRegularMode) if (Blink_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_CRIPPLE); uint8 uiRX = urand(0, 60); uint8 uiRY = urand(0, 60); m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X-30+uiRX, CENTER_Y-30+uiRY, CENTER_Z, 0); m_creature->SendMonsterMove(CENTER_X-30+uiRX, CENTER_Y-30+uiRY, CENTER_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0); if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { DoResetThreat(); AttackStart(pTarget); } Blink_Timer = urand(20000, 30000); m_bDelay = true; } else Blink_Timer -= diff; //Curse_Timer if (Curse_Timer < diff) { DoCast(m_creature->getVictim(), m_bIsRegularMode ? SPELL_CURSE_PLAGUEBRINGER : SPELL_CURSE_PLAGUEBRINGER_H); Curse_Timer = urand (25000, 30000); } else Curse_Timer -= diff; //Summon_Timer if (Summon_Timer < diff) { DoScriptText(SAY_SUMMON, m_creature); m_creature->MonsterTextEmote("%s summons the Skeletal Warriors!", 0, true); for (uint8 i = 0; i < (m_bIsRegularMode ? 2 : 3); ++i) { uint8 uiI = urand(0, 4); m_creature->SummonCreature(NPC_PLAGUED_WARRIOR, adds_coords[uiI][0], adds_coords[uiI][1], adds_coords[uiI][2], adds_coords[uiI][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); } Summon_Timer = 30000; } else Summon_Timer -= diff; if (!m_bIsEnraged) if (Teleport_Timer < diff) if (SecondPhaseCounter < 3) { m_creature->MonsterTextEmote("%s teleports to the balcony above!", 0, true); m_creature->InterruptNonMeleeSpells(false); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->GetMap()->CreatureRelocation(m_creature, BALCONY_X, BALCONY_Y, BALCONY_Z, BALCONY_O); m_creature->SendMonsterMove(BALCONY_X, BALCONY_Y, BALCONY_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0); isTeleported = true; SecondPhase_Timer = 0; Teleport_Timer = 70000; SecondPhaseCounter++; } else { DoCast(m_creature, SPELL_BERSERK); m_bIsEnraged = true; } else Teleport_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) { if (UnsummonCheck < diff && m_creature->isAlive()) m_creature->DisappearAndDie(); else UnsummonCheck -= diff; return; } if (Fireball_Timer <= diff) { if (Unit *victim = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(victim, SPELL_FIREBALL,true); Fireball_Timer = urand(4000,7000); } else Fireball_Timer -= diff; if (flight) // phase 1 - the flight { Creature *Vazruden = Unit::GetCreature(*m_creature,VazrudenGUID); if (Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth()))) { flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->GetMotionMaster()->Clear(); if (Unit *victim = SelectUnit(SELECT_TARGET_NEAREST,0)) m_creature->AI()->AttackStart(victim); DoStartMovement(m_creature->getVictim()); DoScriptText(EMOTE, m_creature); return; } else Fly_Timer -= diff; if (Turn_Timer <= diff) { uint32 waypoint = (Fly_Timer/10000)%2; if (m_creature->IsWithinDist3d(VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2], 5)) m_creature->GetMotionMaster()->MovePoint(0,VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2]); Turn_Timer = 10000; } else Turn_Timer -= diff; } else // phase 2 - land fight { if (ConeOfFire_Timer <= diff) { DoCast(m_creature, SPELL_CONE_OF_FIRE); ConeOfFire_Timer = 12000; Fireball_Timer = 4000; } else ConeOfFire_Timer -= diff; if (HeroicMode && BellowingRoar_Timer <= diff) { DoCast(m_creature, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; } else BellowingRoar_Timer -= diff; DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (WaitTimer) if (WaitTimer <= diff) { if (Intro) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (MovePhase >= 7) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); } else { me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]); ++MovePhase; } } if (Flying) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (MovePhase >= 7) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); } else { me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]); ++MovePhase; } } WaitTimer = 0; } else WaitTimer -= diff; if (!UpdateVictim()) return; if (Flying) return; // Phase 1 "GROUND FIGHT" if (Phase == 1) { if (Movement) { DoStartMovement(me->getVictim()); Movement = false; } if (BellowingRoarTimer <= diff) { DoCast(me->getVictim(), SPELL_BELLOWING_ROAR); BellowingRoarTimer = urand(30000, 40000); } else BellowingRoarTimer -= diff; if (SmolderingBreathTimer <= diff) { DoCast(me->getVictim(), SPELL_SMOLDERING_BREATH); SmolderingBreathTimer = 20000; } else SmolderingBreathTimer -= diff; if (DistractingAshTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_DISTRACTING_ASH); DistractingAshTimer = urand(15000, 28000); //timer wrong } else DistractingAshTimer -= diff; if (CharredEarthTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_CHARRED_EARTH); CharredEarthTimer = 20000; } else CharredEarthTimer -= diff; if (TailSweepTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) if (!me->HasInArc(float(M_PI), pTarget)) DoCast(pTarget, SPELL_TAIL_SWEEP); TailSweepTimer = 15000; } else TailSweepTimer -= diff; if (SearingCindersTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_SEARING_CINDERS); SearingCindersTimer = 10000; } else SearingCindersTimer -= diff; uint32 Prozent; Prozent = (me->GetHealth() * 100) / me->GetMaxHealth(); if (Prozent < 75 && FlyCount == 0) // first take off 75% TakeOff(); if (Prozent < 50 && FlyCount == 1) // secound take off 50% TakeOff(); if (Prozent < 25 && FlyCount == 2) // third take off 25% TakeOff(); DoMeleeAttackIfReady(); } //Phase 2 "FLYING FIGHT" if (Phase == 2) { if (!RainBones) { if (RainofBonesTimer <= diff && !RainBones) // only once at the beginning of phase 2 { if (!Skeletons) { for (int i = 0; i < 6; i++) DoCast(me->getVictim(), SPELL_SUMMON_SKELETON, true); RainofBonesTimer = 10000; Skeletons = true; } DoCast(me->getVictim(), SPELL_RAIN_OF_BONES); RainBones = true; SmokingBlastTimer = 20000; } else RainofBonesTimer -= diff; } if (RainBones) { if (SmokingBlastTimer <= diff) { DoCast(me->getVictim(), SPELL_SMOKING_BLAST); SmokingBlastTimer = 1500; //timer wrong } else SmokingBlastTimer -= diff; } if (FireballBarrageTimer <= diff) { Map *map = me->GetMap(); if (!map->IsDungeon()) return; Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (Player* i_pl = i->GetSource()) if (i_pl->IsAlive() && !me->IsWithinDistInMap(i_pl, 80)) { DoCast(i_pl, SPELL_FIREBALL_BARRAGE); } } FireballBarrageTimer = 20000; } else FireballBarrageTimer -= diff; if (FlyTimer <= diff) //landing { bool bChance = urand(0, 1); if (bChance) me->MonsterYell(YELL_LAND_PHASE_1, LANG_UNIVERSAL, NULL); else me->MonsterYell(YELL_LAND_PHASE_2, LANG_UNIVERSAL, NULL); me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MovePoint(3, IntroWay[3][0], IntroWay[3][1], IntroWay[3][2]); Flying = true; } else FlyTimer -= diff; } }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; if (Fireball_Timer <= diff) { if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(victim, SPELL_FIREBALL, true); Fireball_Timer = urand(4000, 7000); } else Fireball_Timer -= diff; if (flight) // phase 1 - the flight { Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20))) { flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; me->SetDisableGravity(false); me->SetWalk(true); me->GetMotionMaster()->Clear(); if (Unit* victim = SelectTarget(SELECT_TARGET_NEAREST, 0)) AttackStart(victim); DoStartMovement(me->GetVictim()); Talk(EMOTE); return; } else Fly_Timer -= diff; if (Turn_Timer <= diff) { uint32 waypoint = (Fly_Timer/10000)%2; if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5)) me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]); Turn_Timer = 10000; } else Turn_Timer -= diff; } else // phase 2 - land fight { if (ConeOfFire_Timer <= diff) { DoCast(me, SPELL_CONE_OF_FIRE); ConeOfFire_Timer = 12000; Fireball_Timer = 4000; } else ConeOfFire_Timer -= diff; if (IsHeroic()) { if (BellowingRoar_Timer <= diff) { DoCast(me, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; } else BellowingRoar_Timer -= diff; } DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (m_checkTimer < diff) { if (me->IsWithinDistInMap(&wLoc, 100.0f)) DoZoneInCombat(); else { EnterEvadeMode(); return; } uint32 damage = 0; SharedRule(damage); me->SetSpeed(MOVE_RUN, 2.0); // move always after stun recovery if (!me->hasUnitState(UNIT_STAT_STUNNED) && !me->HasAura(SPELL_VANISH, 1)) DoStartMovement(me->getVictim()); m_checkTimer = 1000; } else m_checkTimer -= diff; if (m_vanishTimer < diff) { if (me->HasAuraType(SPELL_AURA_MOD_STUN)) // remove stun me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STUN); if (me->HasAuraType(SPELL_AURA_MOD_STALKED)) // remove Hunter's Marks and similar trackers me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED); me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); ForceSpellCast(me, SPELL_VANISH, INTERRUPT_AND_CAST_INSTANTLY); ForceSpellCast(me, SPELL_DEADLY_POISON, INTERRUPT_AND_CAST_INSTANTLY); Position dest; if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 35.0f, true)) target->GetValidPointInAngle(dest, 5.0f, frand(0.0f, 2*M_PI), true); else me->GetValidPointInAngle(dest, 30.0f, frand(0.0f, 2*M_PI), true); DoTeleportTo(dest.x, dest.y, dest.z); // drop movement :P me->GetMotionMaster()->MoveIdle(); m_vanishTimer = 60000; } else m_vanishTimer -= diff; if (me->HasAura(SPELL_VANISH, 1)) return; DoMeleeAttackIfReady(); CastNextSpellIfAnyAndReady(); }
void UpdateAI(uint32 diff) { if (Intro) { if (MovePhase) { if (MovePhase >= 7) { me->SetDisableGravity(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); } else { me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]); } MovePhase = 0; } return; } if (Flying && MovePhase) { if (MovePhase >= 7) { me->SetDisableGravity(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); } else me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]); MovePhase = 0; } if (!UpdateVictim()) return; if (Flying) return; // Phase 1 "GROUND FIGHT" if (Phase == 1) { if (Movement) { DoStartMovement(me->GetVictim()); Movement = false; } if (BellowingRoarTimer <= diff) { DoCastVictim(SPELL_BELLOWING_ROAR); BellowingRoarTimer = urand(30000, 40000); } else BellowingRoarTimer -= diff; if (SmolderingBreathTimer <= diff) { DoCastVictim(SPELL_SMOLDERING_BREATH); SmolderingBreathTimer = 20000; } else SmolderingBreathTimer -= diff; if (CharredEarthTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(target, SPELL_CHARRED_EARTH); CharredEarthTimer = 20000; } else CharredEarthTimer -= diff; if (TailSweepTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) if (!me->HasInArc(M_PI, target)) DoCast(target, SPELL_TAIL_SWEEP); TailSweepTimer = 15000; } else TailSweepTimer -= diff; if (SearingCindersTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(target, SPELL_SEARING_CINDERS); SearingCindersTimer = 10000; } else SearingCindersTimer -= diff; uint32 Prozent = uint32(me->GetHealthPct()); if (Prozent < 75 && FlyCount == 0) // first take off 75% TakeOff(); if (Prozent < 50 && FlyCount == 1) // secound take off 50% TakeOff(); if (Prozent < 25 && FlyCount == 2) // third take off 25% TakeOff(); DoMeleeAttackIfReady(); } //Phase 2 "FLYING FIGHT" if (Phase == 2) { if (!RainBones) { if (!Skeletons) { for (uint8 i = 0; i <= 3; ++i) { DoCastVictim(SPELL_SUMMON_SKELETON); Skeletons = true; } } if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 { DoCastVictim(SPELL_RAIN_OF_BONES); RainBones = true; SmokingBlastTimer = 20000; } else RainofBonesTimer -= diff; if (DistractingAshTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(target, SPELL_DISTRACTING_ASH); DistractingAshTimer = 2000; //timer wrong } else DistractingAshTimer -= diff; } if (RainBones) { if (SmokingBlastTimer <= diff) { DoCastVictim(SPELL_SMOKING_BLAST); SmokingBlastTimer = 1500; //timer wrong } else SmokingBlastTimer -= diff; } if (FireballBarrageTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0)) DoCast(target, SPELL_FIREBALL_BARRAGE); FireballBarrageTimer = 20000; } else FireballBarrageTimer -= diff; if (FlyTimer <= diff) //landing { Talk(YELL_LAND_PHASE); me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MovePoint(3, IntroWay[3][0], IntroWay[3][1], IntroWay[3][2]); Flying = true; } else FlyTimer -= diff; } }
void MovementInform(uint32 uiMoveType, uint32 uiPointId) override { if (uiMoveType != POINT_MOTION_TYPE) return; switch (uiPointId) { case PHASE_GROUND: m_creature->SetWalk(false); // ToDo: start WP movement here. Currently disabled because of some MMaps issues // m_creature->GetMotionMaster()->MoveWaypoint(); break; case PHASE_AIR: // switch from ground transition to flight phase m_uiPhase = PHASE_AIR; break; case SUBPHASE_VAPOR: // After the third breath land and resume phase 1 if (m_uiCorruptionCount == 3) { m_uiPhase = PHASE_TRANSITION; float fGroundZ = m_creature->GetMap()->GetHeight(m_creature->GetPhaseMask(), m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); m_creature->GetMotionMaster()->MovePoint(PHASE_TRANSITION, m_creature->getVictim()->GetPositionX(), m_creature->getVictim()->GetPositionY(), fGroundZ, false); return; } // prepare to move to flight trigger ++m_uiCorruptionCount; m_uiCorruptionTimer = 5000; m_uiSubPhase = SUBPHASE_BREATH_PREPARE; break; case SUBPHASE_BREATH_PREPARE: // move across the arena if (!m_pInstance) return; // Fly to the other side, casting the breath. Keep the same trigger index if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->SelectFelmystFlightTrigger(!m_bIsLeftSide, m_uiCorruptionIndex))) { DoScriptText(EMOTE_DEEP_BREATH, m_creature); DoCastSpellIfCan(m_creature, SPELL_SPEED_BURST, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_FOG_CORRUPTION, CAST_TRIGGERED); m_creature->GetMotionMaster()->MovePoint(SUBPHASE_BREATH_MOVE, pTrigger->GetPositionX(), pTrigger->GetPositionY(), pTrigger->GetPositionZ(), false); } break; case SUBPHASE_BREATH_MOVE: if (!m_pInstance) return; // remove speed aura m_creature->RemoveAurasDueToSpell(SPELL_SPEED_BURST); // Get to the flight trigger on the same side of the arena if (Creature* pTrigger = m_pInstance->GetSingleCreatureFromStorage(!m_bIsLeftSide ? NPC_FLIGHT_TRIGGER_LEFT : NPC_FLIGHT_TRIGGER_RIGHT)) m_creature->GetMotionMaster()->MovePoint(SUBPHASE_VAPOR, pTrigger->GetPositionX(), pTrigger->GetPositionY(), pTrigger->GetPositionZ(), false); // switch sides m_bIsLeftSide = !m_bIsLeftSide; break; case PHASE_TRANSITION: // switch back to ground combat from flight transition m_uiPhase = PHASE_GROUND; SetCombatMovement(true); m_creature->SetLevitate(false); DoStartMovement(m_creature->getVictim()); break; } }
void UpdateAI(const uint32 diff) { if (isTeleported) { if (Teleport_Timer < diff) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->GetMap()->CreatureRelocation(m_creature, LastX, LastY, LastZ, 0); m_creature->SendMonsterMove(LastX, LastY, LastZ, 0, MONSTER_MOVE_NONE, 0); DoStartMovement(m_creature->getVictim()); LastX = 0; LastY = 0; LastZ = 0; isTeleported = false; Teleport_Timer = 120000; }else Teleport_Timer -= diff; if (SecondPhase_Timer < diff) { switch (SecondPhaseCounter) { case 0: for(uint8 i = 0; i < (m_bIsHeroicMode ? 4 : 2); i++) m_creature->SummonCreature(NPC_PLAGUED_CHAMPIONS,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); break; case 1: case 2: for(uint8 i = 0; i < (m_bIsHeroicMode ? 4 : 2) - (m_bIsHeroicMode ? 2 : 1); i++) m_creature->SummonCreature(NPC_PLAGUED_CHAMPIONS,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); for(uint8 i = 0; i < (m_bIsHeroicMode ? 2 : 1); i++) m_creature->SummonCreature(NPC_PLAGUED_GUARDIANS,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); break; } SecondPhaseCounter ++; SecondPhase_Timer = 22000; } else SecondPhase_Timer -= diff; return; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; //Blink_Timer if (Blink_Timer < diff) { DoCast(m_creature->getVictim(), m_bIsHeroicMode ? SPELL_CRIPPLE_H : SPELL_CRIPPLE); //DoCast(m_creature, SPELL_BLINK); m_creature->GetMap()->CreatureRelocation(m_creature, 2670.804 + rand()%30, -3517.517 + rand()%30, 261.313, m_creature->GetOrientation()); DoResetThreat(); if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) AttackStart(pTarget); Blink_Timer = 25000; }else Blink_Timer -= diff; //Curse_Timer if (Curse_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_CURSE_PLAGUEBRINGER); Curse_Timer = 28000; }else Curse_Timer -= diff; //Summon_Timer if (Summon_Timer < diff) { DoScriptText(SAY_SUMMON, m_creature); for(uint8 i = 0; i < (m_bIsHeroicMode ? 3 : 2); ++i) m_creature->SummonCreature(NPC_PLAGUED_WARRIOR, 2672.804 + rand()%15,-3509.517 + rand()%15, 261.313, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 80000); Summon_Timer = 30000; } else Summon_Timer -= diff; if (Teleport_Timer < diff) { m_creature->InterruptNonMeleeSpells(true); LastX = m_creature->GetPositionX(); LastY = m_creature->GetPositionY(); LastZ = m_creature->GetPositionZ(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); m_creature->GetMap()->CreatureRelocation(m_creature, TELE_X, TELE_Y, TELE_Z, TELE_O); m_creature->SendMonsterMove(TELE_X, TELE_Y, TELE_Z, TELE_O, MONSTER_MOVE_NONE, 0); isTeleported = true; SecondPhaseCounter = 0; SecondPhase_Timer = 0; Teleport_Timer = 70000; return; }else Teleport_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_STALACTITE: events.DelayEvents(20000); me->SetReactState(REACT_PASSIVE); me->SetUInt64Value(UNIT_FIELD_TARGET, 0); me->GetMotionMaster()->Clear(); me->SetHover(true); me->SendMovementHover(); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); events.ScheduleEvent(EVENT_STALACTITE_CAST, 3000); events.ScheduleEvent(EVENT_STALACTITE_LAND, 13000); break; case EVENT_STALACTITE_CAST: me->SetCanFly(true); me->SetDisableGravity(true); me->MonsterMoveWithSpeed(x,y,z + 10.0f, 0, false , false); me->AddAura(SPELL_STALACTITE, me); break; case EVENT_STALACTITE_LAND: me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->SetHover(false); me->SendMovementHover(); if (IsHeroic()) { events.ScheduleEvent(EVENT_CRYSTAL_STORM, 4000); events.ScheduleEvent(EVENT_STALACTITE_LAND_END, 8000); } else events.ScheduleEvent(EVENT_STALACTITE_LAND_END, 1500); break; case EVENT_STALACTITE_LAND_END: me->SetReactState(REACT_AGGRESSIVE); if (Unit * victim = me->GetVictim()) { me->SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); DoStartMovement(victim); } events.ScheduleEvent(EVENT_STALACTITE, urand(25000, 30000)); break; case EVENT_SAND_BLAST: DoCast(SPELL_SAND_BLAST); events.ScheduleEvent(EVENT_SAND_BLAST, urand(12000, 15000)); break; case EVENT_LAVA_FISSURE: { DoCastRandom(SPELL_LAVA_FISSURE, 0.0f); uint32 cd = IsHeroic() ? urand(5000, 7000) : urand(7000, 10000); events.ScheduleEvent(EVENT_LAVA_FISSURE, cd); } break; case EVENT_CRYSTAL_STORM: if (Unit * victim = me->GetVictim()) me->SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); DoCast(me, SPELL_CRYSTAL_STORM_REQ, true); DoCast(me, SPELL_CRYSTAL_STORM, false); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) 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_STATE_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* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); if (target && !target->isCharmed() && (chained.find(target->GetGUID()) == chained.end())) { DoCast(target, SPELL_CHAINS_OF_KELTHUZAD); float scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X); chained.insert(std::make_pair(target->GetGUID(), scale)); target->SetObjectScale(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(*me, (*itr).first)) { if (!player->isCharmed()) { player->SetObjectScale((*itr).second); std::map<uint64, float>::iterator next = itr; ++next; chained.erase(itr); itr = next; continue; } if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) { switch (player->getClass()) { case CLASS_DRUID: if (urand(0, 1)) player->CastSpell(target, SPELL_MOONFIRE, false); else player->CastSpell(me, SPELL_LIFEBLOOM, false); break; case CLASS_HUNTER: player->CastSpell(target, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); break; case CLASS_MAGE: player->CastSpell(target, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); break; case CLASS_WARLOCK: player->CastSpell(target, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); break; case CLASS_WARRIOR: player->CastSpell(target, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); break; case CLASS_PALADIN: if (urand(0, 1)) player->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); else player->CastSpell(me, SPELL_HOLY_SHOCK, false); break; case CLASS_PRIEST: if (urand(0, 1)) player->CastSpell(target, SPELL_VAMPIRIC_TOUCH, false); else player->CastSpell(me, SPELL_RENEW, false); break; case CLASS_SHAMAN: if (urand(0, 1)) player->CastSpell(target, SPELL_EARTH_SHOCK, false); else player->CastSpell(me, SPELL_HEALING_WAVE, false); break; case CLASS_ROGUE: player->CastSpell(target, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); break; case CLASS_DEATH_KNIGHT: if (urand(0, 1)) player->CastSpell(target, SPELL_PLAGUE_STRIKE, true); else player->CastSpell(target, 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* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_FISURE); events.RepeatEvent(urand(10000, 45000)); break; case EVENT_BLAST: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true)) DoCast(target, SPELL_FROST_BLAST); if (rand()%2) DoScriptText(SAY_FROST_BLAST, me); events.RepeatEvent(urand(30000, 90000)); break; default: events.PopEvent(); break; } } DoMeleeAttackIfReady(); } }
void HandleFlightSequence() { switch(FlightCount) { case 0: //me->AttackStop(); sLog->outError("prevent fly phase"); me->GetMotionMaster()->Clear(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); me->StopMoving(); DoScriptText(YELL_TAKEOFF, me); Timer[EVENT_FLIGHT_SEQUENCE] = 2000; break; case 1: sLog->outError("Move to Fly point"); me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 2: { sLog->outError("Summon Vapor case 2"); Unit* target; target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if(!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID)); if(target) { Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if(Vapor) { Vapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); } } else { //EnterEvadeMode(); //return; } Timer[EVENT_FLIGHT_SEQUENCE] = 10000; break; } case 3: { DespawnSummons(MOB_VAPOR_TRAIL); sLog->outError("Summon Vapor case3"); //me->CastSpell(me, SPELL_VAPOR_SELECT); need core support Unit* target; target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if(!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID)); if(target) { //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if(Vapor) { Vapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); } } else { //EnterEvadeMode(); //return; } Timer[EVENT_FLIGHT_SEQUENCE] = 10000; break; } case 4: DespawnSummons(MOB_VAPOR_TRAIL); Timer[EVENT_FLIGHT_SEQUENCE] = 1; break; case 5: { //Unit* target; //target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); //if(!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID)); //if(target) //{ //BreathX = target->GetPositionX(); //BreathY = target->GetPositionY(); float x, y, z; //target->GetContactPoint(me, x, y, z, 70); GetRandFlyPos(x,y,z); me->GetMotionMaster()->MovePoint(0, x,y,z); //if(rand()%2 == 0) // me->GetMotionMaster()->MovePoint(0, FLIGHT_1_X , FLIGHT_1_Y, FLIGHT_1_Z); //else // me->GetMotionMaster()->MovePoint(0, FLIGHT_2_X , FLIGHT_2_Y, FLIGHT_2_Z); //}else //{ // EnterEvadeMode(); // return; //} Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; } case 6: //me->SetOrientation(me->GetAngle(BreathX, BreathY)); me->SetOrientation(me->GetAngle(me->GetPositionX(), MIDDLE_Y)); me->StopMoving(); //DoTextEmote("takes a deep breath.", NULL); Timer[EVENT_FLIGHT_SEQUENCE] = 10000; break; case 7: me->CastSpell(me, SPELL_FOG_BREATH, true); { float x, y, z; GetNextFlyPos(x,y,z); //me->GetPosition(x, y, z); //x = 2 * BreathX - x; //y = 2 * BreathY - y; //if(me->GetPositionY() > 600) // me->GetMotionMaster()->MovePoint(0, FLIGHT_1_X , FLIGHT_1_Y, FLIGHT_1_Z); //else // me->GetMotionMaster()->MovePoint(0, FLIGHT_2_X , FLIGHT_2_Y, FLIGHT_2_Z); me->GetMotionMaster()->MovePoint(5, x,y,z); } Timer[EVENT_SUMMON_FOG] = 1; Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 8: me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); BreathCount++; Timer[EVENT_SUMMON_FOG] = 0; Timer[EVENT_FLIGHT_SEQUENCE] = 1; if(BreathCount < 3) FlightCount = 5; break; case 9: if(Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0)) { float x, y, z; target->GetContactPoint(me, x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); } else { float x,y,z; x = 1435; y = MIDDLE_Y; z = 0; me->UpdateGroundPositionZ(x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); //EnterEvadeMode(); //return; } Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 10: me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); me->StopMoving(); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); EnterPhase(PHASE_GROUND); //me->AI()->AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO, 0)); DoStartMovement(SelectTarget(SELECT_TARGET_TOPAGGRO, 0)); break; default: break; } FlightCount++; }
void UpdateAI(uint32 const diff) { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BONE_SPIKE_GRAVEYARD: if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM)) DoCast(me, SPELL_BONE_SPIKE_GRAVEYARD); events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL); break; case EVENT_COLDFLAME: _coldflameLastPos.Relocate(me); _coldflameTarget = 0LL; if (!me->HasAura(SPELL_BONE_STORM)) DoCastAOE(SPELL_COLDFLAME_NORMAL); else DoCast(me, SPELL_COLDFLAME_BONE_STORM); events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL); break; case EVENT_WARN_BONE_STORM: _boneSlice = false; Talk(EMOTE_BONE_STORM); me->FinishSpell(CURRENT_MELEE_SPELL, false); DoCast(me, SPELL_BONE_STORM); events.DelayEvents(3000, EVENT_GROUP_SPECIAL); events.ScheduleEvent(EVENT_BONE_STORM_BEGIN, 3050); events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(90000, 95000)); break; case EVENT_BONE_STORM_BEGIN: if (Aura* pStorm = me->GetAura(SPELL_BONE_STORM)) pStorm->SetDuration(int32(_boneStormDuration)); me->SetSpeed(MOVE_RUN, _baseSpeed*3.0f, true); Talk(SAY_BONE_STORM); events.ScheduleEvent(EVENT_BONE_STORM_END, _boneStormDuration+1); // no break here case EVENT_BONE_STORM_MOVE: { events.ScheduleEvent(EVENT_BONE_STORM_MOVE, _boneStormDuration/3); Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)); if (!unit) unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); if (unit) me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); break; } case EVENT_BONE_STORM_END: if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); DoStartMovement(me->getVictim()); me->SetSpeed(MOVE_RUN, _baseSpeed, true); events.CancelEvent(EVENT_BONE_STORM_MOVE); events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); if (!IsHeroic()) events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL); break; case EVENT_ENABLE_BONE_SLICE: _boneSlice = true; break; case EVENT_ENRAGE: DoCast(me, SPELL_BERSERK, true); Talk(SAY_BERSERK); break; } } // We should not melee attack when storming if (me->HasAura(SPELL_BONE_STORM)) return; // 10 seconds since encounter start Bone Slice replaces melee attacks if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL)) DoCastVictim(SPELL_BONE_SLICE); DoMeleeAttackIfReady(); }
void UpdateAI(uint32 const diff) { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CHECK_PLAYERS: instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TANK_MARKER); events.ScheduleEvent(EVENT_CHECK_PLAYERS, 2000); break; case EVENT_PREPARE_BONE_SPIKE_GRAVEYARD: events.CancelEvent(EVENT_CHECK_PLAYERS); break; case EVENT_BONE_SPIKE_GRAVEYARD: if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM)) DoCast(me, SPELL_BONE_SPIKE_GRAVEYARD); events.ScheduleEvent(EVENT_PREPARE_BONE_SPIKE_GRAVEYARD, 12000, EVENT_GROUP_SPECIAL); events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, 18000, EVENT_GROUP_SPECIAL); events.ScheduleEvent(EVENT_CHECK_PLAYERS, 4000); break; case EVENT_COLDFLAME: _coldflameLastPos.Relocate(me); _coldflameTarget = 0LL; if (!me->HasAura(SPELL_BONE_STORM)) DoCastAOE(SPELL_COLDFLAME_NORMAL); else DoCast(me, SPELL_COLDFLAME_BONE_STORM); events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL); break; case EVENT_WARN_BONE_STORM: _boneSlice = false; Talk(EMOTE_BONE_STORM); me->FinishSpell(CURRENT_MELEE_SPELL, false); DoCast(me, SPELL_BONE_STORM); events.DelayEvents(3000, EVENT_GROUP_SPECIAL); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); events.ScheduleEvent(EVENT_BONE_STORM_BEGIN, 3050); events.ScheduleEvent(EVENT_WARN_BONE_STORM, 90000); break; case EVENT_BONE_STORM_BEGIN: if (AuraPtr pStorm = me->GetAura(SPELL_BONE_STORM)) pStorm->SetDuration(int32(_boneStormDuration)); me->SetSpeed(MOVE_RUN, _baseSpeed*3.0f, true); Talk(SAY_BONE_STORM); events.ScheduleEvent(EVENT_BONE_STORM_END, _boneStormDuration+1); // no break here case EVENT_BONE_STORM_MOVE: { events.ScheduleEvent(EVENT_BONE_STORM_MOVE, IsHeroic() ? _boneStormDuration/5 : _boneStormDuration/4); Unit* unit = SelectTarget(SELECT_TARGET_FARTHEST, 0, 60.0f); if (!unit || unit->isPet() || unit->isTotem() || !me->IsWithinLOSInMap(unit)) unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); if (unit) if (unit->isPet() || unit->isTotem() || !me->IsWithinLOSInMap(unit)) unit = SelectTarget(SELECT_TARGET_RANDOM, 1); else me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); break; } case EVENT_BONE_STORM_END: if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); DoStartMovement(me->getVictim()); me->SetSpeed(MOVE_RUN, _baseSpeed, true); events.CancelEvent(EVENT_BONE_STORM_MOVE); events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); if (!IsHeroic()) events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, 15000, EVENT_GROUP_SPECIAL); break; case EVENT_ENABLE_BONE_SLICE: _boneSlice = true; break; case EVENT_BERSERK: DoCast(me, SPELL_BERSERK, true); Talk(SAY_BERSERK); break; } } // We should not melee attack when storming if (me->HasAura(SPELL_BONE_STORM)) return; // 10 seconds since encounter start Bone Slice replaces melee attacks if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL)) DoCastVictim(SPELL_BONE_SLICE); DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (Phase == NORMAL) { if (!bMove && uiMoveTimer > diff) { uiMoveTimer -= diff; return; } else if (!bMove) { DoStartMovement(me->getVictim()); pSacrificeTarget = NULL; bMove = true; } //Return since we have no target if (!UpdateVictim()) return; if (uiSinsterStrikeTimer <= diff) { DoCast(me->getVictim(), DUNGEON_MODE(SPELL_SINISTER_STRIKE, H_SPELL_SINISTER_STRIKE)); uiSinsterStrikeTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); } else uiSinsterStrikeTimer -= diff; if (uiCallFlamesTimer <= diff) //move to send event scripts? { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { if (!bFlames) { DoCast(target, SPELL_CALL_FLAMES); bFlames = true; } if (uiFlamesCount < 3) { if (Creature* pBrazier = Creature::GetCreature(*me, RAND(uiFlameBrazier_1, uiFlameBrazier_2))) { if (IsHeroic()) // find correct spell { int dmg = 3825 + rand()%1350; pBrazier->CastCustomSpell(pBrazier, SPELL_BALL_OF_FLAME, &dmg, 0, 0, true); } else pBrazier->CastSpell(pBrazier, SPELL_BALL_OF_FLAME, true); } uiCallFlamesTimer = 1*IN_MILLISECONDS; ++uiFlamesCount; } else { bFlames = false; uiCallFlamesTimer = urand(8 * IN_MILLISECONDS, 12 * IN_MILLISECONDS); uiFlamesCount = 0; } } } else uiCallFlamesTimer -= diff; if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*uiHealthAmountModifier))) { ++uiHealthAmountModifier; pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (pSacrificeTarget) { DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1, SAY_SACRIFICE_PLAYER_2, SAY_SACRIFICE_PLAYER_3, SAY_SACRIFICE_PLAYER_4, SAY_SACRIFICE_PLAYER_5), me); me->GetMotionMaster()->Clear(); DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD); DoTeleportPlayer(pSacrificeTarget, 296.632f, -346.075f, 90.63f, 4.6f); Phase = SACRIFICING; for (uint8 i = 0; i < 3; ++i) if (Creature* pRitualChanneler = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 100*HOUR)) if (pRitualChanneler->AI()) pRitualChanneler->AI()->SetGUID(pSacrificeTarget->GetGUID()); } } DoMeleeAttackIfReady(); } else //SACRIFICING { if (uiSacrificeTimer <= diff) { Creature* target = Creature::GetCreature(*me, uiRitualTarget); if (target) { DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true); DoCast(me, SPELL_RITUAL_OF_THE_SWORD_DISARM, true); } bMove = false; Phase = NORMAL; uiMoveTimer = 23*IN_MILLISECONDS; uiSacrificeTimer = 2*IN_MILLISECONDS; uiSinsterStrikeTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); uiCallFlamesTimer = urand(13*IN_MILLISECONDS, 18*IN_MILLISECONDS); } else uiSacrificeTimer -= diff; } }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // Start drinking when below 20% mana if (!m_bIsDrinking && m_creature->getPowerType() == POWER_MANA && (m_creature->GetPower(POWER_MANA) * 100 / m_creature->GetMaxPower(POWER_MANA)) < 20) { if (DoCastSpellIfCan(m_creature, SPELL_MASS_POLYMORPH) == CAST_OK) { DoScriptText(SAY_DRINK, m_creature); SetCombatMovement(false); m_creature->GetMotionMaster()->MoveIdle(); m_uiManaRecoveryStage = 0; m_uiManaRecoveryTimer = 2000; m_bDrinkInturrupted = false; m_bIsDrinking = true; return; } } if (m_bIsDrinking) { // Do the mana recovery process if (m_uiManaRecoveryTimer < uiDiff) { switch (m_uiManaRecoveryStage) { case 0: if (DoCastSpellIfCan(m_creature, SPELL_CONJURE_WATER) == CAST_OK) m_uiManaRecoveryTimer = 2000; break; case 1: if (DoCastSpellIfCan(m_creature, SPELL_DRINK) == CAST_OK) { m_creature->SetStandState(UNIT_STAND_STATE_SIT); m_uiManaRecoveryTimer = 5000; } break; case 2: if (DoCastSpellIfCan(m_creature, SPELL_PYROBLAST) == CAST_OK) { SetCombatMovement(true); DoStartMovement(m_creature->getVictim()); m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_uiManaRecoveryTimer = 2000; m_bIsDrinking = false; } break; } ++m_uiManaRecoveryStage; } else m_uiManaRecoveryTimer -= uiDiff; // no other spells during mana recovery return; } // Normal spell casts if (m_uiNormalCastTimer < uiDiff) { if (!m_creature->IsNonMeleeSpellCasted(false)) { Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (!pTarget) return; uint8 uiCurrentSpell = urand(0, 2); uint32 uiCurrentSpellId = 0; // randomize so it won't be the same spell twice in a row while (uiCurrentSpell == m_uiLastNormalSpell) uiCurrentSpell = urand(0, 2); m_uiLastNormalSpell = uiCurrentSpell; switch (uiCurrentSpell) { case 0: uiCurrentSpellId = SPELL_ARCANE_MISSILES; m_uiNormalCastTimer = urand(6000, 7000); break; case 1: uiCurrentSpellId = SPELL_FIREBALL; m_uiNormalCastTimer = urand(2000, 3000); break; case 2: uiCurrentSpellId = SPELL_FROSTBOLT; m_uiNormalCastTimer = urand(2000, 3000); break; } if (uiCurrentSpellId) DoCastSpellIfCan(pTarget, uiCurrentSpellId); } } else m_uiNormalCastTimer -= uiDiff; // Secondary spells if (m_uiSecondarySpellTimer < uiDiff) { CanCastResult spellResult = CAST_OK; switch (urand(0, 1)) { case 0: spellResult = DoCastSpellIfCan(m_creature, SPELL_COUNTERSPELL); break; case 1: if (Unit* pUnit = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) spellResult = DoCastSpellIfCan(pUnit, SPELL_CHAINS_OF_ICE); break; } if (spellResult == CAST_OK) m_uiSecondarySpellTimer = urand(5000, 20000); } else m_uiSecondarySpellTimer -= uiDiff; if (m_uiSuperCastTimer < uiDiff) { if (!m_creature->IsNonMeleeSpellCasted(false)) { uint8 uiAvailableSpell = urand(SUPER_FLAME_WREATH, SUPER_ARCANE_EXPL); // randomize so it won't be the same spell twice in a row while (uiAvailableSpell == m_uiLastSuperSpell) uiAvailableSpell = urand(SUPER_FLAME_WREATH, SUPER_ARCANE_EXPL); m_uiLastSuperSpell = uiAvailableSpell; switch (m_uiLastSuperSpell) { case SUPER_ARCANE_EXPL: if (DoCastSpellIfCan(m_creature, SPELL_ARCANE_EXPLOSION) == CAST_OK) { DoCastSpellIfCan(m_creature, SPELL_BLINK_CENTER, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_MASSIVE_MAGNETIC_PULL, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_MASS_SLOW, CAST_TRIGGERED); DoScriptText(urand(0, 1) ? SAY_EXPLOSION1 : SAY_EXPLOSION2, m_creature); } break; case SUPER_FLAME_WREATH: if (DoCastSpellIfCan(m_creature, SPELL_FLAME_WREATH) == CAST_OK) DoScriptText(urand(0, 1) ? SAY_FLAMEWREATH1 : SAY_FLAMEWREATH2, m_creature); break; case SUPER_BLIZZARD: if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_BLIZZARD) == CAST_OK) DoScriptText(urand(0, 1) ? SAY_BLIZZARD1 : SAY_BLIZZARD2, m_creature); break; } m_uiSuperCastTimer = 30000; } } else m_uiSuperCastTimer -= uiDiff; if (!m_bElementalsSpawned && m_creature->GetHealthPercent() < 40.0f) { DoCastSpellIfCan(m_creature, SPELL_SUMMON_WATER_ELEM_1, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SUMMON_WATER_ELEM_2, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SUMMON_WATER_ELEM_3, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SUMMON_WATER_ELEM_4, CAST_TRIGGERED); DoScriptText(SAY_ELEMENTALS, m_creature); m_bElementalsSpawned = true; } // Berserk timer - the summons position is guesswork if (m_uiBerserkTimer) { if (m_uiBerserkTimer <= uiDiff) { for (uint8 i = 0; i < MAX_SHADOWS_OF_ARAN; ++i) DoSpawnCreature(NPC_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); DoScriptText(SAY_TIMEOVER, m_creature); m_uiBerserkTimer = 0; } else m_uiBerserkTimer -= uiDiff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (Fireball_Timer <= diff) { if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(victim, DUNGEON_MODE(SPELL_FIREBALL, SPELL_FIREBALL_H), true); Fireball_Timer = urand(4000, 7000); } else Fireball_Timer -= diff; if (flight) // phase 1 - the flight { Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID); if (Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && Vazruden->HealthAbovePct(20))) { flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); me->GetMotionMaster()->Clear(); if (Unit* victim = SelectTarget(SELECT_TARGET_NEAREST, 0)) me->AI()->AttackStart(victim); DoStartMovement(me->getVictim()); DoScriptText(EMOTE, me); return; } else Fly_Timer -= diff; if (Turn_Timer <= diff) { uint32 waypoint = (Fly_Timer/10000)%2; if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5)) me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]); Turn_Timer = 10000; } else Turn_Timer -= diff; } else // phase 2 - land fight { if (ConeOfFire_Timer <= diff) { DoCast(me, DUNGEON_MODE(SPELL_CONE_OF_FIRE, SPELL_CONE_OF_FIRE_H)); ConeOfFire_Timer = 12000; Fireball_Timer = 4000; } else ConeOfFire_Timer -= diff; if (IsHeroic()) { if (BellowingRoar_Timer <= diff) { DoCast(me, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; } else BellowingRoar_Timer -= diff; } DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 uiDiff) { if(m_uiPhase == 1) DoStartNoMovement(me->getVictim()); else if(m_uiPhase == 2) DoStartMovement(me->getVictim()); if (m_uiIntroTimer <= uiDiff && bIntro && m_uiIntroPhase < 7) { switch (m_uiIntroPhase) { case 1: DoScriptText(SAY_INTRO_2, me); m_uiIntroTimer = 10000; break; case 2: DoScriptText(SAY_INTRO_3, me); m_uiIntroTimer = 7000; break; case 3: DoScriptText(SAY_INTRO_4, me); m_uiIntroTimer = 12000; break; case 4: DoScriptText(SAY_INTRO_5, me); m_uiIntroTimer = 7000; break; case 5: DoScriptText(SAY_INTRO_6, me); m_uiIntroTimer = 11000; break; case 6: DoScriptText(SAY_INTRO_7, me); m_uiIntroTimer = 20000; break; } ++m_uiIntroPhase; } else m_uiIntroTimer -= uiDiff; if (!UpdateVictim()) return; if (m_uiBerserkTimer < uiDiff) { DoCast(me, SPELL_BERSERK); DoScriptText(SAY_BERSERK, me); m_uiBerserkTimer = 600000; } else m_uiBerserkTimer -= uiDiff; if (m_uiCultTimer < uiDiff) { EmpowerCultist(); m_uiCultTimer = urand(20000, 23000); } else m_uiCultTimer -= uiDiff; if (m_uiDeathandDecayTimer < uiDiff) { if(Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) DoCast(pTarget, SPELL_DEATH_AND_DECAY); m_uiDeathandDecayTimer = 11000; } else m_uiDeathandDecayTimer -= uiDiff; if (m_uiDominateMindTimer < uiDiff) { for (uint8 i = 1; i <= RAID_MODE(0,1,1,3); ++i) { if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_DOMINATE_MIND)) DoCast(pTarget, SPELL_DOMINATE_MIND); } DoScriptText(SAY_DOMINATE_MIND, me); m_uiDominateMindTimer = 15000; } else m_uiDominateMindTimer -= uiDiff; if (m_uiPhase == 1) { if (m_uiShadowBoltTimer < uiDiff) { if(Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) DoCast(pTarget, SPELL_SHADOW_BOLT); m_uiShadowBoltTimer = 6000; } else m_uiShadowBoltTimer -= uiDiff; if (m_uiSummonWaveTimer < uiDiff) { if (Difficulty() == RAID_DIFFICULTY_10MAN_NORMAL || Difficulty() == RAID_DIFFICULTY_10MAN_HEROIC) RandomSpawn(); else { DoSummon(CREATURE_FANATIC, SpawnLoc[0]); DoSummon(CREATURE_ADHERENT, SpawnLoc[1]); DoSummon(CREATURE_FANATIC, SpawnLoc[2]); DoSummon(CREATURE_ADHERENT, SpawnLoc[3]); DoSummon(CREATURE_FANATIC, SpawnLoc[4]); DoSummon(CREATURE_ADHERENT, SpawnLoc[5]); DoSummon(RAND(CREATURE_FANATIC,CREATURE_ADHERENT), SpawnLoc[6]); } bFirstSummon = false ? true : true; m_uiSummonWaveTimer = !bFirstSummon ? 10000 : 60000; } else m_uiSummonWaveTimer -= uiDiff; } if (m_uiPhase == 2) { if (m_uiFrostBoltTimer < uiDiff) { DoCast(me->getVictim(), SPELL_FROST_BOLT); m_uiFrostBoltTimer = 10000; } else m_uiFrostBoltTimer -= uiDiff; if (m_uiFrostValleyTimer < uiDiff) { DoCast(SPELL_FROST_BOLT_VALLEY); m_uiFrostValleyTimer = 19000; } else m_uiFrostValleyTimer -= uiDiff; if (m_uiInsignificanceTimer < uiDiff) { DoCast(me->getVictim(), SPELL_INSIGNIFICANCE); m_uiInsignificanceTimer = 8000; } else m_uiInsignificanceTimer -= uiDiff; if (m_uiSummonWaveTimer < uiDiff) { if (Difficulty() == RAID_DIFFICULTY_10MAN_HEROIC) DoSummon(RAND(CREATURE_FANATIC,CREATURE_ADHERENT), SpawnLoc[6]); if (Difficulty() == RAID_DIFFICULTY_25MAN_HEROIC) RandomSpawn(); m_uiSummonWaveTimer = 60000; } else m_uiSummonWaveTimer -= uiDiff; if (m_uiShadeTimer < uiDiff) { DoCast(SPELL_SUMMON_SHADE); m_uiShadeTimer = 15000; } else m_uiShadeTimer -= uiDiff; DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (((me->GetHealth()*100 / me->GetMaxHealth()) < 60) && (Phase == 1)) { Phase = 2; me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->AddUnitMovementFlag(MOVEFLAG_LEVITATING | MOVEFLAG_ONTRANSPORT); me->SetHover(true); me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); DoScriptText(SAY_PHASE_2_TRANS, me); } if (((me->GetHealth()*100 / me->GetMaxHealth()) < 40) && (Phase == 2)) { Phase = 3; me->RemoveUnitMovementFlag(MOVEFLAG_LEVITATING | MOVEFLAG_ONTRANSPORT); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->SetHover(false); me->GetMotionMaster()->MovePoint(0, -10.6155f, -219.357f, -87.7344f); DoStartMovement(me->getVictim()); me->RemoveUnitMovementFlag(MOVEFLAG_WALK_MODE); DoScriptText(SAY_PHASE_3_TRANS, me); } if (Phase == 1 || Phase == 3) { if (FlameBreathTimer <= diff) { DoCast(me->getVictim(), SPELL_FLAMEBREATH); FlameBreathTimer = 15000; } else FlameBreathTimer -= diff; if (TailSweepTimer <= diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (pTarget && !me->HasInArc(M_PI, pTarget)) DoCast(pTarget, SPELL_TAILSWEEP); TailSweepTimer = 10000; } else TailSweepTimer -= diff; if (CleaveTimer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); CleaveTimer = 10000; } else CleaveTimer -= diff; if (WingBuffetTimer <= diff) { DoCast(me->getVictim(), SPELL_WINGBUFFET); WingBuffetTimer = 7000 + ((rand()%8)*1000); } else WingBuffetTimer -= diff; if (KnockAwayTimer <= diff) { if (rand() <= 30) { DoCast(me->getVictim(), SPELL_KNOCK_AWAY); } KnockAwayTimer = 15000; } else KnockAwayTimer -= diff; if (Phase == 3) { if (BellowingRoarTimer <= diff) { DoCast(me->getVictim(), SPELL_BELLOWINGROAR); BellowingRoarTimer = 30000; } else BellowingRoarTimer -= diff; if (SummonWhelpsTimer <= diff) { SummonWhelps(Phase); SummonWhelpsTimer = 45000; } else SummonWhelpsTimer -= diff; } DoMeleeAttackIfReady(); } if (Phase == 2) { if (InitialSpawn) { InitialSpawn = false; for (uint32 i = 0; i < 10; ++i) { uint32 random = rand()%4; Creature* Whelp = me->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); if (Whelp) Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } } if (EngulfingFlamesTimer <= diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_ENGULFINGFLAMES); me->HandleEmoteCommand(ANIM_FLY); EngulfingFlamesTimer = 10000; } else EngulfingFlamesTimer -= diff; if (FireballTimer <= diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); FireballTimer = 18000; } else FireballTimer -= diff; if (MovementTimer <= diff) { if (rand()%100 < 30) { DoScriptText(EMOTE_BREATH, me); DoCast(me->getVictim(), SPELL_DEEPBREATH); } else ChangePosition(); MovementTimer = 25000; } else MovementTimer -= diff; if (SummonWhelpsTimer <= diff) { SummonWhelps(Phase); SummonWhelpsTimer = 45000; } else SummonWhelpsTimer -= diff; } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) { if (UnsummonCheck <= diff && me->isAlive()) { me->SetLootRecipient(NULL); me->SetVisibility(VISIBILITY_OFF); me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); me->RemoveCorpse(); } else UnsummonCheck -= diff; return; } if (Fireball_Timer <= diff) { if (Unit *victim = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(victim, SPELL_FIREBALL, true); Fireball_Timer = 4000+rand()%3000; } else Fireball_Timer -= diff; if (flight) // phase 1 - the flight { Creature *Vazruden = Unit::GetCreature(*me, VazrudenGUID); if (Fly_Timer <= diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth()))) { flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; me->RemoveUnitMovementFlag(MOVEFLAG_ONTRANSPORT | MOVEFLAG_LEVITATING); me->AddUnitMovementFlag(MOVEFLAG_WALK_MODE); me->GetMotionMaster()->Clear(); if (Unit *victim = SelectUnit(SELECT_TARGET_NEAREST, 0)) me->AI()->AttackStart(victim); DoStartMovement(me->getVictim()); DoScriptText(EMOTE, me); return; } else Fly_Timer -= diff; if (Turn_Timer <= diff) { uint32 waypoint = (Fly_Timer/10000)%2; if (me->GetDistance(VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2]) > 5) me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2]); Turn_Timer = 10000; } else Turn_Timer -= diff; } else // phase 2 - land fight { if (ConeOfFire_Timer <= diff) { DoCast(me, SPELL_CONE_OF_FIRE); ConeOfFire_Timer = 12000; Fireball_Timer = 4000; } else ConeOfFire_Timer -= diff; if (HeroicMode && BellowingRoar_Timer <= diff) { DoCast(me, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; } else BellowingRoar_Timer -= diff; DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (WaitTimer) if (WaitTimer < diff) { if (Intro) { if (MovePhase >= 7) { m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND); m_creature->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); } else { m_creature->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); ++MovePhase; } } if (Flying) { if (MovePhase >= 7) { m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND); m_creature->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); } else { m_creature->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); ++MovePhase; } } WaitTimer = 0; }else WaitTimer -= diff; if (!UpdateVictim()) return; if (Flying) return; // Phase 1 "GROUND FIGHT" if (Phase == 1) { if (Movement) { DoStartMovement(m_creature->getVictim()); Movement = false; } if (BellowingRoarTimer < diff) { DoCast(m_creature->getVictim(),SPELL_BELLOWING_ROAR); BellowingRoarTimer = 30000+rand()%10000 ; //Timer }else BellowingRoarTimer -= diff; if (SmolderingBreathTimer < diff) { DoCast(m_creature->getVictim(),SPELL_SMOLDERING_BREATH); SmolderingBreathTimer = 20000;//timer }else SmolderingBreathTimer -= diff; if (CharredEarthTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target,SPELL_CHARRED_EARTH); CharredEarthTimer = 20000; //timer }else CharredEarthTimer -= diff; if (TailSweepTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) if (!m_creature->HasInArc(M_PI, target)) DoCast(target,SPELL_TAIL_SWEEP); TailSweepTimer = 15000;//timer }else TailSweepTimer -= diff; if (SearingCindersTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target,SPELL_SEARING_CINDERS); SearingCindersTimer = 10000; //timer }else SearingCindersTimer -= diff; uint32 Prozent; Prozent = (m_creature->GetHealth()*100) / m_creature->GetMaxHealth(); if (Prozent < 75 && FlyCount == 0) // first take off 75% TakeOff(); if (Prozent < 50 && FlyCount == 1) // secound take off 50% TakeOff(); if (Prozent < 25 && FlyCount == 2) // third take off 25% TakeOff(); DoMeleeAttackIfReady(); } //Phase 2 "FLYING FIGHT" if (Phase == 2) { if (!RainBones) { if (!Skeletons) { for (uint8 i = 0; i <= 3; ++i) { DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON); Skeletons = true; } } if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 { DoCast(m_creature->getVictim(),SPELL_RAIN_OF_BONES); RainBones = true; SmokingBlastTimer = 20000; }else RainofBonesTimer -= diff; if (DistractingAshTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target,SPELL_DISTRACTING_ASH); DistractingAshTimer = 2000;//timer wrong }else DistractingAshTimer -= diff; } if (RainBones) { if (SmokingBlastTimer < diff) { DoCast(m_creature->getVictim(),SPELL_SMOKING_BLAST); SmokingBlastTimer = 1500 ; //timer wrong }else SmokingBlastTimer -= diff; } if (FireballBarrageTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_FARTHEST, 0)) DoCast(target,SPELL_FIREBALL_BARRAGE); FireballBarrageTimer = 20000; //Timer }else FireballBarrageTimer -= diff; if (FlyTimer < diff) //landing { if (rand()%2 == 0) m_creature->MonsterYell(YELL_LAND_PHASE_1, LANG_UNIVERSAL, NULL); else m_creature->MonsterYell(YELL_LAND_PHASE_2, LANG_UNIVERSAL, NULL); (*m_creature).GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]); Flying = true; }else FlyTimer -= diff; } }
void UpdateAI(const uint32 diff) { if(!m_creature->SelectHostileTarget()) return; GameObject* Door = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_MASSIVE_DOOR)); if(Door) Door->SetGoState(GO_STATE_ACTIVE); // open the door if(!m_creature->getVictim() || !m_creature->isAlive()) return; if(ExhaustCheck_timer < diff) { //periodic exhaustion debuff check DELExhaustCandDOM(); DELExhaustCandSER(); DELExhaustCandPER(); ExhaustCheck_timer = 2000; }else ExhaustCheck_timer -= diff; if(Enrage_timer < diff) { if(!Enraged) { DoCast(m_creature,SPELL_ENRAGE); Enraged = true; } }else Enrage_timer -= diff; if(PortalPhase) { if(PortalPhase_timer < diff) { m_creature->CastSpell(m_creature, SPELL_BANISH_VISUAL,0); //DoScriptText(SAY_BANISH, m_creature); BanishPhase = true; PortalPhase = false; PLRonRedBeam = false; DestroyPortals(); if(!bReset) { RandomizeCoords(); } else { memcpy(&RandomedCoords, &BasicCoords, sizeof(BasicCoords)); // copy the basic coords at start bReset = false; } PortalPhase_timer = 60000; (*m_creature).GetMotionMaster()->MoveIdle(); }else PortalPhase_timer -= diff; if(!HasEmpowered) { if(Empowerment_timer < diff) { DoCast(m_creature,SPELL_EMPOWERMENT); HasEmpowered = true; }else Empowerment_timer -= diff; } if(!PortalsSpawned) { Creature* BeamerD = m_creature->SummonCreature(CREATURE_BLUEPORTAL,RandomedCoords[0][0],RandomedCoords[0][1],RandomedCoords[0][2],0,TEMPSUMMON_CORPSE_DESPAWN,0); if(BeamerD) { BeamerGUID[0] = BeamerD->GetGUID(); BeamerD->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); BeamerD->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); BeamerD->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Creature* BeamerS = m_creature->SummonCreature(CREATURE_GREENPORTAL,RandomedCoords[1][0],RandomedCoords[1][1],RandomedCoords[1][2],0,TEMPSUMMON_CORPSE_DESPAWN,0); if(BeamerS) { BeamerGUID[1] = BeamerS->GetGUID(); BeamerS->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); BeamerS->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); BeamerS->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Creature* BeamerP = m_creature->SummonCreature(CREATURE_REDPORTAL,RandomedCoords[2][0],RandomedCoords[2][1],RandomedCoords[2][2],0,TEMPSUMMON_CORPSE_DESPAWN,0); if(BeamerP) { BeamerGUID[2] = BeamerP->GetGUID(); BeamerP->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); BeamerP->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); BeamerP->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Creature* BeamerDhelp = m_creature->SummonCreature(CREATURE_BLUEPORTAL,RandomedCoords[0][0],RandomedCoords[0][1],RandomedCoords[0][2],0,TEMPSUMMON_CORPSE_DESPAWN,0); if(BeamerDhelp) { BeamerhelpGUID[0] = BeamerDhelp->GetGUID(); BeamerDhelp->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); BeamerDhelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); BeamerDhelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Creature* BeamerShelp = m_creature->SummonCreature(CREATURE_GREENPORTAL,RandomedCoords[1][0],RandomedCoords[1][1],RandomedCoords[1][2],0,TEMPSUMMON_CORPSE_DESPAWN,0); if(BeamerShelp) { BeamerhelpGUID[1] = BeamerShelp->GetGUID(); BeamerShelp->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); BeamerShelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); BeamerShelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Creature* BeamerPhelp = m_creature->SummonCreature(CREATURE_REDPORTAL,RandomedCoords[2][0],RandomedCoords[2][1],RandomedCoords[2][2],0,TEMPSUMMON_CORPSE_DESPAWN,0); if(BeamerPhelp) { BeamerhelpGUID[2] = BeamerPhelp->GetGUID(); BeamerPhelp->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); BeamerPhelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); BeamerPhelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } BeamerD = ((Creature*)Unit::GetUnit((*m_creature), BeamerGUID[0])); if(BeamerD) BeamerD->CastSpell(BeamerD,BLUE_PORTAL,true); BeamerS = ((Creature*)Unit::GetUnit((*m_creature), BeamerGUID[1])); if(BeamerS) BeamerS->CastSpell(BeamerS,GREEN_PORTAL,true); BeamerP = ((Creature*)Unit::GetUnit((*m_creature), BeamerGUID[2])); if(BeamerP) BeamerP->CastSpell(BeamerP,RED_PORTAL,true); PortalsSpawned = true; //DoScriptText(SAY_PORTAL, m_crature); } if(Beam_initialtimer < diff) { if(Beam_periodictimer < diff) { //apply beam buff /*BlueNetherBeam(); GreenNetherBeam(); RedNetherBeam();*/ NetherBeam(0); // blue NetherBeam(1); // green NetherBeam(2); // red Beam_periodictimer = 1000; DoScriptText(EMOTE_PHASE_PORTAL, m_creature); }else Beam_periodictimer -= diff; }else Beam_initialtimer -= diff; if(Netherburn_timer < diff) { DoCast(m_creature,SPELL_NETHERBURN); Netherburn_timer = 5000; }else Netherburn_timer -= diff; if(Voidzone_timer < diff && !BanishPhase) { //function for spawning the Void Zones around the position of Netherspite voidZones_random = rand()%4; float fTmp1 = (rand()%2==0) ? -1 : 1; float fTmp2 = (rand()%2==0) ? -1 : 1; ZoneCoords[0]= m_creature->GetPositionX() + 5*fTmp1 + rand()%10; ZoneCoords[1]= m_creature->GetPositionY() + 5*fTmp2 + rand()%10; /*switch(voidZones_random) { case 0 : ZoneCoords[0]= m_creature->GetPositionX() + 5 + rand()%10; ZoneCoords[1]= m_creature->GetPositionY() + 5 + rand()%10; break; case 1: ZoneCoords[0]= m_creature->GetPositionX() + 5 + rand()%10; ZoneCoords[1]= m_creature->GetPositionY() - (5 + rand()%10); break; case 2: ZoneCoords[0]= m_creature->GetPositionX() - (5 + rand()%10); ZoneCoords[1]= m_creature->GetPositionY() + 5 + rand()%10; break; case 3: ZoneCoords[0]= m_creature->GetPositionX() - (5 + rand()%10); ZoneCoords[1]= m_creature->GetPositionY() - (5 + rand()%10); break; } */ Creature* uVoidZone = m_creature->SummonCreature(CREATURE_VOID_ZONE, ZoneCoords[0], ZoneCoords[1], m_creature->GetPositionZ() , 0 , TEMPSUMMON_CORPSE_DESPAWN, 0); if(uVoidZone) VoidZone[voidZones_counter++] = uVoidZone->GetGUID(); if(voidZones_counter >= 6) voidZones_counter=0; // use this, when the spell is fixed (you've to overwork this then): /* Unit* Zonetarget = SelectUnit(SELECT_TARGET_RANDOM,0); // No longer necessary if(Zonetarget) ZonetargetGUID = Zonetarget->GetGUID(); Zonetarget = Unit::GetUnit((*m_creature), ZonetargetGUID); if(Zonetarget->IsHostileTo(m_creature)) DoCast(Zonetarget,SPELL_VOIDZONE); */ Voidzone_timer = 15000; }else Voidzone_timer -= diff; } if(BanishPhase) { if(BanishPhase_timer < diff) { m_creature->RemoveAura(SPELL_BANISH_VISUAL,0); PortalPhase = true; BanishPhase = false; PortalsSpawned = false; PLRonRedBeam = false; BanishPhase_timer = 30000; DoResetThreat(); (*m_creature).GetMotionMaster()->MoveChase(m_creature->getVictim()); DoScriptText(EMOTE_PHASE_BANISH, m_creature); }else BanishPhase_timer -= diff; if(Netherbreath_timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target, SPELL_NETHERBREATH); Netherbreath_timer = 2500; }else Netherbreath_timer -= diff; } if(!PLRonRedBeam) { DoMeleeAttackIfReady(); } else { Unit* uTmp = Unit::GetUnit(*m_creature,CandidatesGUID[2]); //if(uTmp && uTmp->IsHostileTo(m_creature)) //DoStartAttackAndMovement(uTmp); /* after rev. 698: DoStartMovement() */ if (m_creature->Attack(uTmp, true)) { m_creature->AddThreat(uTmp, 0.0f); m_creature->SetInCombatWith(uTmp); uTmp->SetInCombatWith(m_creature); if (!InCombat) { InCombat = true; Aggro(uTmp); } DoStartMovement(uTmp); } } }