void doBeacon(bool command = false) { if (command) { for(uint8 i = 0; i < getSpellData(SPELL_BEACON); ++i) { if (Unit* pTarget = doSelectRandomPlayer(SPELL_BEACON, false, 100.0f)) { if (doCast(SPELL_BEACON, pTarget) == CAST_OK) marked[i] = pTarget; else marked[i] = NULL; } } conflagated = true; } else { m_creature->InterruptNonMeleeSpells(true); for(uint8 i = 0; i < getSpellData(SPELL_BEACON); ++i) { if (marked[i]) doCast(SPELL_CONFLAGATION_2, marked[i]); marked[i] = NULL; } doCast(SPELL_CONFLAGATION_1); conflagated = false; } }
void UpdateAI(const uint32 diff) { if(!pInstance) return; if (!pet) { if (Creature* pGuard = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_PRECIOUS))) if (!pGuard->isAlive()) { pet = true; if (pInstance->GetData(TYPE_PRECIOUS) == NOT_STARTED) { DoScriptText(-1631228,m_creature); pInstance->SetData(TYPE_PRECIOUS,DONE); } } } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (nexttick) { doCast(SPELL_OOZE_FLOOD_1); DoScriptText(-1631227,m_creature); nexttick = false; }; if (timedQuery(SPELL_OOZE_FLOOD_1, diff)) { uint8 i = urand(0,3); if (Unit* pTemp = doSummon(NPC_OOZE_STALKER,SpawnLoc[i].x, SpawnLoc[i].y, SpawnLoc[i].z, TEMPSUMMON_TIMED_DESPAWN, 15000)) { doCast(SPELL_OOZE_FLOOD, pTemp); nexttick = true; } }; if (timedQuery(SPELL_SLIME_SPRAY, diff)) if (doSummon(NPC_OOZE_SPRAY_STALKER)) doCast(SPELL_SLIME_SPRAY); if (timedQuery(SPELL_MUTATED_INFECTION, diff)) { for(uint8 i = 0; i < getSpellData(SPELL_MUTATED_INFECTION); ++i) if (Unit* pTarget = doSelectRandomPlayer(SPELL_MUTATED_INFECTION_AURA, false, 60.0f)) doCast(SPELL_MUTATED_INFECTION, pTarget); DoScriptText(-1631226,m_creature); } if (timedQuery(SPELL_BERSERK, diff)) { doCast(SPELL_BERSERK); DoScriptText(-1631225,m_creature); }; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if(!pInstance) return; if (pInstance->GetData(TYPE_EVENT_NPC) == NPC_LICH_KING) { UpdateTimer = pInstance->GetData(TYPE_EVENT_TIMER); if (UpdateTimer <= diff) { debug_log("EventMGR: creature %u received signal %u ",m_creature->GetEntry(),pInstance->GetData(TYPE_EVENT)); switch (pInstance->GetData(TYPE_EVENT)) { case 12000: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND); m_creature->SetStandState(UNIT_STAND_STATE_STAND); StartMovement(0,12020); break; case 12020: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); DoScriptText(-1631501, m_creature); UpdateTimer = 12000; pInstance->SetData(TYPE_EVENT,12030); break; case 12040: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); DoScriptText(-1631503, m_creature); UpdateTimer = 8000; pInstance->SetData(TYPE_EVENT,12041); break; case 12041: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_LAUGH); UpdateTimer = 3000; pInstance->SetData(TYPE_EVENT,12042); break; case 12042: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_POINT_NOSHEATHE); UpdateTimer = 2000; pInstance->SetData(TYPE_EVENT,12043); break; case 12043: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_NONE); UpdateTimer = 10000; pInstance->SetData(TYPE_EVENT,12050); break; case 12060: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); DoScriptText(-1631505, m_creature); UpdateTimer = 10000; pInstance->SetData(TYPE_EVENT,12080); break; case 12080: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_STATE_READY2H); UpdateTimer = 2000; pInstance->SetData(TYPE_EVENT,12100); break; case 12100: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_NONE); UpdateTimer = 6000; pInstance->SetData(TYPE_EVENT,12120); break; case 12120: m_creature->GetMotionMaster()->Clear(); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SetCombatMovement(true); m_creature->SetInCombatWithZone(); battlestarted = true; pInstance->SetData(TYPE_EVENT,12200); UpdateTimer = 10000; break; case 12200: DoScriptText(-1631506, m_creature); UpdateTimer = 5000; pInstance->SetData(TYPE_EVENT,12220); break; case 13000: m_creature->SetOrientation(3.1146f); DoScriptText(-1631507, m_creature); UpdateTimer = 12000; finalphase = true; doCast(SPELL_FURY_OF_FROSTMOURNE); pInstance->SetData(TYPE_EVENT,13020); if (pTirion = pInstance->GetSingleCreatureFromStorage(NPC_TIRION)) { m_creature->SetInCombatWith(pTirion); pTirion->AddThreat(m_creature, 1000.0f); } m_creature->SetInCombatWithZone(); break; case 13020: DoScriptText(-1631508, m_creature); UpdateTimer = 12000; pInstance->SetData(TYPE_EVENT,13060); break; case 13060: DoScriptText(-1631509, m_creature); UpdateTimer = 15000; pInstance->SetData(TYPE_EVENT,13100); break; case 13100: DoScriptText(-1631510, m_creature); UpdateTimer = 15000; pInstance->SetData(TYPE_EVENT,13110); doCast(SPELL_CHANNEL_KING); break; case 13120: DoScriptText(-1631511, m_creature); UpdateTimer = 12000; pInstance->SetData(TYPE_EVENT,13130); break; case 13140: UpdateTimer = 6000; doRemove(SPELL_CHANNEL_KING); pInstance->SetData(TYPE_EVENT,13150); m_creature->CastSpell(m_creature, SPELL_SUMMON_BROKEN_FROSTMOURNE, false); break; case 13160: UpdateTimer = 6000; pInstance->SetData(TYPE_EVENT,13170); m_creature->CastSpell(m_creature, SPELL_SUMMON_BROKEN_FROSTMOURNE_2, false); break; case 13180: UpdateTimer = 12000; pInstance->SetData(TYPE_EVENT,13190); if (pFrostmourne = m_creature->SummonCreature(NPC_FROSTMOURNE_HOLDER, SpawnLoc[7].x, SpawnLoc[7].y, SpawnLoc[7].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 5000)) { pFrostmourne->CastSpell(pFrostmourne, SPELL_BROKEN_FROSTMOURNE, false); pFrostmourne->CastSpell(pFrostmourne, SPELL_FROSTMOURNE_TRIGGER, false); pFrostmourne->GetMotionMaster()->MoveChase(m_creature); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); } break; case 13200: DoScriptText(-1631512, m_creature); m_creature->RemoveAurasDueToSpell(SPELL_SUMMON_BROKEN_FROSTMOURNE); m_creature->RemoveAllAuras(); pFrostmourne->RemoveAurasDueToSpell(SPELL_FROSTMOURNE_TRIGGER); UpdateTimer = 5000; pInstance->SetData(TYPE_EVENT,13210); break; case 13280: UpdateTimer = 2000; pInstance->SetData(TYPE_EVENT,13290); stage = 13; if (pFrostmourne) pFrostmourne->ForcedDespawn(); if (Creature* pTemp = pInstance->GetSingleCreatureFromStorage(NPC_FROSTMOURNE_TRIGGER)) pTemp->ForcedDespawn(); if (Creature* pTemp = pInstance->GetSingleCreatureFromStorage(NPC_FROSTMOURNE_HOLDER)) pTemp->ForcedDespawn(); SetCombatMovement(true); battlestarted = true; break; default: break; } } else UpdateTimer -= diff; pInstance->SetData(TYPE_EVENT_TIMER, UpdateTimer); } if (battlestarted && !m_creature->SelectHostileTarget() && !finalphase) { battlestarted = false; pInstance->SetData(TYPE_LICH_KING, FAIL); pInstance->SetData(TYPE_EVENT,0); EnterEvadeMode(); return; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; switch(stage) { case 0: // Phase 1 // timedCast(SPELL_SHOCKWAVE, diff); timedCast(SPELL_INFEST, diff); timedCast(SPELL_SUMMON_DRUDGE_GHOULS, diff); timedCast(SPELL_PLAGUE_SIPHON, diff); timedCast(SPELL_SUMMON_SHAMBLING_HORROR, diff); timedCast(SPELL_NECROTIC_PLAGUE, diff); DoMeleeAttackIfReady(); if (timedQuery(SPELL_BERSERK, diff)) { doCast(SPELL_BERSERK); DoScriptText(-1631518,m_creature); }; if (m_creature->GetHealthPercent() < 70.0f) { stage = 1; DoScriptText(-1631515,m_creature); } break; case 1: // Go in transition phase m_creature->AttackStop(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SetCombatMovement(false); StartMovement(1,0); stage = 2; break; case 2: if (movementstarted) return; doCast(SPELL_REMORSELESS_WINTER); stage = 3; break; case 3: timedCast(SPELL_SUMMON_RAGING_SPIRIT, diff); timedCast(SPELL_SUMMON_ICE_SPHERE, diff); timedCast(SPELL_PAIN_AND_SUFFERING, diff); if (timedQuery(SPELL_BERSERK, diff)) { doCast(SPELL_BERSERK); DoScriptText(-1631518,m_creature); }; if (timedQuery(SPELL_REMORSELESS_WINTER, diff)) { doCast(SPELL_QUAKE); stage = 4; DoScriptText(-1631524, m_creature); pInstance->DoOpenDoor(pInstance->GetData64(GO_SNOW_EDGE)); }; break; case 4: // Platform destruct if (timedQuery(SPELL_QUAKE, diff)) { pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_1)); pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_2)); pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_3)); pInstance->DoOpenDoor(pInstance->GetData64(GO_ICESHARD_4)); if (GameObject* pGoFloor = pInstance->GetSingleGameObjectFromStorage(GO_ARTHAS_PLATFORM)) { pGoFloor->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN); oldflag = pGoFloor->GetUInt32Value(GAMEOBJECT_BYTES_1); pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,8449); } pInstance->DoCloseDoor(pInstance->GetData64(GO_FROSTY_WIND)); pInstance->DoCloseDoor(pInstance->GetData64(GO_SNOW_EDGE)); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SetCombatMovement(true); stage = 5; } break; case 5: // Phase 2 if (timedQuery(SPELL_SPAWN_DEFILE, diff)) { doCast(SPELL_SPAWN_DEFILE); DoScriptText(-1631531,m_creature); } if (timedQuery(SPELL_SUMMON_VALKYR, diff)) { doCast(SPELL_SUMMON_VALKYR); DoScriptText(-1631527,m_creature); } timedCast(SPELL_SOUL_REAPER, diff); timedCast(SPELL_INFEST, diff); DoMeleeAttackIfReady(); if (timedQuery(SPELL_BERSERK, diff)) { doCast(SPELL_BERSERK); DoScriptText(-1631518,m_creature); }; if (m_creature->GetHealthPercent() < 40.0f) { stage = 6; DoScriptText(-1631523,m_creature); } break; case 6: // Go in transition phase m_creature->AttackStop(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SetCombatMovement(false); StartMovement(1,0); stage = 7; break; case 7: // Platform restore if (movementstarted) return; if (GameObject* pGoFloor = pInstance->GetSingleGameObjectFromStorage(GO_ARTHAS_PLATFORM)) { pGoFloor->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN); pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,oldflag); } pInstance->DoOpenDoor(pInstance->GetData64(GO_FROSTY_WIND)); doCast(SPELL_REMORSELESS_WINTER); stage = 8; break; case 8: timedCast(SPELL_SUMMON_RAGING_SPIRIT, diff); timedCast(SPELL_SUMMON_ICE_SPHERE, diff); timedCast(SPELL_PAIN_AND_SUFFERING, diff); if (timedQuery(SPELL_BERSERK, diff)) { doCast(SPELL_BERSERK); DoScriptText(-1631518,m_creature); }; if (timedQuery(SPELL_REMORSELESS_WINTER, diff)) { DoScriptText(-1631524, m_creature); doCast(SPELL_SUMMON_VILE_SPIRITS); for (uint8 i = 0; i < getSpellData(SPELL_SUMMON_VILE_SPIRITS); ++i) doCast(NPC_VILE_SPIRIT); doCast(SPELL_QUAKE); stage = 9; pInstance->DoOpenDoor(pInstance->GetData64(GO_SNOW_EDGE)); }; break; case 9: // Platform destruct if (timedQuery(SPELL_QUAKE, diff)) { if (GameObject* pGoFloor = pInstance->GetSingleGameObjectFromStorage(GO_ARTHAS_PLATFORM)) { pGoFloor->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN); oldflag = pGoFloor->GetUInt32Value(GAMEOBJECT_BYTES_1); pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,8449); } pInstance->DoCloseDoor(pInstance->GetData64(GO_SNOW_EDGE)); pInstance->DoCloseDoor(pInstance->GetData64(GO_FROSTY_WIND)); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SetCombatMovement(true); stage = 10; } break; case 10: // Phase 3 if (timedQuery(SPELL_SPAWN_DEFILE, diff)) { doCast(SPELL_SPAWN_DEFILE); // DoScriptText(-1631527,m_creature); } timedCast(SPELL_SOUL_REAPER, diff); if (timedQuery(SPELL_HARVEST_SOUL, diff)) { doCast(SPELL_HARVEST_SOUL); DoScriptText(-1631520,m_creature); } timedCast(SPELL_SOUL_REAPER, diff); timedCast(SPELL_INFEST, diff); DoMeleeAttackIfReady(); if (m_creature->GetHealthPercent() < 10.0f) { stage = 11; DoScriptText(-1631513,m_creature); } break; case 11: // Ending Phase start m_creature->AttackStop(); SetCombatMovement(false); StartMovement(6,13000); stage = 12; battlestarted = false; break; case 12: break; case 13: DoMeleeAttackIfReady(); break; } }