Ejemplo n.º 1
0
    // function that will make the champion to use the nearby available mount
    void DoUseNearbyMountIfCan()
    {
        if (!m_pInstance)
            return;

        // set instance data as special if first part is completed
        if (m_pInstance->IsArenaChallengeComplete(TYPE_ARENA_CHALLENGE))
            m_pInstance->SetData(TYPE_ARENA_CHALLENGE, SPECIAL);
        else
        {
            m_creature->SetStandState(UNIT_STAND_STATE_STAND);

            float fX, fY, fZ;
            uint32 uiMountEntry = m_pInstance->GetMountEntryForChampion();

            if (Creature* pMount = GetClosestCreatureWithEntry(m_creature, uiMountEntry, 60.0f))
            {
                pMount->GetContactPoint(m_creature, fX, fY, fZ);
                m_creature->SetWalk(true);
                m_creature->GetMotionMaster()->Clear();
                m_creature->GetMotionMaster()->MovePoint(POINT_ID_MOUNT, fX, fY, fZ);

                m_newMountGuid = pMount->GetObjectGuid();
            }
        }
    }
Ejemplo n.º 2
0
    void JustReachedHome() override
    {
        if (m_pInstance)
            m_pInstance->SetData(TYPE_BLACK_KNIGHT, FAIL);

        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
    }
Ejemplo n.º 3
0
 void JustReachedHome() override
 {
     if (m_pInstance)
     {
         if (m_pInstance->GetData(TYPE_ARENA_CHALLENGE) == DONE)
             m_pInstance->SetData(TYPE_GRAND_CHAMPIONS, FAIL);
     }
 }
Ejemplo n.º 4
0
    void JustDied(Unit* /*pKiller*/) override
    {
        if (m_pInstance)
            m_pInstance->SetData(TYPE_BLACK_KNIGHT, DONE);

        DoScriptText(SAY_DEATH, m_creature);
        DoCastSpellIfCan(m_creature, SPELL_KILL_CREDIT, CAST_TRIGGERED);
    }
Ejemplo n.º 5
0
    void Aggro(Unit* pWho) override
    {
        if (m_pInstance)
        {
            if (m_pInstance->GetData(TYPE_ARENA_CHALLENGE) == DONE)
                m_pInstance->SetData(TYPE_GRAND_CHAMPIONS, IN_PROGRESS);

            m_pInstance->DoSetChamptionsInCombat(pWho);
        }
    }
Ejemplo n.º 6
0
    void DamageTaken(Unit* /*pDealer*/, uint32& uiDamage) override
    {
        if (uiDamage >= m_creature->GetHealth())
        {
            uiDamage = 0;

            if (m_bDefeated)
                return;

            if (m_pInstance)
            {
                // second part of the champions challenge
                if (m_pInstance->GetData(TYPE_ARENA_CHALLENGE) == DONE)
                {
                    m_creature->SetStandState(UNIT_STAND_STATE_KNEEL);
                    m_creature->SetHealth(1);

                    // no movement
                    SetCombatMovement(false);
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveIdle();

                    // check if the other champions are wounded and set instance data
                    if (m_pInstance->IsArenaChallengeComplete(TYPE_GRAND_CHAMPIONS))
                        m_pInstance->SetData(TYPE_GRAND_CHAMPIONS, DONE);
                }
                // first part of the champions challenge (arena encounter)
                else
                {
                    // unmount
                    if (Creature* pMount = (Creature*)m_creature->GetTransportInfo()->GetTransport())
                    {
                        pMount->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
                        pMount->ForcedDespawn();
                    }

                    m_creature->SetStandState(UNIT_STAND_STATE_DEAD);
                    m_creature->SetHealth(1);

                    // no movement
                    SetCombatMovement(false);
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveIdle();

                    m_uiDefeatedTimer = 15000;
                }
            }

            m_bDefeated = true;
        }
    }
Ejemplo n.º 7
0
    void MovementInform(uint32 uiMotionType, uint32 uiPointId) override
    {
        if (uiMotionType != POINT_MOTION_TYPE || !m_pInstance)
            return;

        switch (uiPointId)
        {
            case POINT_ID_MOUNT:
            {
                // mount the closest vehicle and start attacking
                uint32 uiMountEntry = m_pInstance->GetMountEntryForChampion();

                // search for the vehicle again, just in case the previous one was taken
                Creature* pMount = m_creature->GetMap()->GetCreature(m_newMountGuid);
                if (pMount->HasAura(SPELL_RIDE_ARGENT_VEHICLE))
                    pMount = GetClosestCreatureWithEntry(m_creature, uiMountEntry, 60.0f);

                // if we don't have any mount send an error
                if (!pMount)
                {
                    script_error_log("Instance Trial of the Champion: ERROR Failed to get a mount replacement for champion %u.", m_creature->GetEntry());
                    return;
                }

                DoCastSpellIfCan(pMount, SPELL_RIDE_ARGENT_VEHICLE, CAST_TRIGGERED);

                if (m_creature->getVictim())
                    pMount->AI()->AttackStart(m_creature->getVictim());

                m_bDefeated = false;
                break;
            }
            case POINT_ID_EXIT:
                // mark the first part as complete if required
                if (m_pInstance->GetData(TYPE_GRAND_CHAMPIONS) != DONE)
                    m_pInstance->SetData(TYPE_ARENA_CHALLENGE, DONE);

                m_creature->ForcedDespawn();
                break;
        }
    }
Ejemplo n.º 8
0
    void DamageTaken(Unit* /*pDealer*/, uint32& uiDamage) override
    {
        if (uiDamage >= m_creature->GetHealth())
        {
            uiDamage = 0;

            if (m_bDefeated)
                return;

            if (m_pInstance)
                m_pInstance->SetData(TYPE_ARGENT_CHAMPION, DONE);

            // Handle event completion
            DoHandleEventEnd();

            m_creature->SetFactionTemporary(FACTION_CHAMPION_FRIENDLY, TEMPFACTION_NONE);
            EnterEvadeMode();

            m_bDefeated = true;
        }
    }
Ejemplo n.º 9
0
 void JustReachedHome() override
 {
     if (m_pInstance && m_pInstance->GetData(TYPE_ARGENT_CHAMPION) != DONE)
         m_pInstance->SetData(TYPE_ARGENT_CHAMPION, FAIL);
 }
Ejemplo n.º 10
0
 void Aggro(Unit* /*pWho*/) override
 {
     if (m_pInstance)
         m_pInstance->SetData(TYPE_ARGENT_CHAMPION, IN_PROGRESS);
 }