DragonNest/Server/DNGameServer/PvPRespawnMode.cpp

94 lines
2.6 KiB
C++
Raw Permalink Normal View History

#include "stdafx.h"
#include "PvPRespawnMode.h"
#include "DNGameRoom.h"
#include "DNUserSession.h"
#include "DnActor.h"
#include "PvPScoreSystem.h"
CPvPRespawnMode::CPvPRespawnMode( CDNGameRoom* pGameRoom, const TPvPGameModeTable* pPvPGameModeTable, const MAGAPVP_GAMEMODE* pPacket )
:CPvPGameMode( pGameRoom, pPvPGameModeTable, pPacket )
{
}
CPvPRespawnMode::~CPvPRespawnMode()
{
}
// RespawnMode <20><> 1<><31><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GameMode <20><><EFBFBD><EFBFBD>
void CPvPRespawnMode::OnCheckFinishRound( PvPCommon::FinishReason::eCode Reason )
{
UINT uiWinTeam = PvPCommon::Team::Max;
switch( Reason )
{
case PvPCommon::FinishReason::OpponentTeamAllGone:
{
uiWinTeam = OnCheckZeroUserWinTeam();
if( uiWinTeam == PvPCommon::Team::Max )
return;
break;
}
case PvPCommon::FinishReason::AchieveWinCondition:
case PvPCommon::FinishReason::TimeOver:
{
uiWinTeam = OnCheckFinishWinTeam();
break;
}
default:
{
return;
}
}
// <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 )
m_pScoreSystem->OnFinishRound( hActor, (uiWinTeam == hActor->GetTeam() ? true : false) );
}
}
FinishGameMode( uiWinTeam, Reason );
}
void CPvPRespawnMode::OnDie( DnActorHandle hActor, DnActorHandle hHitter )
{
CPvPGameMode::OnDie( hActor, hHitter );
if( !(GetGameModeCheck()&PvPCommon::Check::CheckScore) )
return;
UINT uiATeamScore,uiBTeamScore;
GetGameModeScore( uiATeamScore, uiBTeamScore );
UINT uiMaxScore = max( uiATeamScore, uiBTeamScore );
// <20><><EFBFBD>ھ<EFBFBD>üũ
if( !bIsFinishFlag() && uiMaxScore >= GetSelectWinCondition() )
OnCheckFinishRound( PvPCommon::FinishReason::AchieveWinCondition );
}
// ProcessDie() <20><><EFBFBD><EFBFBD>
void CPvPRespawnMode::OnFinishProcessDie( DnActorHandle hActor )
{
if( hActor )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ <20><><EFBFBD><EFBFBD>
_SetRespawnPosition( hActor );
// <20><>Ȱ<EFBFBD><C8B0>Ŵ
UINT uiRespawnHPPercent = GetPvPGameModeTable() ? GetPvPGameModeTable()->uiRespawnHPPercent : 100;
UINT uiRespawnMPPercent = GetPvPGameModeTable() ? GetPvPGameModeTable()->uiRespawnMPPercent : 100;
UINT uiImmortalTime = GetPvPGameModeTable() ? GetPvPGameModeTable()->uiRespawnNoDamageTimeSec : 5;
char szParam[32];
sprintf_s( szParam, "Coin/%d/%d/%d", uiRespawnHPPercent, uiRespawnMPPercent, uiImmortalTime );
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_057, uiImmortalTime*1000, szParam );
}
}