// 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(); } } }
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; } }