void OnCombatStart(Unit* pTarget) { SetDisplayWeapon(true, true); ParentClass::OnCombatStart(pTarget); mAliveAdds = 0; mLastYell = -1; for (int i = 0; i < 4; ++i) { Unit* pAdd = ForceCreatureFind(Adds[i]); if (pAdd != NULL && pAdd->isAlive()) { Unit* pTarget = GetBestPlayerTarget(); if (pTarget != NULL) { pAdd->GetAIInterface()->AttackReaction(pTarget, 200); } ++mAliveAdds; } } if (mAliveAdds > 1) { SetCanEnterCombat(false); SetBehavior(Behavior_Spell); SetCanMove(false); } }
void OnDied(Unit* mKiller) { ParentClass::OnDied(mKiller); Creature* pMaulgar = TO_CREATURE(ForceCreatureFind(CN_HIGH_KING_MAULGAR, 143.048996f, 192.725998f, -11.114700f)); if (pMaulgar != NULL && pMaulgar->isAlive() && pMaulgar->GetScript()) { HighKingMaulgarAI *pMaulgarAI = static_cast<HighKingMaulgarAI*>(pMaulgar->GetScript()); pMaulgarAI->OnAddDied(); } }
HandOfTheDeceiverAI(Creature* pCreature) :MoonScriptBossAI(pCreature) { AddSpell( FELFIRE_PORTAL, Target_Self, 40, 0, 12 ); AddSpell( SHADOW_BOLT_VOLLEY, Target_Self, 50, 0, 5 ); Unit* pAvneena = ForceCreatureFind( CN_ANVEENA, 1698.202393f, 629.104187f, 69.121910f ); if( pAvneena ) { SetTargetToChannel( pAvneena, SHADOW_CHANNELING ); }; mEnraged = false; };
void AIUpdate() { SetCanEnterCombat(false); SetCanMove(false); SetAllowMelee(false); SetAllowSpell(false); // ORB ONE if (IsTimerFinished(Phase_Timer) && GetPhase() == 0) { if (Phasepart == 0) { Spawncounter = 0; orb1 = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(482.929f, -151.114f, 43.654f, 183961); if (orb1) orb1->SetState(GAMEOBJECT_STATE_OPEN); switch (RandomUInt(1)) { NPC_ID_Spawn = 0; case 0: NPC_ID_Spawn = CN_BLAZING_TRICKSTER; break; case 1: NPC_ID_Spawn = CN_WARP_STALKER; break; } ResetTimer(Phase_Timer, 8000); Phasepart = 1; return; } else if (Phasepart == 1) { if (!NPC_orb1 && NPC_ID_Spawn != 0 && Spawncounter == 0) { ++Spawncounter; NPC_orb1 = SpawnCreature(NPC_ID_Spawn, 475.672f, -147.086f, 42.567f, 3.184015f); return; } else if (NPC_orb1 && !NPC_orb1->IsAlive()) { _unit->SendScriptTextChatMessage(SAY_MELLICHAR_03); SetPhase(1); Phasepart = 0; ResetTimer(Phase_Timer, 6000); return; } else { return; } return; } //return; } // ORB TWO else if (IsTimerFinished(Phase_Timer) && GetPhase() == 1) { if (Phasepart == 0) { Spawncounter = 0; orb2 = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(409.062f, -152.161f, 43.653f, 183963); if (orb2) orb2->SetState(GAMEOBJECT_STATE_OPEN); ResetTimer(Phase_Timer, 8000); Phasepart = 1; return; } else if (Phasepart == 1) { if (!NPC_orb2 && Spawncounter == 0) { ++Spawncounter; NPC_orb2 = SpawnCreature(CN_MILLHOUSE_MANASTORM, 413.192f, -148.586f, 42.569f, 0.024347f); return; } else if (NPC_orb2 && NPC_orb2->IsAlive()) { Creature* millhouse = static_cast<Creature*>(ForceCreatureFind(CN_MILLHOUSE_MANASTORM)); if (millhouse) { millhouse->SendTimedScriptTextChatMessage(SAY_MILLHOUS_01, 2000); _unit->SendTimedScriptTextChatMessage(SAY_MELLICHAR_04, 13000); millhouse->SendTimedScriptTextChatMessage(SAY_MILLHOUS_02, 22000); } SetPhase(2); Phasepart = 0; ResetTimer(Phase_Timer, 25000); return; } else { return; } return; } //return; } // ORB THREE else if (IsTimerFinished(Phase_Timer) && GetPhase() == 2) { if (Phasepart == 0) { Spawncounter = 0; orb3 = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(415.167f, -174.338f, 43.654f, 183964); if (orb3) orb3->SetState(GAMEOBJECT_STATE_OPEN); switch (RandomUInt(1)) { NPC_ID_Spawn = 0; case 0: NPC_ID_Spawn = CN_SULFURON_MAGMA_THROWER; break; case 1: NPC_ID_Spawn = CN_AKKIRIS_LIGHTNING_WAKER; break; } ResetTimer(Phase_Timer, 8000); Phasepart = 1; return; } else if (Phasepart == 1) { if (!NPC_orb3 && NPC_ID_Spawn != 0 && Spawncounter == 0) { /// \todo investigate.... saying "1"... really? _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "1"); ++Spawncounter; NPC_orb3 = SpawnCreature(NPC_ID_Spawn, 420.050f, -173.500f, 42.580f, 6.110f); return; } else if (!NPC_orb3) { /// \todo investigate.... saying "2"... really? _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "2"); NPC_orb3 = GetNearestCreature(NPC_ID_Spawn); } else if (NPC_orb3 && !NPC_orb3->IsAlive()) { _unit->SendScriptTextChatMessage(SAY_MELLICHAR_05); SetPhase(3); Phasepart = 0; ResetTimer(Phase_Timer, 8000); return; } else { return; } return; } //return; } // ORB FOUR else if (IsTimerFinished(Phase_Timer) && GetPhase() == 3) { if (Phasepart == 0) { Spawncounter = 0; orb4 = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(476.422f, -174.517f, 42.748f, 183962); if (orb4) orb4->SetState(GAMEOBJECT_STATE_OPEN); switch (RandomUInt(1)) { NPC_ID_Spawn = 0; case 0: NPC_ID_Spawn = CN_TWILIGHT_DRAKONAAR; break; case 1: NPC_ID_Spawn = CN_BLACKWING_DRAKONAAR; break; } ResetTimer(Phase_Timer, 8000); Phasepart = 1; return; } else if (Phasepart == 1) { if (!NPC_orb4 && NPC_ID_Spawn != 0 && Spawncounter == 0) { ++Spawncounter; NPC_orb4 = SpawnCreature(NPC_ID_Spawn, 471.153f, -174.715f, 42.589f, 3.097f); return; } else if (!NPC_orb4) { NPC_orb4 = GetNearestCreature(NPC_ID_Spawn); } else if (NPC_orb4 && !NPC_orb4->IsAlive()) { _unit->SendScriptTextChatMessage(SAY_MELLICHAR_06); SetPhase(4); Phasepart = 0; ResetTimer(Phase_Timer, 6000); return; } else { return; } return; } //return; } else if (IsTimerFinished(Phase_Timer) && GetPhase() == 4) {} ParentClass::AIUpdate(); SetCanMove(false); SetAllowMelee(false); SetAllowSpell(false); }
void AIUpdate() { if(!GetUnit()->IsInWorld()) return; //kazdou minutu posleme novy cas if(IsTimerFinished(m_MinuteTimer) && !m_EventEnd) { ResetTimer(m_MinuteTimer, 60000); GetUnit()->GetMapMgr()->GetWorldStateManager()->SetWorldState(WORLDSTATE_ZULAMAN_TIMEDEVENT_TIME, static_cast<uint32>(GetTimer(m_EventTimer) / 60000)); } m_Akilzon = ForceCreatureFind(CN_AKILZON, AKILZON_SPAWN, false); m_Nalorakk = ForceCreatureFind(CN_NALORAKK, NALORAKK_SPAWN, false); m_Janalai = ForceCreatureFind(CN_JANALAI, JANALAI_SPAWN, false); m_Halazzi = ForceCreatureFind(CN_HALAZZI, HALAZZI_SPAWN, false); if(m_Akilzon && !m_Akilzon->isAlive() && !m_spawnedAkilzonChest) { m_d++; } if(m_Halazzi && !m_Halazzi->isAlive() && !m_spawnedHalazziChest) { m_d++; } if(m_Nalorakk && !m_Nalorakk->isAlive() && !m_spawneddNalorakkChest) { m_d++; } if(m_Janalai && !m_Janalai->isAlive() && !m_spawnedJanalaiChest) { m_d++; } switch(m_d) { case 0: break; case 1: m_Chest = 187021; break; case 2: m_Chest = 186648; break; case 3: m_Chest = 186667; break; case 4: m_Chest = 186672; break; } if(m_Akilzon && !m_Akilzon->isAlive() && !IsTimerFinished(m_EventTimer) && !m_spawnedAkilzonChest) { ResetTimer(m_EventTimer, GetTimer(m_EventTimer) + 600000); m_Akilzon->GetMapMgr()->GetInterface()->SpawnGameObject(m_Chest, 300, 1460, 81.5f, 0, true, 0, 0); m_spawnedAkilzonChest = true; GetUnit()->GetMapMgr()->GetWorldStateManager()->SetWorldState(WORLDSTATE_ZULAMAN_TIMEDEVENT_TIME, static_cast<uint32>(GetTimer(m_EventTimer) / 60000)); } if(m_Nalorakk && !m_Nalorakk->isAlive() && !IsTimerFinished(m_EventTimer) && !m_spawneddNalorakkChest) { ResetTimer(m_EventTimer, GetTimer(m_EventTimer) + 900000); m_Nalorakk->GetMapMgr()->GetInterface()->SpawnGameObject(m_Chest, -90, 1410, 27.5f, 0, true, 0, 0); m_spawneddNalorakkChest = true; GetUnit()->GetMapMgr()->GetWorldStateManager()->SetWorldState(WORLDSTATE_ZULAMAN_TIMEDEVENT_TIME, static_cast<uint32>(GetTimer(m_EventTimer) / 60000)); } if(m_Janalai && !m_Janalai->isAlive() && !IsTimerFinished(m_EventTimer) && !m_spawnedJanalaiChest) { m_Janalai->GetMapMgr()->GetInterface()->SpawnGameObject(m_Chest, -78, 1140, 5.3f, 0, true, 0, 0); m_spawnedJanalaiChest = true; } if(m_Halazzi && !m_Halazzi->isAlive() && !IsTimerFinished(m_EventTimer) && !m_spawnedHalazziChest) { m_Halazzi->GetMapMgr()->GetInterface()->SpawnGameObject(m_Chest, 390, 1150, 6.2f, 0, true, 0, 0); m_spawnedHalazziChest = true; } if(m_d == 4 && !m_EventEnd) { m_EventEnd = true; GetUnit()->GetMapMgr()->GetWorldStateManager()->SetWorldState(WORLDSTATE_ZULAMAN_TIMEDEVENT_DISPLAY, 0); RemoveAIUpdateEvent(); } if(IsTimerFinished(m_EventTimer) && !m_EventEnd) { m_EventEnd = true; GetUnit()->GetMapMgr()->GetWorldStateManager()->SetWorldState(WORLDSTATE_ZULAMAN_TIMEDEVENT_DISPLAY, 0); RemoveAIUpdateEvent(); } ParentClass::AIUpdate(); }
Unit * MoonScriptCreatureAI::ForceCreatureFind( uint32 pCreatureId ) { return ForceCreatureFind( pCreatureId, _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ() ); }