570 lines
17 KiB
C++
570 lines
17 KiB
C++
|
|
|
|||
|
|
#include "stdafx.h"
|
|||
|
|
#include "PvPZombieMode.h"
|
|||
|
|
#include "DnActor.h"
|
|||
|
|
#include "DNUserSession.h"
|
|||
|
|
#include "DNPvPGameRoom.h"
|
|||
|
|
#include "DnPlayerActor.h"
|
|||
|
|
#include "DnStateBlow.h"
|
|||
|
|
#include "DNGameDataManager.h"
|
|||
|
|
#include "DNDBConnection.h"
|
|||
|
|
#include "DNMissionSystem.h"
|
|||
|
|
|
|||
|
|
CPvPZombieMode::CPvPZombieMode( CDNGameRoom* pGameRoom, const TPvPGameModeTable* pPvPGameModeTable, const MAGAPVP_GAMEMODE* pPacket )
|
|||
|
|
:CPvPRoundMode( pGameRoom, pPvPGameModeTable, pPacket )
|
|||
|
|
{
|
|||
|
|
memset(&m_MutationGroup, 0, sizeof(TMonsterMutationGroup));
|
|||
|
|
m_nGhoulCount = 0;
|
|||
|
|
m_bInitializeZombie = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CPvPZombieMode::~CPvPZombieMode()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnInitializeActor( CDNUserSession* pSession )
|
|||
|
|
{
|
|||
|
|
DnActorHandle hActor = pSession->GetActorHandle();
|
|||
|
|
if( !hActor )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if( pSession->GetTeam() == PvPCommon::Team::Observer )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
hActor->SetTeam( PvPCommon::Team::Human );
|
|||
|
|
pSession->SetTeam( hActor->GetTeam() );
|
|||
|
|
|
|||
|
|
_AddHumanBlow( hActor );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::Process( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
_ProcessSelectZombie();
|
|||
|
|
|
|||
|
|
CPvPRoundMode::Process( LocalTime, fDelta );
|
|||
|
|
|
|||
|
|
// Playing <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˻<EFBFBD>
|
|||
|
|
if( bIsPlaying() )
|
|||
|
|
{
|
|||
|
|
OnCheckFinishRound( PvPCommon::FinishReason::OpponentTeamAllGone );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnFinishProcessDie( DnActorHandle hActor )
|
|||
|
|
{
|
|||
|
|
if( !hActor )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if( bIsPlaying() != true )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if( bIsPlayingUser( hActor) == false )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ <20><><EFBFBD><EFBFBD>
|
|||
|
|
if( bIsZombie( hActor ) )
|
|||
|
|
_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 );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnCheckFinishRound( PvPCommon::FinishReason::eCode Reason )
|
|||
|
|
{
|
|||
|
|
UINT uiWinTeam = PvPCommon::Team::Max;
|
|||
|
|
|
|||
|
|
switch( Reason )
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3>
|
|||
|
|
case PvPCommon::FinishReason::OpponentTeamAllGone:
|
|||
|
|
{
|
|||
|
|
if( m_bInitializeZombie == false )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
int iPlayerCount = 0;
|
|||
|
|
int iZombieCount = 0;
|
|||
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|||
|
|
{
|
|||
|
|
CDNUserSession* pSession = GetGameRoom()->GetUserData(i);
|
|||
|
|
DnActorHandle hActor = pSession->GetActorHandle();
|
|||
|
|
if( bIsPlayingUser( hActor ) == false )
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
if( hActor->GetTeam() == PvPCommon::Team::A )
|
|||
|
|
++iPlayerCount;
|
|||
|
|
else if( hActor->GetTeam() == PvPCommon::Team::Zombie )
|
|||
|
|
++iZombieCount;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>~!
|
|||
|
|
if( iPlayerCount > 0 && iZombieCount > 0 )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if( iPlayerCount == 0 && iZombieCount > 0 )
|
|||
|
|
uiWinTeam = PvPCommon::Team::Zombie;
|
|||
|
|
else if( iZombieCount == 0 && iPlayerCount > 0 )
|
|||
|
|
uiWinTeam = PvPCommon::Team::A;
|
|||
|
|
|
|||
|
|
CPvPRoundMode::_ProcessFinishRound( uiWinTeam, Reason );
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>忡<EFBFBD><E5BFA1><EFBFBD><EFBFBD> TimeOver <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>¸<EFBFBD><C2B8>Ѵ<EFBFBD>.
|
|||
|
|
case PvPCommon::FinishReason::TimeOver:
|
|||
|
|
{
|
|||
|
|
uiWinTeam = PvPCommon::Team::A;
|
|||
|
|
CPvPRoundMode::_ProcessFinishRound( uiWinTeam, Reason );
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>忡<EFBFBD><E5BFA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD><D7BE>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD><CEB0><EFBFBD> <20>˻<EFBFBD><CBBB>Ѵ<EFBFBD>.
|
|||
|
|
case PvPCommon::FinishReason::OpponentTeamAllDead:
|
|||
|
|
{
|
|||
|
|
if( m_bInitializeZombie == false )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
int iZombieCount = 0;
|
|||
|
|
int iZombieDeadCount = 0;
|
|||
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|||
|
|
{
|
|||
|
|
CDNUserSession* pSession = GetGameRoom()->GetUserData(i);
|
|||
|
|
DnActorHandle hActor = pSession->GetActorHandle();
|
|||
|
|
if( bIsPlayingUser( hActor ) == false )
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
if( hActor->GetTeam() == PvPCommon::Team::Zombie )
|
|||
|
|
{
|
|||
|
|
++iZombieCount;
|
|||
|
|
if( hActor->IsDie() )
|
|||
|
|
++iZombieDeadCount;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if( iZombieCount <= 0 )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if( iZombieCount == iZombieDeadCount )
|
|||
|
|
uiWinTeam = PvPCommon::Team::Human;
|
|||
|
|
else
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
CPvPRoundMode::_ProcessFinishRound( uiWinTeam, Reason );
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CPvPRoundMode::OnCheckFinishRound( Reason );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnFinishRound()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnDie( DnActorHandle hActor, DnActorHandle hHitter )
|
|||
|
|
{
|
|||
|
|
CPvPGameMode::OnDie( hActor, hHitter );
|
|||
|
|
|
|||
|
|
// <20>ΰ<EFBFBD>-><3E><><EFBFBD><EFBFBD> <20≯<EFBFBD> <20>ٷ<EFBFBD> <20><><EFBFBD>Ž<EFBFBD>Ų<EFBFBD><C5B2>
|
|||
|
|
if( hActor && hActor->IsPlayerActor() && static_cast<CDnPlayerActor*>(hActor.GetPointer())->IsTransformMode() == false )
|
|||
|
|
hActor->SetDieDelta( 0.f );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnLeaveUser( DnActorHandle hActor )
|
|||
|
|
{
|
|||
|
|
if( hActor )
|
|||
|
|
m_mZombieActor.erase( hActor->GetUniqueID() );
|
|||
|
|
CPvPRoundMode::OnLeaveUser( hActor );
|
|||
|
|
CDnPlayerActor *pPlayer = static_cast<CDnPlayerActor *>(hActor.GetPointer());
|
|||
|
|
if( pPlayer )
|
|||
|
|
{
|
|||
|
|
CDNUserSession* pSession = pPlayer->GetUserSession();
|
|||
|
|
if( pSession->GetAddGhoulScore(GhoulMode::PointType::GhoulKill) || pSession->GetAddGhoulScore(GhoulMode::PointType::HumanKill) || pSession->GetAddGhoulScore(GhoulMode::PointType::HolyWaterUse) )
|
|||
|
|
{
|
|||
|
|
pSession->GetDBConnection()->QueryAddPVPGhoulScores(pSession);
|
|||
|
|
pSession->ClearAddGhoulScore();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnSuccessBreakInto( CDNUserSession* pGameSession )
|
|||
|
|
{
|
|||
|
|
CPvPRoundMode::OnSuccessBreakInto( pGameSession );
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>˷<EFBFBD><CBB7>ش<EFBFBD>.
|
|||
|
|
pGameSession->SendPvPSelectZombie( m_mZombieActor );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::OnRebirth( DnActorHandle hActor, bool bForce/*=false*/ )
|
|||
|
|
{
|
|||
|
|
TMonsterMutationData Data;
|
|||
|
|
memset(&Data, 0, sizeof(TMonsterMutationData));
|
|||
|
|
if( GetZombieActorData(Data) == false )
|
|||
|
|
_ASSERT(0);
|
|||
|
|
if( bIsZombie(hActor) )
|
|||
|
|
{
|
|||
|
|
_AddZombieBlow( hActor, Data );
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
_ChangeZombie( hActor, Data );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_ProcessSelectZombie()
|
|||
|
|
{
|
|||
|
|
if( m_bInitializeZombie )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if( bIsPlaying() == false )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
// 10<31>ʰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD> Zombie <20><><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>.
|
|||
|
|
if( GetElapsedTimeRound() < static_cast<float>(PvPCommon::Common::RoundStartMutationTimeSec) )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
// <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʿ䰡 <20><><EFBFBD><EFBFBD>.
|
|||
|
|
if( m_mZombieActor.empty() == false )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
InitializeZombie();
|
|||
|
|
m_bInitializeZombie = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_OnStartRound()
|
|||
|
|
{
|
|||
|
|
CPvPRoundMode::_OnStartRound();
|
|||
|
|
AllReturnHuman();
|
|||
|
|
m_bInitializeZombie = false;
|
|||
|
|
m_mZombieActor.clear();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_ProcessFinishRoundMode( CDNUserSession* pSession, bool bIsWin, UINT uiWinTeam, PvPCommon::FinishReason::eCode Reason )
|
|||
|
|
{
|
|||
|
|
if( bIsWin )
|
|||
|
|
{
|
|||
|
|
switch(Reason)
|
|||
|
|
{
|
|||
|
|
case PvPCommon::FinishReason::TimeOver : // Ÿ<>ӿ<EFBFBD><D3BF><EFBFBD>
|
|||
|
|
{
|
|||
|
|
pSession->AddGhoulScore(GhoulMode::PointType::TimeOver);
|
|||
|
|
pSession->GetEventSystem()->OnEvent( EventSystem::OnRoundFinished, 4, EventSystem::PvPGameMode, PvPCommon::GameMode::PvP_Zombie_Survival,
|
|||
|
|
EventSystem::PvPTeam, PvPCommon::Team::Human, EventSystem::PvPWinCondition, PvPCommon::FinishReason::TimeOver,
|
|||
|
|
EventSystem::GhoulModeWin, pSession->GetTotalGhoulScore(GhoulMode::PointType::TimeOver));
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
case PvPCommon::FinishReason::OpponentTeamAllDead :
|
|||
|
|
{
|
|||
|
|
if( uiWinTeam == PvPCommon::Team::Human ) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD><D7BE><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
|
{
|
|||
|
|
pSession->AddGhoulScore(GhoulMode::PointType::HumanWin);
|
|||
|
|
pSession->GetEventSystem()->OnEvent( EventSystem::OnRoundFinished, 4, EventSystem::PvPGameMode, PvPCommon::GameMode::PvP_Zombie_Survival,
|
|||
|
|
EventSystem::PvPTeam, PvPCommon::Team::Human, EventSystem::PvPWinCondition, PvPCommon::FinishReason::OpponentTeamAllDead,
|
|||
|
|
EventSystem::GhoulModeWin, pSession->GetTotalGhoulScore(GhoulMode::PointType::HumanWin));
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
case PvPCommon::FinishReason::OpponentTeamAllGone :
|
|||
|
|
{
|
|||
|
|
if( uiWinTeam == PvPCommon::Team::Human )
|
|||
|
|
{
|
|||
|
|
pSession->AddGhoulScore(GhoulMode::PointType::HumanWin);
|
|||
|
|
pSession->GetEventSystem()->OnEvent( EventSystem::OnRoundFinished, 4, EventSystem::PvPGameMode, PvPCommon::GameMode::PvP_Zombie_Survival,
|
|||
|
|
EventSystem::PvPTeam, PvPCommon::Team::Human, EventSystem::PvPWinCondition, PvPCommon::FinishReason::OpponentTeamAllGone,
|
|||
|
|
EventSystem::GhoulModeWin, pSession->GetTotalGhoulScore(GhoulMode::PointType::HumanWin));
|
|||
|
|
}
|
|||
|
|
else if( uiWinTeam == PvPCommon::Team::Zombie )
|
|||
|
|
{
|
|||
|
|
pSession->AddGhoulScore(GhoulMode::PointType::GhoulWin);
|
|||
|
|
pSession->GetEventSystem()->OnEvent( EventSystem::OnRoundFinished, 4, EventSystem::PvPGameMode, PvPCommon::GameMode::PvP_Zombie_Survival,
|
|||
|
|
EventSystem::PvPTeam, PvPCommon::Team::Zombie, EventSystem::PvPWinCondition, PvPCommon::FinishReason::OpponentTeamAllGone,
|
|||
|
|
EventSystem::GhoulModeWin, pSession->GetTotalGhoulScore(GhoulMode::PointType::GhoulWin));
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
pSession->AddGhoulScore(GhoulMode::PointType::PlayCount);
|
|||
|
|
// <20><><EFBFBD>⼭ DB<44><42> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
|||
|
|
pSession->GetDBConnection()->QueryAddPVPGhoulScores( pSession );
|
|||
|
|
pSession->ClearAddGhoulScore();
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ƚ<><C8BD>
|
|||
|
|
pSession->GetEventSystem()->OnEvent( EventSystem::OnRoundFinished, 2, EventSystem::PvPGameMode, PvPCommon::GameMode::PvP_Zombie_Survival,
|
|||
|
|
EventSystem::PvPRoundCount, pSession->GetTotalGhoulScore(GhoulMode::PointType::PlayCount));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_ChangeZombie( DnActorHandle hActor, const TMonsterMutationData &Data )
|
|||
|
|
{
|
|||
|
|
if( bIsZombie(hActor) )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if( !hActor || !hActor->IsPlayerActor() )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
if (AddZombie(hActor, Data ))
|
|||
|
|
{
|
|||
|
|
_AddZombieBlow( hActor, Data );
|
|||
|
|
|
|||
|
|
_UpdateSelectZombieCount( hActor->GetSessionID() );
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_DANGER_POINT();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_AddHumanBlow( DnActorHandle hActor )
|
|||
|
|
{
|
|||
|
|
if( !hActor )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
// <20>ΰ<EFBFBD><CEB0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><>ų<EFBFBD><C5B3><EFBFBD><EFBFBD>
|
|||
|
|
std::string strSkillVec;
|
|||
|
|
std::vector< std::pair<int,int> > vData;
|
|||
|
|
bool bRet = g_pDataManager->GetPvPGameModeSkillSetting( GetPvPGameModeTable()->iSkillSetting, hActor->GetClassID(), vData );
|
|||
|
|
if( bRet )
|
|||
|
|
{
|
|||
|
|
hActor->CmdRemoveStateEffect(STATE_BLOW::BLOW_176); // <20><>ų<EFBFBD><C5B3><EFBFBD><EFBFBD> <20><><EFBFBD>ο츦 <20>ʱ<EFBFBD>ȭ <20><><EFBFBD>ش<EFBFBD>.
|
|||
|
|
hActor->GetStateBlow()->Process( 0, 0.f );
|
|||
|
|
|
|||
|
|
for(DWORD i=0; i<vData.size();i++)
|
|||
|
|
{
|
|||
|
|
char szSkillIndex[256];
|
|||
|
|
sprintf(szSkillIndex, "%d;", vData[i].first);
|
|||
|
|
strSkillVec += szSkillIndex;
|
|||
|
|
}
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_176, -1, strSkillVec.c_str(), true ); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ΰ<EFBFBD><CEB0><EFBFBD>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ų<EFBFBD><C5B3><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20><>Ų<EFBFBD><C5B2>.
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(!(hActor->GetStateBlow()->IsApplied(STATE_BLOW::BLOW_183)))
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_183, -1, NULL, true );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_AddZombieBlow( DnActorHandle hActor, const TMonsterMutationData &Data )
|
|||
|
|
{
|
|||
|
|
{
|
|||
|
|
USES_CONVERSION;
|
|||
|
|
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_058, -1, I2A(Data.nMutationHP), true ); // 58) <20>ִ<EFBFBD> HP <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_002, -1, I2A(Data.nMutationStrPMax), true ); // 2) <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ݷ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_029, -1, I2A(Data.nMutationStrMMax), true ); // 29) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_004, -1, I2A(Data.nMutationDefP), true ); // 4) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_094, -1, I2A(Data.nMutationDefM), true ); // 94) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_123, -1, I2A(Data.nMutationStiff), true ); // 123) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_124, -1, I2A(Data.nMutationStiffResis), true ); // 124) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_126, -1, I2A(Data.nMutationCriticalResis), true ); // 126) ũ<><C5A9>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_128, -1, I2A(Data.nMutationStunResis), true ); // 128) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_061, -1, I2A(Data.nMutationSuperArmor), true ); // 61) <20><><EFBFBD>۾Ƹ<DBBE>1 <20>ο<EFBFBD>
|
|||
|
|
if(!(hActor->GetStateBlow()->IsApplied(STATE_BLOW::BLOW_183)))
|
|||
|
|
hActor->CmdAddStateEffect( NULL, STATE_BLOW::BLOW_183, -1, NULL, true ); // 183) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>忡<EFBFBD><E5BFA1> <20><><EFBFBD>ξ<EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF>
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
hActor->GetStateBlow()->Process( 0, 0.f );
|
|||
|
|
hActor->CmdRefreshHPSP( hActor->GetMaxHP(), hActor->GetMaxSP() );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CPvPZombieMode::bIsZombie( DnActorHandle hActor )
|
|||
|
|
{
|
|||
|
|
if( !hActor || !hActor->IsPlayerActor() )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
std::map<DWORD,DnActorHandle>::iterator itor = m_mZombieActor.find( hActor->GetUniqueID() );
|
|||
|
|
if( itor == m_mZombieActor.end() )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_UpdateSelectZombieCount( UINT uiSessionID )
|
|||
|
|
{
|
|||
|
|
std::map<UINT,UINT>::iterator itor = m_mSelectZombieCount.find( uiSessionID );
|
|||
|
|
if( itor != m_mSelectZombieCount.end() )
|
|||
|
|
{
|
|||
|
|
++(*itor).second;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_mSelectZombieCount.insert( std::make_pair(uiSessionID,1) );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
UINT CPvPZombieMode::_GetSelectZombieCount( UINT uiSessionID )
|
|||
|
|
{
|
|||
|
|
std::map<UINT,UINT>::iterator itor = m_mSelectZombieCount.find( uiSessionID );
|
|||
|
|
if( itor != m_mSelectZombieCount.end() )
|
|||
|
|
return (*itor).second;
|
|||
|
|
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::_GetZombieCandidate( std::vector<DnActorHandle>& vResult )
|
|||
|
|
{
|
|||
|
|
UINT uiMinValue = UINT_MAX;
|
|||
|
|
|
|||
|
|
std::vector<DnActorHandle> vCandidate;
|
|||
|
|
for( UINT i=0 ; i<GetGameRoom()->GetUserCount() ; ++i )
|
|||
|
|
{
|
|||
|
|
CDNUserSession* pSession = GetGameRoom()->GetUserData(i);
|
|||
|
|
if( !pSession || !pSession->GetActorHandle() )
|
|||
|
|
continue;
|
|||
|
|
if( !bIsPlayingUser( pSession->GetActorHandle() ) )
|
|||
|
|
continue;
|
|||
|
|
UINT uiCount = _GetSelectZombieCount( pSession->GetSessionID() );
|
|||
|
|
if( uiCount < uiMinValue )
|
|||
|
|
uiMinValue = uiCount;
|
|||
|
|
|
|||
|
|
vCandidate.push_back( pSession->GetActorHandle() );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for( UINT i=0 ; i<vCandidate.size() ; ++i )
|
|||
|
|
{
|
|||
|
|
if( _GetSelectZombieCount( vCandidate[i]->GetSessionID() ) == uiMinValue )
|
|||
|
|
vResult.push_back( vCandidate[i] );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::InitZombieGroupData()
|
|||
|
|
{
|
|||
|
|
g_pDataManager->GetGhoulGroup(GetGameRoom()->GetUserCountWithoutGM(), m_MutationGroup, m_nGhoulCount);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CPvPZombieMode::GetZombieActorData(TMonsterMutationData &Data)
|
|||
|
|
{
|
|||
|
|
int nRandomOffset = _roomrand(GetGameRoom())%1000000000;
|
|||
|
|
int nTotalProb = 0;
|
|||
|
|
for (int i = 0; i < PvPCommon::Common::MonsterMutationColCount; i++)
|
|||
|
|
{
|
|||
|
|
if( nRandomOffset < m_MutationGroup.nProbability[i] + nTotalProb )
|
|||
|
|
return g_pDataManager->GetMonsterMutationData(m_MutationGroup.nMonsterID[i], Data);
|
|||
|
|
nTotalProb += m_MutationGroup.nProbability[i];
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CPvPZombieMode::AddZombie(DnActorHandle hActor, const TMonsterMutationData &Data )
|
|||
|
|
{
|
|||
|
|
if( !hActor || !hActor->IsPlayerActor() )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
std::map<DWORD,DnActorHandle>::iterator itor = m_mZombieActor.find( hActor->GetUniqueID() );
|
|||
|
|
if( itor == m_mZombieActor.end() )
|
|||
|
|
{
|
|||
|
|
m_mZombieActor.insert(std::make_pair(hActor->GetUniqueID(), hActor));
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdChangeTeam( PvPCommon::Team::Zombie );
|
|||
|
|
static_cast<CDnPlayerActor*>(hActor.GetPointer())->GetUserSession()->SetTeam( PvPCommon::Team::Zombie );
|
|||
|
|
static_cast<CDnPlayerActor*>(hActor.GetPointer())->ToggleTransformMode(true, Data.nMutationID ); // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
_fpreset();
|
|||
|
|
int nScale = 100;
|
|||
|
|
int nMin = Data.nSizeMin;
|
|||
|
|
int nMax = Data.nSizeMax;
|
|||
|
|
if( nMin <= nMax ) {
|
|||
|
|
nScale = ( nMin + ( _rand(hActor->GetRoom())%( ( nMax + 1 ) - nMin ) ) );
|
|||
|
|
}
|
|||
|
|
float fScale = nScale/100.f;
|
|||
|
|
static_cast<CDnPlayerActor*>(hActor.GetPointer())->SetScale( EtVector3( fScale, fScale, fScale ) );
|
|||
|
|
|
|||
|
|
_ASSERT( GetGameRoom()->bIsPvPRoom() );
|
|||
|
|
static_cast<CDNPvPGameRoom*>(GetGameRoom())->SendSelectZombie( hActor, Data.nMutationID, true, false, nScale );
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CPvPZombieMode::DelZombie(DnActorHandle hActor, bool bRemoveStateBlow/*=false*/ )
|
|||
|
|
{
|
|||
|
|
if( !hActor || !hActor->IsPlayerActor() )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
std::map<DWORD,DnActorHandle>::iterator itor = m_mZombieActor.find( hActor->GetUniqueID() );
|
|||
|
|
if( itor != m_mZombieActor.end() )
|
|||
|
|
{
|
|||
|
|
// <20>ΰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
hActor->CmdChangeTeam( PvPCommon::Team::Human );
|
|||
|
|
static_cast<CDnPlayerActor*>(hActor.GetPointer())->GetUserSession()->SetTeam( PvPCommon::Team::Human );
|
|||
|
|
static_cast<CDnPlayerActor*>(hActor.GetPointer())->ToggleTransformMode(false);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
static_cast<CDnPlayerActor*>(hActor.GetPointer())->SetScale( EtVector3( 1.f, 1.f, 1.f ) );
|
|||
|
|
|
|||
|
|
_ASSERT( GetGameRoom()->bIsPvPRoom() );
|
|||
|
|
static_cast<CDNPvPGameRoom*>(GetGameRoom())->SendSelectZombie( hActor, -1, false, bRemoveStateBlow );
|
|||
|
|
m_mZombieActor.erase(itor);
|
|||
|
|
|
|||
|
|
if( bRemoveStateBlow )
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>ٸ<EFBFBD> <20>÷<EFBFBD><C3B7>̾ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ɷ<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ش<EFBFBD>.
|
|||
|
|
hActor->RemoveAllBlowExpectPassiveSkill();
|
|||
|
|
hActor->GetStateBlow()->Process( 0, 0.f );
|
|||
|
|
hActor->CmdRefreshHPSP( hActor->GetMaxHP(), hActor->GetMaxSP() );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20>ΰ<EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF>
|
|||
|
|
_AddHumanBlow( hActor );
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::InitializeZombie()
|
|||
|
|
{
|
|||
|
|
InitZombieGroupData();
|
|||
|
|
|
|||
|
|
if (GetZombieCount() >= m_nGhoulCount)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
_srand( GetGameRoom(), timeGetTime() );
|
|||
|
|
|
|||
|
|
for (int i = 0; i < m_nGhoulCount; i++)
|
|||
|
|
{
|
|||
|
|
TMonsterMutationData Data;
|
|||
|
|
memset(&Data, 0, sizeof(TMonsterMutationData));
|
|||
|
|
if (GetZombieActorData(Data) == false)
|
|||
|
|
{
|
|||
|
|
_DANGER_POINT();
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
std::vector<DnActorHandle> vResult;
|
|||
|
|
_GetZombieCandidate( vResult );
|
|||
|
|
if( vResult.empty() )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
DnActorHandle hZombie = vResult[_roomrand(GetGameRoom())%vResult.size()];
|
|||
|
|
_ChangeZombie( hZombie, Data );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CPvPZombieMode::AllReturnHuman()
|
|||
|
|
{
|
|||
|
|
CDNUserSession * pSession = NULL;
|
|||
|
|
for (int i = 0; i < (int)GetGameRoom()->GetUserCount(); i++)
|
|||
|
|
{
|
|||
|
|
pSession = GetGameRoom()->GetUserData(i);
|
|||
|
|
if (pSession )
|
|||
|
|
{
|
|||
|
|
if( pSession->GetTeam() == PvPCommon::Team::Observer )
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
if( DelZombie(pSession->GetActorHandle()) == false )
|
|||
|
|
{
|
|||
|
|
_AddHumanBlow( pSession->GetActorHandle() );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
_DANGER_POINT();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|