Beispiel #1
0
   void UpdateEscortAI(const uint32 diff)
    {
      if (!m_pInstance) return;

      if (m_pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS)
      {
         if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
              return;

         DoMeleeAttackIfReady();
      }

      if (m_creature->isInCombat() && m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
         npc_escortAI::EnterEvadeMode();

      if (m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS && !StartEscort)
      {
         StartEscort = true;
         if (m_creature->HasAura(SPELL_ICE_PRISON))
            m_creature->RemoveAurasDueToSpell(SPELL_ICE_PRISON);
         if (m_creature->HasAura(SPELL_DARK_ARROW))
            m_creature->RemoveAurasDueToSpell(SPELL_DARK_ARROW);

         m_creature->SetActiveObjectState(true);

         NonFight = true;
         m_creature->AttackStop();
         m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
         m_creature->SetSpeedRate(MOVE_WALK, 2.4f, true);
         if (boss_lich_king_hrAI* pEscortAI = dynamic_cast<boss_lich_king_hrAI*>(m_creature->AI()))
             pEscortAI->Start(false, false);
         Step = 0;
         StepTimer = 100;
      }

      if (m_pInstance->GetData(TYPE_ICE_WALL_01) == IN_PROGRESS)
      {
         if (StepTimer < diff)
            Wall01();
         else StepTimer -= diff;
      }

      if (m_pInstance->GetData(TYPE_ICE_WALL_02) == IN_PROGRESS)
      {
         if (StepTimer < diff)
            Wall02();
         else StepTimer -= diff;
      }

      if (m_pInstance->GetData(TYPE_ICE_WALL_03) == IN_PROGRESS)
      {
         if (StepTimer < diff)
            Wall03();
         else StepTimer -= diff;
      }

      if (m_pInstance->GetData(TYPE_ICE_WALL_04) == IN_PROGRESS)
      {
         if (StepTimer < diff)
            Wall04();
         else StepTimer -= diff;
      }
      return;
    }
        void UpdateEscortAI(const uint32 diff)
        {
            if(!m_pInstance)
                return;

            if(m_pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS)
            {
                if (!UpdateVictim())
                    return;

                DoMeleeAttackIfReady();
            }

            if(me->isInCombat() && m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
            {
                npc_escortAI::EnterEvadeMode();
            }

            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS && StartEscort != true)
            {
                StartEscort = true;
                me->RemoveAurasDueToSpell(SPELL_ICE_PRISON);
                me->RemoveAurasDueToSpell(SPELL_DARK_ARROW);
                //me->RemoveAllAuras();
                me->setActive(true);
                me->CastSpell(me, SPELL_FROSTMOURNE_VISUAL, false);
                NonFight = true;
                me->AttackStop();
                me->SetSpeed(MOVE_WALK, 2.5f, true);
                Start(false, false);
                Step = 0;
                StepTimer = 100;
            }

            if (Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER))))
            {
                if (pLider->IsWithinDistInMap(me, 2.0f))
                {
                    me->setActive(false);
                    SetEscortPaused(true);
                    npc_escortAI::EnterEvadeMode();
                    DoScriptText(SAY_LICH_KING_WIN, me);
                    me->CastSpell(me, SPELL_FURY_OF_FROSTMOURNE, false);
                    me->DealDamage(pLider, pLider->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                    me->NearTeleportTo(5572.077f, 2283.1f, 734.976f, 3.89f);
                    m_pInstance->SetData(TYPE_LICH_KING, FAIL);
                }
            }

            if(m_pInstance->GetData(TYPE_ICE_WALL_01) == IN_PROGRESS)
            {
                if(StepTimer < diff)
                    Wall01();
                else
                    StepTimer -= diff;
            }

            if(m_pInstance->GetData(TYPE_ICE_WALL_02) == IN_PROGRESS)
            {
                if(StepTimer < diff)
                    Wall02();
                else
                    StepTimer -= diff;
            }

            if(m_pInstance->GetData(TYPE_ICE_WALL_03) == IN_PROGRESS)
            {
                if(StepTimer < diff)
                    Wall03();
                else
                    StepTimer -= diff;
            }

            if(m_pInstance->GetData(TYPE_ICE_WALL_04) == IN_PROGRESS)
            {
                if(StepTimer < diff)
                    Wall04();
                else
                    StepTimer -= diff;
            }
            return;
        }
        void UpdateEscortAI(const uint32 diff)
        {
            if(!instance)
                return;

            if(instance->GetData(DATA_LICHKING_EVENT) == NOT_STARTED || instance->GetData(DATA_LICHKING_EVENT) == FAIL)
            {
                if (!UpdateVictim())
                    return;

                DoMeleeAttackIfReady();
            }

            if(me->isInCombat() && instance->GetData(DATA_LICHKING_EVENT) == IN_PROGRESS)
            {
                npc_escortAI::EnterEvadeMode();
            }

            // Start chase for leader
            if(instance->GetData(DATA_LICHKING_EVENT) == IN_PROGRESS && StartEscort != true)
            {
                StartEscort = true;
                me->RemoveAurasDueToSpell(SPELL_ICE_PRISON);
                me->RemoveAurasDueToSpell(SPELL_DARK_ARROW);
                me->setActive(true);
                NonFight = true;
                me->AttackStop();
                me->SetSpeed(MOVE_WALK, 2.5f, true);
                Start(false, false);
                Step = 0;
                StepTimer = 100;
            }

            // Leader caught, wipe
            if (Creature* pLider = ((Creature*)Unit::GetUnit((*me), instance->GetData64(DATA_ESCAPE_LIDER))))
            {
                if (pLider->IsWithinDistInMap(me, 2.0f) && instance->GetData(DATA_LICHKING_EVENT) == IN_PROGRESS)
                {
                    me->setActive(false);
                    SetEscortPaused(false);
                    me->StopMoving();
                    DoScriptText(SAY_LICH_KING_WIN, me);
                    me->CastSpell(me, SPELL_FURY_OF_FROSTMOURNE, false);
                    me->DealDamage(pLider, pLider->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                }
            }

            if(uiWall == 1)
            {
                if(StepTimer < diff)
                    Wall01();
                else
                    StepTimer -= diff;
            }

            if(uiWall == 2)
            {
                if(StepTimer < diff)
                    Wall02();
                else
                    StepTimer -= diff;
            }

            if(uiWall == 3)
            {
                if(StepTimer < diff)
                    Wall03();
                else
                    StepTimer -= diff;
            }

            if(uiWall == 4)
            {
                if(StepTimer < diff)
                    Wall04();
                else
                    StepTimer -= diff;
            }
            return;
        }