133 lines
3.4 KiB
C++
133 lines
3.4 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "DnHPBelowUseSkillBlow.h"
|
|||
|
|
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
|
|||
|
|
#ifdef PRE_ADD_HPBELOWDOSKILLBLOW
|
|||
|
|
|
|||
|
|
CDnHPBelowUseSkillBlow::CDnHPBelowUseSkillBlow( DnActorHandle hActor, const char* szValue ) : CDnBlow( hActor )
|
|||
|
|
, m_nHP( 0 )
|
|||
|
|
, m_nSkillIndex( 0 )
|
|||
|
|
{
|
|||
|
|
m_StateBlow.emBlowIndex = STATE_BLOW::BLOW_281;
|
|||
|
|
|
|||
|
|
SetValue( szValue );
|
|||
|
|
|
|||
|
|
string strValue( szValue );
|
|||
|
|
int iSemiColonIndex = (int)strValue.find_first_of( ';', 0 );
|
|||
|
|
bool bValidArgument = (string::npos != iSemiColonIndex);
|
|||
|
|
_ASSERT( bValidArgument && "281 <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> ȿ<><C8BF> <20><>ġ<EFBFBD><C4A1> <20>߸<EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD> ã<><C3A3> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>" );
|
|||
|
|
|
|||
|
|
if( bValidArgument )
|
|||
|
|
{
|
|||
|
|
string strHP = strValue.substr( 0, iSemiColonIndex );
|
|||
|
|
string strSkill = strValue.substr( iSemiColonIndex+1, strValue.length() );
|
|||
|
|
|
|||
|
|
m_nHP = (int)atoi( strHP.c_str() );
|
|||
|
|
m_nSkillIndex = (int)atoi( strSkill.c_str() );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
AddCallBackType( SB_ONCALCDAMAGE );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CDnHPBelowUseSkillBlow::~CDnHPBelowUseSkillBlow(void)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnHPBelowUseSkillBlow::OnBegin( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
OutputDebug( "CDnHPBelowUseSkillBlow::OnBegin Value:%2.2f\n", m_fValue );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnHPBelowUseSkillBlow::Process( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
CDnBlow::Process( LocalTime, fDelta );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CDnHPBelowUseSkillBlow::OnEnd( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
OutputDebug( "CDnHPBelowUseSkillBlow::OnEnd Value:%2.2f\n", m_fValue );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
float CDnHPBelowUseSkillBlow::CalcDamage( float fOriginalDamage )
|
|||
|
|
{
|
|||
|
|
float fResult = 0.0f;
|
|||
|
|
int iNowHP = (int)m_hActor->GetHP();
|
|||
|
|
|
|||
|
|
if( iNowHP - (int)fOriginalDamage <= m_nHP )
|
|||
|
|
{
|
|||
|
|
if( m_nSkillIndex > 0 )
|
|||
|
|
{
|
|||
|
|
if( m_hActor )
|
|||
|
|
m_hActor->UseSkill( m_nSkillIndex, false );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return fResult;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
float CDnHPBelowUseSkillBlow::OnCalcDamage( float fOriginalDamage, CDnDamageBase::SHitParam& HitParam )
|
|||
|
|
{
|
|||
|
|
return CalcDamage( fOriginalDamage );
|
|||
|
|
}
|
|||
|
|
#endif // _GAMESERVER
|
|||
|
|
|
|||
|
|
#if defined(PRE_ADD_PREFIX_SYSTE_RENEW)
|
|||
|
|
void CDnHPBelowUseSkillBlow::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 CDnHPBelowUseSkillBlow::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
|
|||
|
|
|
|||
|
|
#endif // PRE_ADD_HPBELOWDOSKILLBLOW
|