コード例 #1
0
ファイル: boss_heigan.cpp プロジェクト: Subv/diamondcore
    void UpdateAI(const uint32 diff)
    {
        if (m_creature->GetMapId() != 533)
            return;

        if (pInstance->GetData(TYPE_HEIGAN) != IN_PROGRESS)
        {
            m_creature->ForcedDespawn();
        }
 
        if (phase == 1)
        {
            if (phaseTimer < diff)
            {
                // Let's fast dance
                phase = 2;
                phaseTimer = 45000;
                safeSpot = 1;
            }else phaseTimer-=diff;
            if (slowTimer < diff)
            {
                DoErupt(safeSpot);
                if (forward)
                    safeSpot++;
                else
                    safeSpot--;
                slowTimer = 10500;
            }else slowTimer-=diff;
        }
        else if (phase == 2)
        {
            if (phaseTimer < diff)
            {
                // Slow dance again
                phase = 1;
                AttackStart(m_creature->getVictim());
                phaseTimer = 90000;
                safeSpot = 1;
            }else phaseTimer-=diff;
            if (fastTimer < diff)
            {
                DoErupt(safeSpot);
                if (forward)
                    safeSpot++;
                else
                    safeSpot--;
                fastTimer = 3500;
            }else fastTimer-=diff;
        }
    }
コード例 #2
0
    void UpdateAI(const uint32 uiDiff)
    {
        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_N : 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;

            if(m_uiEruptionTimer < uiDiff)
            {
                DoErupt(m_uiSafeSpot);
                if (m_bforward)
                    m_uiSafeSpot++;
                else
                    m_uiSafeSpot--;
                m_uiEruptionTimer = 10500;
            } else
                m_uiEruptionTimer -= 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;
            }

            if(m_uiEruptionTimer < uiDiff)
            {
                DoErupt(m_uiSafeSpot);
                if (m_bforward)
                    m_uiSafeSpot++;
                else
                    m_uiSafeSpot--;
                m_uiEruptionTimer = 3500;
            } else m_uiEruptionTimer-=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();
    }