Example #1
0
    void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage, DamageEffectType /*damagetype*/) override
    {
        if (uiDamage < m_creature->GetHealth())
            return;

        if (!m_pInstance)
            return;

        // Don't allow any accident
        if (m_bEggsExploded)
        {
            uiDamage = 0;
            return;
        }

        // Boss explodes everything and resets - this happens if not all eggs are destroyed
        if (m_pInstance->GetData(TYPE_RAZORGORE) == IN_PROGRESS)
        {
            uiDamage = 0;
            m_bEggsExploded = true;
            m_pInstance->SetData(TYPE_RAZORGORE, FAIL);
            DoScriptText(SAY_RAZORGORE_DEATH, m_creature);
            m_creature->CastSpell(m_creature, SPELL_FIREBALL, TRIGGERED_OLD_TRIGGERED);
            m_creature->ForcedDespawn(5000);
        }
    }
    void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) override
    {
        if (uiDamage < m_creature->GetHealth())
            return;

        if (!m_pInstance)
            return;

        // Don't allow any accident
        if (m_bEggsExploded)
        {
            uiDamage = 0;
            return;
        }

        // Boss explodes everything and resets - this happens if not all eggs are destroyed
        if (m_pInstance->GetData(TYPE_RAZORGORE) == IN_PROGRESS)
        {
            uiDamage = 0;
            m_bEggsExploded = true;
            m_pInstance->SetData(TYPE_RAZORGORE, FAIL);
            DoCastSpellIfCan(m_creature, SPELL_EXPLODE_ORB, CAST_TRIGGERED);
            m_creature->ForcedDespawn();
        }
    }
    void JustDied(Unit* /*pKiller*/) override
    {
        if (m_pInstance)
        {
            // Don't set instance data unless all eggs are destroyed
            if (m_pInstance->GetData(TYPE_RAZORGORE) != SPECIAL)
                return;

            m_pInstance->SetData(TYPE_RAZORGORE, DONE);
        }

        DoScriptText(SAY_DEATH, m_creature);
    }
Example #4
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;
        }
    }
Example #5
0
 void JustReachedHome() override
 {
     if (m_pInstance)
         m_pInstance->SetData(TYPE_RAZORGORE, FAIL);
 }
    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();
    }