2024-12-21 10:04:04 +08:00
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
#include "PvPRoundMode.h"
|
|
|
|
|
|
#include "DNPvPGameRoom.h"
|
|
|
|
|
|
#include "DNUserSession.h"
|
|
|
|
|
|
#include "DnActor.h"
|
|
|
|
|
|
#include "DnPlayerActor.h"
|
|
|
|
|
|
#include "DnPvPGameTask.h"
|
|
|
|
|
|
#include "PvPRespawnLogic.h"
|
|
|
|
|
|
#include "DnStateBlow.h"
|
|
|
|
|
|
#include "DNMissionSystem.h"
|
|
|
|
|
|
#include "DNDBConnection.h"
|
|
|
|
|
|
|
|
|
|
|
|
CPvPRoundMode::CPvPRoundMode( CDNGameRoom* pGameRoom, const TPvPGameModeTable* pPvPGameModeTable, const MAGAPVP_GAMEMODE* pPacket )
|
|
|
|
|
|
:CPvPGameMode( pGameRoom, pPvPGameModeTable, pPacket ),m_bFinishRoundFlag(false)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_dwCheckAllDeadTick = 0;
|
|
|
|
|
|
m_fFinishRoundDelta = 0.f;
|
|
|
|
|
|
#if defined(PRE_ADD_PVP_TOURNAMENT)
|
|
|
|
|
|
m_cTournamentStep = pPacket->cMaxUser;
|
|
|
|
|
|
m_cTournamentStepCount = 0 ;
|
|
|
|
|
|
m_cCurrentTournamentStep = 0;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CPvPRoundMode::~CPvPRoundMode()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::Process( LOCAL_TIME LocalTime, float fDelta )
|
|
|
|
|
|
{
|
|
|
|
|
|
if( m_bFinishRoundFlag && !m_bFinishGameModeFlag )
|
|
|
|
|
|
{
|
|
|
|
|
|
bool bCheck = true;
|
|
|
|
|
|
if( m_fFinishRoundDelta >= PvPCommon::Common::RoundModeFinishDelta )
|
|
|
|
|
|
bCheck = false;
|
|
|
|
|
|
|
|
|
|
|
|
m_fFinishRoundDelta -= fDelta;
|
|
|
|
|
|
if( bCheck && m_fFinishRoundDelta <= 0.f )
|
|
|
|
|
|
_OnStartRound();
|
|
|
|
|
|
else
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( _CanProcess() == false )
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
CPvPGameMode::Process( LocalTime, fDelta );
|
|
|
|
|
|
_OnAfterProcess();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::_OnAfterProcess()
|
|
|
|
|
|
{
|
|
|
|
|
|
if( m_bStartGameModeFlag && m_fStartDelta <= 0.f && !m_bFinishRoundFlag )
|
|
|
|
|
|
{
|
|
|
|
|
|
if( timeGetTime()-m_dwCheckAllDeadTick >= 500 )
|
|
|
|
|
|
{
|
|
|
|
|
|
OnCheckFinishRound( PvPCommon::FinishReason::OpponentTeamAllDead );
|
|
|
|
|
|
m_dwCheckAllDeadTick = timeGetTime();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CPvPRoundMode::bIsPlayingUser( DnActorHandle hActor )
|
|
|
|
|
|
{
|
|
|
|
|
|
if( !hActor || !hActor->GetName() || !hActor->IsPlayerActor() )
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if( !CPvPGameMode::bIsPlayingUser( hActor ) )
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// SessionState <20>˻<EFBFBD>
|
|
|
|
|
|
CDnPlayerActor* pPlayer = static_cast<CDnPlayerActor *>(hActor.GetPointer());
|
|
|
|
|
|
CDNUserSession* pGameSession = pPlayer->GetUserSession();
|
|
|
|
|
|
if( !pGameSession )
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if( pGameSession->GetState() != SESSION_STATE_GAME_PLAY )
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
return (m_mBreakInto.find( hActor->GetName() ) == m_mBreakInto.end()) ? true : false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CPvPRoundMode::bIsFirstRound()
|
|
|
|
|
|
{
|
|
|
|
|
|
UINT uiATeamScore, uiBTeamScore;
|
|
|
|
|
|
m_pScoreSystem->GetGameModeScore( uiATeamScore, uiBTeamScore );
|
|
|
|
|
|
|
|
|
|
|
|
if( uiATeamScore == 0 && uiBTeamScore == 0 )
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RoundMode<64><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0> <20><>Ű<EFBFBD><C5B0> <20>ʴ´<CAB4>.
|
|
|
|
|
|
void CPvPRoundMode::OnFinishProcessDie( DnActorHandle hActor )
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::OnCheckFinishRound( PvPCommon::FinishReason::eCode Reason )
|
|
|
|
|
|
{
|
|
|
|
|
|
UINT uiWinTeam = PvPCommon::Team::Max;
|
|
|
|
|
|
|
|
|
|
|
|
switch( Reason )
|
|
|
|
|
|
{
|
|
|
|
|
|
case PvPCommon::FinishReason::OpponentTeamAllGone:
|
|
|
|
|
|
{
|
|
|
|
|
|
uiWinTeam = OnCheckZeroUserWinTeam();
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case PvPCommon::FinishReason::TimeOver:
|
|
|
|
|
|
{
|
|
|
|
|
|
UINT uiATeamUser = 0;
|
|
|
|
|
|
UINT uiBTeamUser = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|
|
|
|
|
{
|
|
|
|
|
|
CDNGameRoom::PartyStruct* pPartyStruct = GetGameRoom()->GetPartyData(i);
|
|
|
|
|
|
if( !pPartyStruct->pSession )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
DnActorHandle hActor = pPartyStruct->pSession->GetActorHandle();
|
|
|
|
|
|
if( !hActor )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if( !bIsPlayingUser( hActor ) )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if( hActor->IsDie() )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if( hActor->GetTeam() == PvPCommon::Team::A )
|
|
|
|
|
|
++uiATeamUser;
|
|
|
|
|
|
else if( hActor->GetTeam() == PvPCommon::Team::B )
|
|
|
|
|
|
++uiBTeamUser;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( uiATeamUser > uiBTeamUser )
|
|
|
|
|
|
uiWinTeam = PvPCommon::Team::A;
|
|
|
|
|
|
else if( uiBTeamUser > uiATeamUser )
|
|
|
|
|
|
uiWinTeam = PvPCommon::Team::B;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case PvPCommon::FinishReason::OpponentTeamAllDead:
|
|
|
|
|
|
{
|
|
|
|
|
|
UINT uiCheckBit = 0;
|
|
|
|
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|
|
|
|
|
{
|
|
|
|
|
|
CDNGameRoom::PartyStruct* pPartyStruct = GetGameRoom()->GetPartyData(i);
|
|
|
|
|
|
if( !pPartyStruct->pSession )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
DnActorHandle hActor = pPartyStruct->pSession->GetActorHandle();
|
|
|
|
|
|
if( !hActor )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if( !bIsPlayingUser( hActor ) )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if( hActor->IsDie() )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if( hActor->GetTeam() == PvPCommon::Team::A )
|
|
|
|
|
|
uiCheckBit |= 1;
|
|
|
|
|
|
else if( hActor->GetTeam() == PvPCommon::Team::B )
|
|
|
|
|
|
uiCheckBit |= 2;
|
|
|
|
|
|
if( uiCheckBit == 3 )
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( uiCheckBit )
|
|
|
|
|
|
uiWinTeam = (uiCheckBit==1) ? PvPCommon::Team::A : PvPCommon::Team::B;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case PvPCommon::FinishReason::LadderNoGame:
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_ProcessFinishRound( uiWinTeam, Reason );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::_ProcessFinishRound( const UINT uiWinTeam, PvPCommon::FinishReason::eCode Reason )
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
if( m_bFinishRoundFlag )
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// Round<6E><64><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
m_bFinishRoundFlag = true;
|
|
|
|
|
|
m_fFinishRoundDelta = PvPCommon::Common::RoundModeFinishDelta;
|
|
|
|
|
|
|
|
|
|
|
|
// ResapwnLogic <20><> <20><><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20>˸<EFBFBD>
|
|
|
|
|
|
if( m_pGameRoom && m_pGameRoom->GetGameTask() && ((CDnPvPGameTask*)m_pGameRoom->GetGameTask())->GetRespawnLogic() )
|
|
|
|
|
|
((CDnPvPGameTask*)m_pGameRoom->GetGameTask())->GetRespawnLogic()->FinishRound();
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
// Score<72><65><EFBFBD><EFBFBD>
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
UINT uiATeamScore, uiBTeamScore;
|
|
|
|
|
|
GetGameModeScore( uiATeamScore, uiBTeamScore );
|
|
|
|
|
|
if( uiWinTeam == PvPCommon::Team::A )
|
|
|
|
|
|
++uiATeamScore;
|
|
|
|
|
|
else if( uiWinTeam == PvPCommon::Team::B )
|
|
|
|
|
|
++uiBTeamScore;
|
|
|
|
|
|
m_pScoreSystem->SetGameModeScore( uiATeamScore, uiBTeamScore );
|
|
|
|
|
|
m_pScoreSystem->FinishRound( GetGameRoom(), uiWinTeam );
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|
|
|
|
|
{
|
|
|
|
|
|
CDNGameRoom::PartyStruct* pPartyStruct = GetGameRoom()->GetPartyData(i);
|
|
|
|
|
|
// SESSION_STATE_GAME_PLAY <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
|
|
|
|
|
if( pPartyStruct->pSession && pPartyStruct->pSession->GetState() == SESSION_STATE_GAME_PLAY )
|
|
|
|
|
|
{
|
|
|
|
|
|
DnActorHandle hActor = pPartyStruct->pSession->GetActorHandle();
|
|
|
|
|
|
if( hActor && bIsPlayingUser( hActor ) )
|
|
|
|
|
|
{
|
|
|
|
|
|
bool bIsWin = false;
|
|
|
|
|
|
if( uiWinTeam != PvPCommon::Team::Max )
|
|
|
|
|
|
bIsWin = (uiWinTeam == hActor->GetTeam() ? true : false);
|
|
|
|
|
|
|
|
|
|
|
|
_ProcessFinishRoundMode( pPartyStruct->pSession, bIsWin, uiWinTeam, Reason );
|
|
|
|
|
|
m_pScoreSystem->OnFinishRound( hActor, bIsWin );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
// <20><><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
// 1.<2E>¸<EFBFBD><C2B8><EFBFBD><EFBFBD>ǿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD> <20>˻<EFBFBD><CBBB>غ<EFBFBD><D8BA><EFBFBD>.
|
|
|
|
|
|
UINT uiMaxScore = max( uiATeamScore, uiBTeamScore );
|
|
|
|
|
|
|
|
|
|
|
|
UINT uiCheckScore = uiMaxScore;
|
|
|
|
|
|
if( bIsZombieMode() == true )
|
|
|
|
|
|
uiCheckScore = uiATeamScore+uiBTeamScore;
|
|
|
|
|
|
if( _CheckFinishGameMode( const_cast<UINT&>(uiWinTeam) ) || (_CheckWinContition()&& uiCheckScore >= m_uiWinCondition ) )
|
|
|
|
|
|
return FinishGameMode( uiWinTeam, PvPCommon::FinishReason::AchieveWinCondition );
|
|
|
|
|
|
// 2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̱<EFBFBD><CCB1><EFBFBD>.
|
|
|
|
|
|
else if( Reason == PvPCommon::FinishReason::OpponentTeamAllGone || Reason == PvPCommon::FinishReason::OpponentCaptainGone )
|
|
|
|
|
|
{
|
|
|
|
|
|
bool bFinish = false;
|
|
|
|
|
|
#if defined(PRE_ADD_PVP_TOURNAMENT)
|
|
|
|
|
|
if (bIsZombieMode() == false && bIsTournamentMode() == false)
|
|
|
|
|
|
#else
|
|
|
|
|
|
if (bIsZombieMode() == false)
|
|
|
|
|
|
#endif
|
|
|
|
|
|
bFinish = true;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>带 üũ<C3BC>Ѵ<EFBFBD>. 1<><31><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>!
|
|
|
|
|
|
if (GetGameRoom()->GetUserCountWithoutGM()-GetGameRoom()->GetUserCount(PvPCommon::Team::Observer) <= 1)
|
|
|
|
|
|
bFinish = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 3.<2E><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>带 <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD><D6B4><EFBFBD> <20>˻<EFBFBD>.
|
|
|
|
|
|
if (bFinish)
|
|
|
|
|
|
{
|
|
|
|
|
|
if( OnCheckZeroUserWinTeam( false ) != PvPCommon::Team::Max )
|
|
|
|
|
|
return FinishGameMode( uiWinTeam, PvPCommon::FinishReason::OpponentTeamAllGone );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#if defined(PRE_ADD_DWC)
|
|
|
|
|
|
if( GetGameRoom()->bIsLadderRoom() && !static_cast<CDNPvPGameRoom*>(GetGameRoom())->bIsDWCMatch() )
|
|
|
|
|
|
#else
|
|
|
|
|
|
if( GetGameRoom()->bIsLadderRoom() )
|
|
|
|
|
|
#endif
|
|
|
|
|
|
{
|
|
|
|
|
|
if( Reason == PvPCommon::FinishReason::LadderNoGame )
|
|
|
|
|
|
return FinishGameMode( uiWinTeam, PvPCommon::FinishReason::LadderNoGame );
|
|
|
|
|
|
|
|
|
|
|
|
return FinishGameMode( uiWinTeam, PvPCommon::FinishReason::LadderDraw );
|
|
|
|
|
|
}
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
//=============================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
_FinishRound( uiWinTeam, Reason );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::OnSuccessBreakInto( CDNUserSession* pGameSession )
|
|
|
|
|
|
{
|
|
|
|
|
|
CPvPGameMode::OnSuccessBreakInto( pGameSession );
|
|
|
|
|
|
|
|
|
|
|
|
// 1.<2E><><EFBFBD>Ӹ<EFBFBD><D3B8>尡 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PvPRound<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ٰ<EFBFBD><D9B0>̾<EFBFBD><CCBE><EFBFBD>.
|
|
|
|
|
|
if( m_bFinishGameModeFlag )
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// 2.PvPRound<6E><64><EFBFBD>尡 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> <20>ο<EFBFBD>
|
|
|
|
|
|
if( m_bFinishRoundFlag )
|
|
|
|
|
|
{
|
|
|
|
|
|
DnActorHandle hActor = pGameSession->GetActorHandle();
|
|
|
|
|
|
if( hActor )
|
|
|
|
|
|
{
|
|
|
|
|
|
int iDurationTime = static_cast<int>(m_fFinishRoundDelta*1000);
|
|
|
|
|
|
if( iDurationTime > 0 )
|
|
|
|
|
|
hActor->CDnActor::AddStateBlow( STATE_BLOW::BLOW_099, NULL, iDurationTime, "-1" );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 3.PvPRound<6E><64><EFBFBD>尡 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ɻ<EFBFBD><C9BB>·<EFBFBD> <20>ִ´<D6B4>.
|
|
|
|
|
|
else if( GetRemainStartTick() == 0 )
|
|
|
|
|
|
{
|
|
|
|
|
|
// 4.ù<><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD>(10sec) <20>̳<EFBFBD><CCB3><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>Ѵ<EFBFBD>.
|
|
|
|
|
|
if( bIsFirstRound() && bIsInPlayTime( 10 ) )
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// 4.<2E><> <20>ƴ϶<C6B4><CFB6><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD>ɻ<EFBFBD><C9BB>·<EFBFBD>~~
|
|
|
|
|
|
DnActorHandle hActor = pGameSession->GetActorHandle();
|
|
|
|
|
|
if( hActor )
|
|
|
|
|
|
{
|
|
|
|
|
|
m_mBreakInto.insert( std::make_pair( hActor->GetName(), pGameSession) );
|
|
|
|
|
|
|
|
|
|
|
|
CDnPlayerActor* pPlayer = static_cast<CDnPlayerActor *>(hActor.GetPointer());
|
|
|
|
|
|
pPlayer->CmdRefreshHPSP( 0,0 );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::OnRebirth( DnActorHandle hActor, bool bForce/*=false*/ )
|
|
|
|
|
|
{
|
|
|
|
|
|
if( m_bFinishRoundFlag )
|
|
|
|
|
|
CPvPGameMode::OnRebirth( hActor, true );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::OnDie( DnActorHandle hActor, DnActorHandle hHitter )
|
|
|
|
|
|
{
|
|
|
|
|
|
CPvPGameMode::OnDie( hActor, hHitter );
|
|
|
|
|
|
|
|
|
|
|
|
OnCheckFinishRound( PvPCommon::FinishReason::OpponentTeamAllDead );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::OnLeaveUser( DnActorHandle hActor )
|
|
|
|
|
|
{
|
|
|
|
|
|
CPvPGameMode::OnLeaveUser( hActor );
|
|
|
|
|
|
|
|
|
|
|
|
if( hActor )
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* pwName = hActor->GetName();
|
|
|
|
|
|
if( pwName )
|
|
|
|
|
|
m_mBreakInto.erase( pwName );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined( PRE_MOD_PVP_ROUNDMODE_PENALTY )
|
|
|
|
|
|
void CPvPRoundMode::GetFinishRoundPenalty( const UINT uiWinTeam, OUT UINT& uiPenaltyPercent )
|
|
|
|
|
|
{
|
|
|
|
|
|
uiPenaltyPercent = 0;
|
|
|
|
|
|
|
|
|
|
|
|
UINT uiWinConditionScore = GetSelectWinCondition();
|
|
|
|
|
|
UINT uiATeamScore = 0;
|
|
|
|
|
|
UINT uiBTeamScore = 0;
|
|
|
|
|
|
|
|
|
|
|
|
GetGameModeScore(uiATeamScore, uiBTeamScore);
|
|
|
|
|
|
|
|
|
|
|
|
UINT uiWinTeamScore = 0;
|
|
|
|
|
|
if( PvPCommon::Team::A == uiWinTeam )
|
|
|
|
|
|
uiWinTeamScore = uiATeamScore;
|
|
|
|
|
|
if( PvPCommon::Team::B == uiWinTeam )
|
|
|
|
|
|
uiWinTeamScore = uiBTeamScore;
|
|
|
|
|
|
|
|
|
|
|
|
UINT uiDefaultPercent = 100;
|
|
|
|
|
|
if(0 < uiWinConditionScore)
|
|
|
|
|
|
{
|
|
|
|
|
|
uiDefaultPercent = uiWinTeamScore * 100 / uiWinConditionScore;
|
|
|
|
|
|
uiDefaultPercent = min(uiDefaultPercent, 100);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uiPenaltyPercent = 100 - uiDefaultPercent;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // #if defined( PRE_MOD_PVP_ROUNDMODE_PENALTY )
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::_OnStartRound()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_bFinishRoundFlag = false;
|
|
|
|
|
|
m_bStartGameModeFlag = false;
|
|
|
|
|
|
|
|
|
|
|
|
m_mBreakInto.clear();
|
|
|
|
|
|
|
|
|
|
|
|
m_pScoreSystem->OnStartRound();
|
|
|
|
|
|
|
|
|
|
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|
|
|
|
|
{
|
|
|
|
|
|
CDNGameRoom::PartyStruct* pPartyStruct = GetGameRoom()->GetPartyData(i);
|
|
|
|
|
|
if( pPartyStruct->pSession )
|
|
|
|
|
|
{
|
|
|
|
|
|
DnActorHandle hActor = pPartyStruct->pSession->GetActorHandle();
|
|
|
|
|
|
|
|
|
|
|
|
// 1. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
|
|
|
|
|
if( hActor )
|
|
|
|
|
|
hActor->OnInitializePVPRoundRestart();
|
|
|
|
|
|
|
|
|
|
|
|
// 2. <20><><EFBFBD>ο<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˸<EFBFBD><CBB8><EFBFBD>.
|
|
|
|
|
|
pPartyStruct->pSession->SendPvPRoundStart();
|
|
|
|
|
|
|
|
|
|
|
|
if( hActor && pPartyStruct->pSession->GetState() == SESSION_STATE_GAME_PLAY )
|
|
|
|
|
|
{
|
|
|
|
|
|
DN_ASSERT( m_pGameRoom->bIsPvPRoom() == true, "CPvPRoundMode::_OnStartRound() m_pGameRoom->bIsPvPRoom() == true" );
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8> <20><><EFBFBD>ش<EFBFBD>
|
|
|
|
|
|
CDnWeapon::ReleaseClass( GetGameRoom(), CDnWeapon::Projectile );
|
|
|
|
|
|
|
|
|
|
|
|
// InstantItem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
|
pPartyStruct->pSession->GetItem()->RemoveInstantItemData( true );
|
|
|
|
|
|
|
|
|
|
|
|
CDNPvPGameRoom* pPvPGameRoom = static_cast<CDNPvPGameRoom*>(m_pGameRoom);
|
|
|
|
|
|
pPvPGameRoom->CmdPvPStartAddStateEffect( hActor, _GetPvPRoundStartStateEffectDurationTick(), true );
|
|
|
|
|
|
|
|
|
|
|
|
// 4.Respawn <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>̵<EFBFBD>
|
|
|
|
|
|
_OnStartRoundStartPosition( hActor );
|
|
|
|
|
|
|
|
|
|
|
|
hActor->GetStateBlow()->Process( 0, 0.f, true );
|
|
|
|
|
|
|
|
|
|
|
|
// 5.HP/SP <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
_OnRefreshHPSP( hActor );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::_OnStartRoundStartPosition( DnActorHandle hActor )
|
|
|
|
|
|
{
|
|
|
|
|
|
_SetRespawnPosition( hActor, true );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPvPRoundMode::_FinishRound( const UINT uiWinTeam, PvPCommon::FinishReason::eCode Reason )
|
|
|
|
|
|
{
|
|
|
|
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|
|
|
|
|
{
|
|
|
|
|
|
CDNGameRoom::PartyStruct* pPartyStruct = GetGameRoom()->GetPartyData(i);
|
|
|
|
|
|
if( pPartyStruct->pSession )
|
|
|
|
|
|
{
|
|
|
|
|
|
if( pPartyStruct->pSession->GetState() == SESSION_STATE_GAME_PLAY )
|
|
|
|
|
|
{
|
|
|
|
|
|
// Observer <20><> ActorHandle <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD>Ѵ<EFBFBD>. - <20><><EFBFBD><EFBFBD> -
|
|
|
|
|
|
// 1. PvPRoundMode <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˷<EFBFBD><CBB7>ش<EFBFBD>.
|
|
|
|
|
|
#if defined(PRE_ADD_PVP_TOURNAMENT)
|
|
|
|
|
|
pPartyStruct->pSession->SendPvPRoundFinish( uiWinTeam, Reason, this, m_uiWinSessionID, m_cCurrentTournamentStep );
|
|
|
|
|
|
#else
|
|
|
|
|
|
pPartyStruct->pSession->SendPvPRoundFinish( uiWinTeam, Reason, this );
|
|
|
|
|
|
#endif // #if defined(PRE_ADD_PVP_TOURNAMENT)
|
|
|
|
|
|
DnActorHandle hActor = pPartyStruct->pSession->GetActorHandle();
|
|
|
|
|
|
if( !hActor )
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
INT64 iHP = hActor->GetHP();
|
|
|
|
|
|
|
|
|
|
|
|
// 2. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
|
|
|
|
|
// Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ SC_FINISH_PVPROUND <20><> ó<><C3B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٲ<EFBFBD><D9B2>ش<EFBFBD>.
|
|
|
|
|
|
hActor->OnInitializePVPRoundRestart();
|
|
|
|
|
|
|
|
|
|
|
|
INT64 iHP2 = hActor->GetHP();
|
|
|
|
|
|
|
|
|
|
|
|
// 3. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>Ϳ<EFBFBD><CDBF>Ը<EFBFBD>
|
|
|
|
|
|
if( !hActor->IsDie() )
|
|
|
|
|
|
{
|
|
|
|
|
|
// 3-1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD><C3B0><EFBFBD>ŭ <20><><EFBFBD><EFBFBD>Blow <20>ɾ<EFBFBD><C9BE>ش<EFBFBD>.
|
|
|
|
|
|
int iDurationTime = static_cast<int>(m_fFinishRoundDelta*1000);
|
|
|
|
|
|
hActor->CDnActor::AddStateBlow( STATE_BLOW::BLOW_099, NULL, iDurationTime, "-1" );
|
|
|
|
|
|
#if defined(PRE_ADD_PVP_TOURNAMENT)
|
|
|
|
|
|
if( bIsAllKillMode() || bIsTournamentMode() )
|
|
|
|
|
|
#else
|
|
|
|
|
|
if( bIsAllKillMode() )
|
|
|
|
|
|
#endif // #if defined(PRE_ADD_PVP_TOURNAMENT)
|
|
|
|
|
|
static_cast<CDNPvPGameRoom*>(m_pGameRoom)->CmdPvPStartAddStateEffect( hActor, -1, true );
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// 3-2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Blow <20>ɾ<EFBFBD><C9BE>ش<EFBFBD>.
|
|
|
|
|
|
static_cast<CDNPvPGameRoom*>(m_pGameRoom)->CmdObserverAddStateEffect( hActor );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OnFinishRound();
|
|
|
|
|
|
}
|