Пример #1
0
    void UpdateAI(const uint32 uiDiff) override
    {
        // Set visual only on OOC timer
        if (m_uiIntroVisualTimer)
        {
            if (m_uiIntroVisualTimer <= uiDiff)
            {
                if (!m_pInstance)
                {
                    script_error_log("Instance Blackwing Lair: ERROR Failed to load instance data for this instace.");
                    return;
                }

                // If Razorgore is not respawned yet: wait
                if (Creature* pRazorgore = m_pInstance->GetSingleCreatureFromStorage(NPC_RAZORGORE))
                {
                    if (!(pRazorgore->isAlive()))
                    {
                        m_uiIntroVisualTimer = 2000;
                        return;
                    }
                }

                // If Grethok the Controller is here and spawned, start the visual, else wait for him
                if (Creature* pGrethok = GetClosestCreatureWithEntry(m_creature, NPC_GRETHOK_CONTROLLER, 2.0f))
                {
                    if (pGrethok->isAlive())
                    {
                        m_creature->CastSpell(m_creature, SPELL_POSSESS_VISUAL, TRIGGERED_OLD_TRIGGERED);
                        pGrethok->CastSpell(pGrethok, SPELL_CONTROL_ORB, TRIGGERED_OLD_TRIGGERED);
                        m_uiIntroVisualTimer = 0;
                    }
                }
                else
                    m_uiIntroVisualTimer = 2000;
            }
            else
                m_uiIntroVisualTimer -= uiDiff;
        }
    }
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            // Set visual only on OOC timer
            if (m_uiIntroVisualTimer)
            {
                if (m_uiIntroVisualTimer <= uiDiff)
                {
                    if (!m_pInstance)
                    {
                        script_error_log("Instance Blackwing Lair: ERROR Failed to load instance data for this instace.");
                        return;
                    }

                    if (Creature* pOrbTrigger = m_pInstance->GetSingleCreatureFromStorage(NPC_BLACKWING_ORB_TRIGGER))
                        pOrbTrigger->CastSpell(m_creature, SPELL_POSSESS, TRIGGERED_NONE);
                    m_uiIntroVisualTimer = 0;
                }
                else
                    m_uiIntroVisualTimer -= uiDiff;
            }

            return;
        }

        // Cleave
        if (m_uiCleaveTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK)
                m_uiCleaveTimer = urand(4000, 8000);
        }
        else
            m_uiCleaveTimer -= uiDiff;

        // War Stomp
        if (m_uiWarStompTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_WARSTOMP) == CAST_OK)
                m_uiWarStompTimer = 30000;
        }
        else
            m_uiWarStompTimer -= uiDiff;

        // Fireball Volley
        if (m_uiFireballVolleyTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_FIREBALL_VOLLEY) == CAST_OK)
                m_uiFireballVolleyTimer = urand(15000, 20000);
        }
        else
            m_uiFireballVolleyTimer -= uiDiff;

        // Conflagration
        if (m_uiConflagrationTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_CONFLAGRATION) == CAST_OK)
                m_uiConflagrationTimer = urand(15000, 25000);
        }
        else
            m_uiConflagrationTimer -= uiDiff;

        /* This is obsolete code, not working anymore, keep as reference, should be handled in core though
        * // Aura Check. If the gamer is affected by confliguration we attack a random gamer.
        * if (m_creature->getVictim()->HasAura(SPELL_CONFLAGRATION, EFFECT_INDEX_0))
        * {
        *     if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
        *         m_creature->TauntApply(pTarget);
        * }
        */

        DoMeleeAttackIfReady();
    }