示例#1
0
    void MovementInform(uint32 uiType, uint32 uiPointId) override
    {
        if (uiType != WAYPOINT_MOTION_TYPE || !m_pInstance)
            return;

        // Note: On blizz the left and right sides are randomly choosen.
        // However because of the lack of waypoint movement scripting we'll use them alternatively
        // Another note: the pointId in script = pointId - 1 from DB
        switch (uiPointId)
        {
        case 8:
        case 21:
            // TODO: choose the left / right patch random when core will support this
            DoScriptText(EMOTE_HARPOON_RANGE, m_creature);

            break;
        case 10:                                        // left breath
            if (DoCastSpellIfCan(m_creature, SPELL_FREEZING_CLOUD_LEFT) == CAST_OK)
            {
                DoHandleBreathYell();
                DoScriptText(EMOTE_DEEP_BREATH, m_creature);
            }

            // Set the achiev as failed once we get to breath area
            m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_LOVE_SKADI, false);
            break;
        case 13:                                        // left breath end
            m_creature->RemoveAurasDueToSpell(SPELL_FREEZING_CLOUD_LEFT);
            break;
        case 23:                                        // right breath
            if (DoCastSpellIfCan(m_creature, SPELL_FREEZING_CLOUD_RIGHT) == CAST_OK)
            {
                DoHandleBreathYell();
                DoScriptText(EMOTE_DEEP_BREATH, m_creature);
            }

            // Set the achiev as failed once we get to breath area
            m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_LOVE_SKADI, false);
            break;
        case 26:                                        // right breath end
            m_creature->RemoveAurasDueToSpell(SPELL_FREEZING_CLOUD_RIGHT);
            break;
        }
    }
示例#2
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (m_bCanMoveFree && m_uiMoveNextTimer)
        {
            if (m_uiMoveNextTimer <= uiDiff)
            {
                m_creature->GetMotionMaster()->MovePoint(m_uiWaypointId,
                        m_aDragonCommon[m_uiWaypointId].m_fX, m_aDragonCommon[m_uiWaypointId].m_fY, m_aDragonCommon[m_uiWaypointId].m_fZ);

                debug_log("dummy_dragonAI: %s moving to point %u", m_creature->GetName(), m_uiWaypointId);
                m_uiMoveNextTimer = 0;
            }
            else
                m_uiMoveNextTimer -= uiDiff;
        }

        // if no target return
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // Call dragon specific virtual function
        UpdateDragonAI(uiDiff);

        // respawn portal
        if (m_uiPortalRespawnTimer < uiDiff)
        {
            if (m_pInstance && m_pInstance->IsActivePortal())
                m_uiPortalRespawnTimer = 10000;
            else
            {
                m_uiPortalRespawnTimer = 60000;
                DoOpenPortal();
            }
        }
        else
            m_uiPortalRespawnTimer -= uiDiff;

        // shadow fissure
        if (m_uiShadowFissureTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
            {
                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_SHADOW_FISSURE : SPELL_SHADOW_FISSURE_H) == CAST_OK)
                    m_uiShadowFissureTimer = urand(15000, 20000);
            }
        }
        else
            m_uiShadowFissureTimer -= uiDiff;

        // shadow breath
        if (m_uiShadowBreathTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_SHADOW_BREATH : SPELL_SHADOW_BREATH_H) == CAST_OK)
            {
                DoHandleBreathYell();
                m_uiShadowBreathTimer = urand(20000, 25000);
            }
        }
        else
            m_uiShadowBreathTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }