Exemplo n.º 1
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiAbilityCount == 2)
        {
            if (m_uiPhaseChangeTimer < uiDiff)
                DoPhaseSwitch();
            else
                m_uiPhaseChangeTimer -= uiDiff;
        }

        if (m_bIsTrollPhase)
        {
            if (m_uiPunctureTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_PUNCTURE : SPELL_PUNCTURE_H);
                m_uiPunctureTimer = 25000;
            }
            else
                m_uiPunctureTimer -= uiDiff;

            if (m_uiStampedeTimer < uiDiff)
            {
                switch(urand(0, 2))
                {
                    case 0: DoScriptText(SAY_SUMMON_1, m_creature); break;
                    case 1: DoScriptText(SAY_SUMMON_2, m_creature); break;
                    case 2: DoScriptText(SAY_SUMMON_3, m_creature); break;
                }

                DoCastSpellIfCan(m_creature->getVictim(), SPELL_STAMPEDE);
                m_uiStampedeTimer = 15000;
            }
            else
                m_uiStampedeTimer -= uiDiff;

            if (m_uiSpecialAbilityTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_WHIRLING_SLASH : SPELL_WHIRLING_SLASH_H) == CAST_OK)
                    m_uiSpecialAbilityTimer = 12000;

                ++m_uiAbilityCount;
            }
            else
                m_uiSpecialAbilityTimer -= uiDiff;

        }
        else
        {
            if (m_uiEnrageTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_ENRAGE : SPELL_ENRAGE_H);
                m_uiEnrageTimer = 15000;
            }
            else
                m_uiEnrageTimer -= uiDiff;

            if (m_uiStompTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_STOMP : SPELL_STOMP_H);
                m_uiStompTimer = 10000;
            }
            else
                m_uiStompTimer -= uiDiff;

            if (m_uiSpecialAbilityTimer < uiDiff)
            {
                Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);

                if (DoCastSpellIfCan(pTarget ? pTarget : m_creature->getVictim(), m_bIsRegularMode ? SPELL_IMPALING_CHARGE : SPELL_IMPALING_CHARGE_H) == CAST_OK)
                {
                    DoScriptText(EMOTE_IMPALED, m_creature, pTarget);
                    m_uiSpecialAbilityTimer = 12000;

                    ++m_uiAbilityCount;
                }
            }
            else
                m_uiSpecialAbilityTimer -= uiDiff;
        }

        DoMeleeAttackIfReady();
    }
Exemplo n.º 2
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_bIsImpaled)
        {
            if (m_uiImpaleEndTimer < uiDiff)
            {
                if (m_creature->GetVehicleKit())
                    m_creature->GetVehicleKit()->RemoveAllPassengers();
                m_bIsImpaled = false;
            }
            else
                m_uiImpaleEndTimer -= uiDiff;
        }
        
        if (m_uiAbilityCount == 2)
        {
            if (m_uiPhaseChangeTimer < uiDiff)
                DoPhaseSwitch();
            else
                m_uiPhaseChangeTimer -= uiDiff;
        }

        if (m_bIsTrollPhase)
        {
            if (m_uiPunctureTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_PUNCTURE : SPELL_PUNCTURE_H);
                m_uiPunctureTimer = 25000;
            }
            else
                m_uiPunctureTimer -= uiDiff;

            if (m_uiStampedeTimer < uiDiff)
            {
                switch(urand(0, 2))
                {
                    case 0: DoScriptText(SAY_SUMMON_1, m_creature); break;
                    case 1: DoScriptText(SAY_SUMMON_2, m_creature); break;
                    case 2: DoScriptText(SAY_SUMMON_3, m_creature); break;
                }

                DoCastSpellIfCan(m_creature->getVictim(), SPELL_STAMPEDE);
                m_uiStampedeTimer = 15000;
            }
            else
                m_uiStampedeTimer -= uiDiff;

            if (m_uiSpecialAbilityTimer < uiDiff)
            {
                if (SpellEntry* pTempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(m_bIsRegularMode ? SPELL_WHIRLING_SLASH : SPELL_WHIRLING_SLASH_H))
                {
                    pTempSpell->Effect[2] = 0;
                    m_creature->CastSpell(m_creature->getVictim(), pTempSpell, false);
                }

                m_uiSpecialAbilityTimer = 12000;
                ++m_uiAbilityCount;
            }
            else
                m_uiSpecialAbilityTimer -= uiDiff;

        }
        else
        {
            if (m_uiEnrageTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_ENRAGE : SPELL_ENRAGE_H);
                m_uiEnrageTimer = 15000;
            }
            else
                m_uiEnrageTimer -= uiDiff;

            if (m_uiStompTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_STOMP : SPELL_STOMP_H);
                m_uiStompTimer = 10000;
            }
            else
                m_uiStompTimer -= uiDiff;

            if (m_uiSpecialAbilityTimer < uiDiff)
            {
                Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);

                if (!pTarget)
                    pTarget = m_creature->getVictim();

                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_IMPALING_CHARGE : SPELL_IMPALING_CHARGE_H) == CAST_OK)
                {
                    DoScriptText(EMOTE_IMPALED, m_creature, pTarget);
                    m_uiSpecialAbilityTimer = 12000;
                    pTarget->EnterVehicle(m_creature->GetVehicleKit(), 0);
                    m_uiImpaleEndTimer = 5000;
                    m_bIsImpaled = true;

                    ++m_uiAbilityCount;
                }
            }
            else
                m_uiSpecialAbilityTimer -= uiDiff;
        }

        DoMeleeAttackIfReady();
    }