Пример #1
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiPhase == PHASE_GROUND)
        {
            // Teleport to platform
            if (m_uiPhaseTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_TELEPORT) == CAST_OK)
                {
                    DoScriptText(EMOTE_TELEPORT, m_creature);
                    m_creature->GetMotionMaster()->MoveIdle();

                    m_uiPhase = PHASE_PLATFORM;
                    ResetPhase();
                    return;
                }
            }
            else
                m_uiPhaseTimer -= uiDiff;

            // Fever
            if (m_uiFeverTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_DECREPIT_FEVER : SPELL_DECREPIT_FEVER_H);
                m_uiFeverTimer = 21000;
            }
            else
                m_uiFeverTimer -= uiDiff;

            // Disruption
            if (m_uiDisruptionTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, SPELL_DISRUPTION);
                m_uiDisruptionTimer = 10000;
            }
            else
                m_uiDisruptionTimer -= uiDiff;
        }
        else                                                // Platform Phase
        {
            if (m_uiPhaseTimer < uiDiff)                    // Return to fight
            {
                m_creature->InterruptNonMeleeSpells(true);
                DoScriptText(EMOTE_RETURN, m_creature);
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());

                m_uiPhase = PHASE_GROUND;
                ResetPhase();
                return;
            }
            else
                m_uiPhaseTimer -= uiDiff;

            if (m_uiStartChannelingTimer)
            {
                if (m_uiStartChannelingTimer <= uiDiff)
                {
                    DoScriptText(SAY_CHANNELING, m_creature);
                    DoCastSpellIfCan(m_creature, SPELL_PLAGUE_CLOUD);
                    m_uiStartChannelingTimer = 0;           // no more
                }
                else
                    m_uiStartChannelingTimer -= uiDiff;
            }
        }

        // Taunt
        if (m_uiTauntTimer < uiDiff)
        {
            switch (urand(0, 3))
            {
                case 0: DoScriptText(SAY_TAUNT1, m_creature); break;
                case 1: DoScriptText(SAY_TAUNT2, m_creature); break;
                case 2: DoScriptText(SAY_TAUNT3, m_creature); break;
                case 3: DoScriptText(SAY_TAUNT4, m_creature); break;
            }
            m_uiTauntTimer = urand(20000, 70000);
        }
        else
            m_uiTauntTimer -= uiDiff;

        DoMeleeAttackIfReady();

        // Handling of the erruptions, this is not related to melee attack or spell-casting
        if (!m_pInstance)
            return;

        // Eruption
        if (m_uiEruptionTimer < uiDiff)
        {
            for (uint8 uiArea = 0; uiArea < MAX_HEIGAN_TRAP_AREAS; ++uiArea)
            {
                // Actually this is correct :P
                if (uiArea == (m_uiPhaseEruption % 6) || uiArea == 6 - (m_uiPhaseEruption % 6))
                    continue;

                m_pInstance->DoTriggerHeiganTraps(m_creature, uiArea);
            }

            m_uiEruptionTimer = m_uiPhase == PHASE_GROUND ? 10000 : 3000;
            ++m_uiPhaseEruption;
        }
        else
            m_uiEruptionTimer -= uiDiff;
    }
Пример #2
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiPhase == PHASE_GROUND)
        {
            // Teleport to platform
            if (m_uiPhaseTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_TELEPORT) == CAST_OK)
                {
                    DoScriptText(EMOTE_TELEPORT, m_creature);
                    m_creature->GetMotionMaster()->MoveIdle();

                    m_uiPhase = PHASE_PLATFORM;
                    ResetPhase();
                    return;
                }
            }
            else
                m_uiPhaseTimer -= uiDiff;

            // Fever
            if (m_uiFeverTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, SPELL_DECREPIT_FEVER);
                m_uiFeverTimer = 21000;
            }
            else
                m_uiFeverTimer -= uiDiff;

            // Disruption
            if (m_uiDisruptionTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, SPELL_DISRUPTION);
                m_uiDisruptionTimer = 10000;
            }
            else
                m_uiDisruptionTimer -= uiDiff;

            if (m_uiTeleportTimer < uiDiff)
            {
                float fX, fY, fZ;
                // Teleport players in the tunnel
                for (uint8 i = 0; i < MAX_PLAYERS_TELEPORT; i++)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, uint32(0), SELECT_FLAG_PLAYER))
                    {
                        m_creature->GetRandomPoint(aTunnelLoc[0], aTunnelLoc[1], aTunnelLoc[2], 5.0f, fX, fY, fZ);
                        pTarget->NearTeleportTo(fX, fY, fZ, aTunnelLoc[3]);
                    }
                }

                m_uiTeleportTimer = 70000;
            }
            else
                m_uiTeleportTimer -= uiDiff;

        }
        else                                                // Platform Phase
        {
            if (m_uiPhaseTimer <= uiDiff)                   // Return to fight
            {
                m_creature->InterruptNonMeleeSpells(true);
                DoScriptText(EMOTE_RETURN, m_creature);
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());

                m_uiPhase = PHASE_GROUND;
                ResetPhase();
                return;
            }
            else
                m_uiPhaseTimer -= uiDiff;

            if (m_uiStartChannelingTimer)
            {
                if (m_uiStartChannelingTimer <= uiDiff)
                {
                    DoScriptText(SAY_CHANNELING, m_creature);
                    DoCastSpellIfCan(m_creature, SPELL_PLAGUE_CLOUD);

                    // ToDo: fill the tunnel with poison - required further research
                    m_uiStartChannelingTimer = 0;           // no more
                }
                else
                    m_uiStartChannelingTimer -= uiDiff;
            }
        }

        // Taunt
        if (m_uiTauntTimer < uiDiff)
        {
            switch (urand(0, 3))
            {
                case 0: DoScriptText(SAY_TAUNT1, m_creature); break;
                case 1: DoScriptText(SAY_TAUNT2, m_creature); break;
                case 2: DoScriptText(SAY_TAUNT3, m_creature); break;
                case 3: DoScriptText(SAY_TAUNT4, m_creature); break;
            }
            m_uiTauntTimer = urand(20000, 70000);
        }
        else
            m_uiTauntTimer -= uiDiff;

        DoMeleeAttackIfReady();

        // Handling of the erruptions, this is not related to melee attack or spell-casting
        if (!m_pInstance)
            return;

        // Eruption
        if (m_uiEruptionTimer < uiDiff)
        {
            for (uint8 uiArea = 0; uiArea < MAX_HEIGAN_TRAP_AREAS; ++uiArea)
            {
                // Actually this is correct :P
                if (uiArea == (m_uiPhaseEruption % 6) || uiArea == 6 - (m_uiPhaseEruption % 6))
                    continue;

                m_pInstance->DoTriggerHeiganTraps(m_creature, uiArea);
            }

            m_uiEruptionTimer = m_uiPhase == PHASE_GROUND ? 10000 : 3000;
            ++m_uiPhaseEruption;
        }
        else
            m_uiEruptionTimer -= uiDiff;
    }