267 lines
6.1 KiB
C++
267 lines
6.1 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "DnMaxDamageAddBlow.h"
|
|||
|
|
|
|||
|
|
#if !defined( USE_BOOST_MEMPOOL )
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
|
|||
|
|
#endif
|
|||
|
|
#endif // #if !defined( USE_BOOST_MEMPOOL )
|
|||
|
|
|
|||
|
|
|
|||
|
|
CDnMaxDamageAddBlow::CDnMaxDamageAddBlow( DnActorHandle hActor, const char* szValue ) : CDnBlow( hActor )
|
|||
|
|
#if !defined(_GAMESERVER)
|
|||
|
|
,m_IntervalChecker( hActor, GetMySmartPtr() )
|
|||
|
|
#endif // _GAMESERVER
|
|||
|
|
{
|
|||
|
|
m_StateBlow.emBlowIndex = STATE_BLOW::BLOW_160;
|
|||
|
|
SetValue( szValue );
|
|||
|
|
|
|||
|
|
m_fValue = (float)atof(szValue);
|
|||
|
|
|
|||
|
|
m_fRate = m_fValue;
|
|||
|
|
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
m_bCalcProb = false;
|
|||
|
|
m_bOnDamaged = false;
|
|||
|
|
|
|||
|
|
AddCallBackType( SB_ONTARGETHIT );
|
|||
|
|
#else
|
|||
|
|
//<2F>⺻<EFBFBD><E2BABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ ǥ<><C7A5> <20><><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD>..
|
|||
|
|
UseTableDefinedGraphicEffect( false );
|
|||
|
|
m_bGraphicEffectShow = false;
|
|||
|
|
m_bTrigger = false;
|
|||
|
|
#endif
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CDnMaxDamageAddBlow::~CDnMaxDamageAddBlow(void)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnMaxDamageAddBlow::OnBegin( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
__super::OnBegin(LocalTime, fDelta);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnMaxDamageAddBlow::Process( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
CDnBlow::Process( LocalTime, fDelta );
|
|||
|
|
|
|||
|
|
#if defined(_GAMESERVER)
|
|||
|
|
//<2F>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
m_bCalcProb = m_bOnDamaged = false;
|
|||
|
|
#else
|
|||
|
|
if (m_bTrigger)
|
|||
|
|
{
|
|||
|
|
if (m_bGraphicEffectShow)
|
|||
|
|
{
|
|||
|
|
_AttachGraphicEffect();
|
|||
|
|
if( m_hEtcObjectEffect )
|
|||
|
|
{
|
|||
|
|
CEtActionBase::ActionElementStruct* pStruct = m_hEtcObjectEffect->GetElement( "Idle" );
|
|||
|
|
if( pStruct )
|
|||
|
|
m_IntervalChecker.OnBegin( LocalTime, pStruct->dwLength + 1000);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (m_hEtcObjectEffect)
|
|||
|
|
{
|
|||
|
|
_DetachGraphicEffect();
|
|||
|
|
m_IntervalChecker.OnEnd(LocalTime, fDelta);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_bTrigger = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_IntervalChecker.Process( LocalTime, fDelta );
|
|||
|
|
#endif // _GAMESERVER
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void CDnMaxDamageAddBlow::OnEnd( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
__super::OnEnd(LocalTime, fDelta);
|
|||
|
|
|
|||
|
|
#if !defined(_GAMESERVER)
|
|||
|
|
_DetachGraphicEffect();
|
|||
|
|
#endif // _GAMESERVER
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#if defined(_GAMESERVER)
|
|||
|
|
|
|||
|
|
bool CDnMaxDamageAddBlow::CalcProb()
|
|||
|
|
{
|
|||
|
|
bool bExecuteable = false;
|
|||
|
|
|
|||
|
|
//<2F><>ų <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD>..
|
|||
|
|
//<2F>нú<D0BD> <20><>ų<EFBFBD>϶<EFBFBD><CFB6><EFBFBD>??
|
|||
|
|
DnSkillHandle hSkill;
|
|||
|
|
const CDnSkill::SkillInfo* pSkillInfo = GetParentSkillInfo();
|
|||
|
|
if (pSkillInfo)
|
|||
|
|
{
|
|||
|
|
hSkill = m_hActor->FindSkill(pSkillInfo->iSkillID);
|
|||
|
|
|
|||
|
|
if (!hSkill)
|
|||
|
|
return bExecuteable;
|
|||
|
|
|
|||
|
|
if (CDnSkill::UsingResult::Success != hSkill->CanExecute())
|
|||
|
|
{
|
|||
|
|
OutputDebug("%s CanExecute <20><><EFBFBD><EFBFBD>\n", __FUNCTION__);
|
|||
|
|
return bExecuteable;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
return bExecuteable;
|
|||
|
|
|
|||
|
|
//Ȯ<><C8AE> <20><><EFBFBD><EFBFBD>..
|
|||
|
|
bExecuteable = rand() % 10000 <= (m_fRate * 10000.0f);
|
|||
|
|
if (!bExecuteable)
|
|||
|
|
{
|
|||
|
|
OutputDebug("%s Ȯ<><C8AE> <20>ɷ<EFBFBD><C9B7><EFBFBD>\n", __FUNCTION__);
|
|||
|
|
return bExecuteable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD><C6AE> <20>н<EFBFBD><D0BD><EFBFBD> <20><>ų <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>Ŷ <20><><EFBFBD><EFBFBD>..
|
|||
|
|
bool isPassiveSkill = CDnSkill::Passive == hSkill->GetSkillType();
|
|||
|
|
if (isPassiveSkill)
|
|||
|
|
{
|
|||
|
|
BYTE pBuffer[128];
|
|||
|
|
CPacketCompressStream Stream( pBuffer, 128 );
|
|||
|
|
|
|||
|
|
DWORD dwUniqueID = m_hActor ? m_hActor->GetUniqueID() : -1;
|
|||
|
|
int nSkillID = hSkill->GetClassID();
|
|||
|
|
|
|||
|
|
Stream.Write( &dwUniqueID, sizeof(dwUniqueID) );
|
|||
|
|
Stream.Write( &nSkillID, sizeof(nSkillID));
|
|||
|
|
|
|||
|
|
m_hActor->Send(eActor::SC_PASSIVESKILL_COOLTIME, &Stream);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (hSkill)
|
|||
|
|
hSkill->OnBeginCoolTime();
|
|||
|
|
|
|||
|
|
return bExecuteable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnMaxDamageAddBlow::OnTargetHit( DnActorHandle hTargetActor )
|
|||
|
|
{
|
|||
|
|
//#30953 1Ÿ 2ų <20><>Ȳ <20><><EFBFBD><EFBFBD>. - <20><><EFBFBD>Ͱ<EFBFBD> <20><EFBFBD><D7BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3> <20>ȵǵ<C8B5><C7B5><EFBFBD>..
|
|||
|
|
if (!m_hActor || m_hActor->IsDie())
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if (!hTargetActor || hTargetActor->IsDie())
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
//Ȯ<><C8AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴٸ<CAB4> Ȯ<><C8AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ų <20><><EFBFBD><EFBFBD> <20><><EFBFBD>θ<EFBFBD> Ȯ<><C8AE><EFBFBD>Ѵ<EFBFBD>.
|
|||
|
|
if (false == m_bCalcProb)
|
|||
|
|
{
|
|||
|
|
m_bOnDamaged = CalcProb();
|
|||
|
|
m_bCalcProb = true;
|
|||
|
|
|
|||
|
|
if (m_bOnDamaged)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>Ʈ ǥ<>ÿ<EFBFBD> <20><>Ŷ<EFBFBD><C5B6> <20><><EFBFBD><EFBFBD>..
|
|||
|
|
BYTE pBuffer[128];
|
|||
|
|
CPacketCompressStream Stream( pBuffer, 128 );
|
|||
|
|
|
|||
|
|
DWORD dwUniqueID = m_hActor ? m_hActor->GetUniqueID() : -1;
|
|||
|
|
bool bShowEffect = true;
|
|||
|
|
Stream.Write( &dwUniqueID, sizeof(dwUniqueID) );
|
|||
|
|
Stream.Write( &m_StateBlow.emBlowIndex, sizeof(m_StateBlow.emBlowIndex));
|
|||
|
|
Stream.Write( &bShowEffect, sizeof(bShowEffect));
|
|||
|
|
|
|||
|
|
m_hActor->Send(eActor::SC_SHOW_STATE_EFFECT, &Stream);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> TargetActor<6F><72> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>߰<EFBFBD> <20>Ѵ<EFBFBD>.
|
|||
|
|
if (m_bOnDamaged)
|
|||
|
|
{
|
|||
|
|
// [2011/03/09 semozz]
|
|||
|
|
// <20>ִ빰<D6B4><EBB9B0><EFBFBD><EFBFBD><EFBFBD>ݷ¿<DDB7><C2BF><EFBFBD> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>Ϳ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ִ빰<D6B4><EBB9B0><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>;<EFBFBD> <20>Ѵ<EFBFBD>...
|
|||
|
|
int nAddDamage = m_hActor->GetAttackPMaxWithoutSkill();
|
|||
|
|
|
|||
|
|
char buffer[65];
|
|||
|
|
_itoa_s(nAddDamage, buffer, 65, 10 );
|
|||
|
|
hTargetActor->CmdAddStateEffect(&m_ParentSkillInfo, STATE_BLOW::BLOW_177, 0, buffer, false, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#else
|
|||
|
|
|
|||
|
|
bool CDnMaxDamageAddBlow::OnCustomIntervalProcess( void )
|
|||
|
|
{
|
|||
|
|
if (m_hEtcObjectEffect)
|
|||
|
|
{
|
|||
|
|
_DetachGraphicEffect();
|
|||
|
|
m_IntervalChecker.OnEnd(0, 0.0f);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnMaxDamageAddBlow::ShowGraphicEffect(bool bShow)
|
|||
|
|
{
|
|||
|
|
m_bGraphicEffectShow = bShow;
|
|||
|
|
m_bTrigger = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endif // _GAMESERVER
|
|||
|
|
|
|||
|
|
#if defined(PRE_ADD_PREFIX_SYSTE_RENEW)
|
|||
|
|
void CDnMaxDamageAddBlow::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 CDnMaxDamageAddBlow::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
|