272 lines
7.9 KiB
C++
272 lines
7.9 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "DnCooltimeParryBlow.h"
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
#include "DnStateBlow.h"
|
|||
|
|
#include "DnPlayerActor.h"
|
|||
|
|
#else
|
|||
|
|
#include "DnLocalPlayerActor.h"
|
|||
|
|
#include "DnInterface.h"
|
|||
|
|
#include "DnMainDlg.h"
|
|||
|
|
#include "TaskManager.h"
|
|||
|
|
#include "DnGameTask.h"
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
CDnCooltimeParryBlow::CDnCooltimeParryBlow( DnActorHandle hActor, const char *szValue )
|
|||
|
|
: CDnBlow(hActor)
|
|||
|
|
{
|
|||
|
|
m_StateBlow.emBlowIndex = STATE_BLOW::BLOW_153;
|
|||
|
|
AddCallBackType(SB_ONDEFENSEATTACK);
|
|||
|
|
SetValue(szValue);
|
|||
|
|
//m_nValue = atoi( szValue );
|
|||
|
|
m_fValue = (float)atof(szValue);
|
|||
|
|
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
m_strParringActionName.assign( "Skill_Parrying" );
|
|||
|
|
m_bEnable = false;
|
|||
|
|
m_bEnableLastLoop = false;
|
|||
|
|
m_fAdditionalSignalProb = 0.0f;
|
|||
|
|
|
|||
|
|
m_dwCoolTime = 0;
|
|||
|
|
m_dwLastParryingTime = 0;
|
|||
|
|
|
|||
|
|
m_fAdditionalSignalProbLastLoop = 0.0f;
|
|||
|
|
#else
|
|||
|
|
m_pLocalPlayerActor = NULL;
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CDnCooltimeParryBlow::~CDnCooltimeParryBlow(void)
|
|||
|
|
{
|
|||
|
|
#ifndef _GAMESERVER
|
|||
|
|
// TODO: <20><>Ÿ<EFBFBD><C5B8> <20>ߵ<EFBFBD><DFB5><EFBFBD> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> <20><>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ѵٴ<D1B4><D9B4><EFBFBD> <20>ϸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.. <20><EFBFBD>Ʈ <20>ʿ<EFBFBD><CABF><EFBFBD>.
|
|||
|
|
SAFE_RELEASE_SPTR( m_hParentSkillForCoolTime );
|
|||
|
|
#endif
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnCooltimeParryBlow::Process( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
CDnBlow::Process( LocalTime, fDelta );
|
|||
|
|
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
// <20><><EFBFBD><EFBFBD> process <20><><EFBFBD><EFBFBD> <20><><EFBFBD>κп<CEBA> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> process <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⼭ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD> <20>и<EFBFBD><D0B8>ñ׳<C3B1><D7B3><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> enable <20><> ó<><C3B3><EFBFBD><EFBFBD> <20><>.
|
|||
|
|
m_bEnableLastLoop = m_bEnable;
|
|||
|
|
m_fAdditionalSignalProbLastLoop = m_fAdditionalSignalProb;
|
|||
|
|
m_bEnable = false;
|
|||
|
|
m_fAdditionalSignalProb = 0.0f;
|
|||
|
|
#else
|
|||
|
|
if( m_pLocalPlayerActor && m_hParentSkillForCoolTime )
|
|||
|
|
{
|
|||
|
|
// <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
m_hParentSkillForCoolTime->Process( LocalTime, fDelta );
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnCooltimeParryBlow::OnBegin( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
// <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> <20>θ<EFBFBD> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>״<EFBFBD><D7B4><EFBFBD> Ȱ<><C8B0><EFBFBD>Ѵ<EFBFBD>.
|
|||
|
|
if( m_ParentSkillInfo.hSkillUser )
|
|||
|
|
{
|
|||
|
|
DnSkillHandle hParentSkill = m_ParentSkillInfo.hSkillUser->FindSkill( m_ParentSkillInfo.iSkillID );
|
|||
|
|
m_dwCoolTime = DWORD(hParentSkill->GetDelayTime() * 1000.0f);
|
|||
|
|
}
|
|||
|
|
#else
|
|||
|
|
m_pLocalPlayerActor = dynamic_cast<CDnLocalPlayerActor*>( m_hActor.GetPointer() );
|
|||
|
|
if( !m_hParentSkillForCoolTime && m_pLocalPlayerActor )
|
|||
|
|
{
|
|||
|
|
m_hParentSkillForCoolTime = CDnSkill::CreateSkill( m_hActor, m_ParentSkillInfo.iSkillID,
|
|||
|
|
#if defined(PRE_FIX_NEXTSKILLINFO)
|
|||
|
|
m_ParentSkillInfo.nSkillLevel);
|
|||
|
|
#else
|
|||
|
|
m_ParentSkillInfo.iSkillLevelID - m_ParentSkillInfo.iSkillLevelIDOffset + 1 );
|
|||
|
|
#endif // PRE_FIX_NEXTSKILLINFO
|
|||
|
|
|
|||
|
|
#if defined( PRE_FIX_82147 )
|
|||
|
|
if( m_hParentSkillForCoolTime && m_hActor->IsPlayerActor() )
|
|||
|
|
{
|
|||
|
|
int iSkillLevelDataType = CDnSkill::PVE;
|
|||
|
|
|
|||
|
|
CDnGameTask *pGameTask = (CDnGameTask *)CTaskManager::GetInstance().GetTask( "GameTask" );
|
|||
|
|
if( pGameTask && pGameTask->GetGameTaskType() == GameTaskType::PvP )
|
|||
|
|
iSkillLevelDataType = CDnSkill::PVP;
|
|||
|
|
|
|||
|
|
m_hParentSkillForCoolTime->SelectLevelDataType( iSkillLevelDataType );
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
OutputDebug( "CDnCooltimeParryBlow::OnBegin\n" );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnCooltimeParryBlow::OnEnd( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
#ifndef _GAMESERVER
|
|||
|
|
//if( m_pLocalPlayerActor )
|
|||
|
|
// m_hParentSkillForCoolTime->OnEnd( 0, 0.0f );
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
OutputDebug( "CDnCooltimeParryBlow::OnEnd\n" );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
bool CDnCooltimeParryBlow::OnDefenseAttack( DnActorHandle hHitter, CDnState* pAttackerState, CDnDamageBase::SHitParam &HitParam, bool bHitSuccess )
|
|||
|
|
{
|
|||
|
|
if( !m_bEnableLastLoop )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
if( !bHitSuccess )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
#if defined(PRE_FIX_BLOCK_CONDITION)
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ߵ<EFBFBD><DFB5><EFBFBD> fDamage<67><65> 0<>̶<EFBFBD><CCB6><EFBFBD> <20><><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ߵ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ϵ<EFBFBD><CFB5><EFBFBD>..
|
|||
|
|
//<2F>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3> fDamage <20><>0<EFBFBD≯<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD> <20><>.
|
|||
|
|
if (IsCanBlock(hHitter, m_hActor, HitParam) == false)
|
|||
|
|
return false;
|
|||
|
|
#else
|
|||
|
|
// hit percent <20><> 0% <20><> <20><><EFBFBD><EFBFBD> <20>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>. (#21175)
|
|||
|
|
if( 0.0f == HitParam.fDamage )
|
|||
|
|
return false;
|
|||
|
|
#endif // PRE_FIX_BLOCK_CONDITION
|
|||
|
|
|
|||
|
|
#if defined(PRE_ADD_49166)
|
|||
|
|
// <20>ǰ<EFBFBD><C7B0>ڰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (Freezing / FrameStop) <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ߵ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD>..
|
|||
|
|
if (IsInVaildBlockCondition(m_hActor) == true)
|
|||
|
|
return false;
|
|||
|
|
#endif // PRE_ADD_49166
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD> <20><>Ÿ<EFBFBD>Ӹ<EFBFBD>ŭ <20>ð<EFBFBD><C3B0><EFBFBD> <20>ȵȴٸ<C8B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
if( GetTickCount() - m_dwLastParryingTime < m_dwCoolTime )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
// <20>÷<EFBFBD><C3B7>̾<EFBFBD><CCBE><EFBFBD> <20><><EFBFBD>쿣,
|
|||
|
|
if( m_hActor->IsPlayerActor() )
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD>⸦ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>쿣 <20>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. #26772
|
|||
|
|
CDnPlayerActor* pPlayerActor = static_cast<CDnPlayerActor*>(m_hActor.GetPointer());
|
|||
|
|
if( false == (pPlayerActor->IsBattleMode() && pPlayerActor->GetWeapon( 0 ) && pPlayerActor->GetWeapon( 1 )) )
|
|||
|
|
return false;
|
|||
|
|
if( pPlayerActor->IsTransformMode() )
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
float fAddProb = m_fAdditionalSignalProbLastLoop;
|
|||
|
|
if( m_hActor->GetStateBlow()->IsApplied( STATE_BLOW::BLOW_056 ) )
|
|||
|
|
{
|
|||
|
|
DNVector(DnBlowHandle) vlhParryingProbBlow;
|
|||
|
|
m_hActor->GetStateBlow()->GetStateBlowFromBlowIndex( STATE_BLOW::BLOW_056, vlhParryingProbBlow );
|
|||
|
|
int iNumBlow = (int)vlhParryingProbBlow.size();
|
|||
|
|
for( int i = 0; i < iNumBlow; ++i )
|
|||
|
|
fAddProb += vlhParryingProbBlow.at( i )->GetFloatValue();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
int iProb = int((m_fValue+fAddProb) * 10000.0f);
|
|||
|
|
int iRandValue = (_rand(GetRoom())%10000);
|
|||
|
|
if( iRandValue <= iProb )
|
|||
|
|
{
|
|||
|
|
// HitParam<61><6D> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
|||
|
|
HitParam.szActionName = m_strParringActionName;
|
|||
|
|
OutputDebug( "CDnCooltimeParryingBlow::OnDefenseAttack\n" );
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>и<EFBFBD><D0B8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
m_dwLastParryingTime = GetTickCount();
|
|||
|
|
|
|||
|
|
// <20>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD> <20>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD> <20>˷<EFBFBD><CBB7><EFBFBD>. /////////////////////////////////////////////
|
|||
|
|
boost::shared_ptr<IDnObserverNotifyEvent> pEvent( IDnObserverNotifyEvent::Create( EVENT_BUBBLE_COOLTIME_PARRING_SUCCESS ) );
|
|||
|
|
pEvent->SetSkillID( m_ParentSkillInfo.iSkillID );
|
|||
|
|
Notify( pEvent );
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
// Ŭ<><C5AC><EFBFBD><EFBFBD> <20><>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD> <20>˷<EFBFBD><CBB7>ش<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> Ŭ<><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
static_cast<CDnPlayerActor*>(m_hActor.GetPointer())->RequestCooltimeParrySuccess( m_ParentSkillInfo.iSkillID );
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#else
|
|||
|
|
void CDnCooltimeParryBlow::OnSuccess( void )
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ÿ<EFBFBD><C5B8> <20>и<EFBFBD><D0B8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD> ȣ<><C8A3><EFBFBD>ȴ<EFBFBD>.
|
|||
|
|
// <20><><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD>϶<EFBFBD><CFB6><EFBFBD> <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD> <20>ȴ<EFBFBD>.
|
|||
|
|
if( m_pLocalPlayerActor )
|
|||
|
|
{
|
|||
|
|
// <20><>Ÿ<EFBFBD>Ӹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. ȭ<><C8AD> ǥ<>ÿ<EFBFBD>
|
|||
|
|
m_hParentSkillForCoolTime->OnBeginCoolTime();
|
|||
|
|
|
|||
|
|
if( m_hParentSkillForCoolTime->HasCoolTime() )
|
|||
|
|
{
|
|||
|
|
CDnMainDlg *pMainDlg = (CDnMainDlg*)GetInterface().GetMainBarDialog();
|
|||
|
|
if( pMainDlg )
|
|||
|
|
{
|
|||
|
|
pMainDlg->AddPassiveSkill( m_hParentSkillForCoolTime );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#if defined(PRE_ADD_PREFIX_SYSTE_RENEW)
|
|||
|
|
void CDnCooltimeParryBlow::AddStateEffectValue(const char* szOrigValue, const char* szAddValue, std::string& szNewValue)
|
|||
|
|
{
|
|||
|
|
char szBuff[128] = {0, };
|
|||
|
|
|
|||
|
|
//<2F>ʿ<EFBFBD><CABF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
|||
|
|
float fValue[2];
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
//ù<><C3B9>° <20><>
|
|||
|
|
fValue[0] = (float)atof( szOrigValue );
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
//<2F>ι<EFBFBD>°
|
|||
|
|
fValue[1] = (float)atof( szAddValue );
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ѵ<EFBFBD>.
|
|||
|
|
float fResultValue = fValue[0] + fValue[1];
|
|||
|
|
|
|||
|
|
sprintf_s(szBuff, "%f", fResultValue);
|
|||
|
|
|
|||
|
|
szNewValue = szBuff;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnCooltimeParryBlow::RemoveStateEffectValue(const char* szOrigValue, const char* szAddValue, std::string& szNewValue)
|
|||
|
|
{
|
|||
|
|
char szBuff[128] = {0, };
|
|||
|
|
|
|||
|
|
//<2F>ʿ<EFBFBD><CABF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
|||
|
|
float fValue[2];
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
//ù<><C3B9>° <20><>
|
|||
|
|
fValue[0] = (float)atof( szOrigValue );
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
//<2F>ι<EFBFBD>°
|
|||
|
|
fValue[1] = (float)atof( szAddValue );
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><> <20><><EFBFBD><EFBFBD>
|
|||
|
|
float fResultValue = fValue[0] - fValue[1];
|
|||
|
|
|
|||
|
|
sprintf_s(szBuff, "%f", fResultValue);
|
|||
|
|
|
|||
|
|
szNewValue = szBuff;
|
|||
|
|
}
|
|||
|
|
#endif // PRE_ADD_PREFIX_SYSTE_RENEW
|