192 lines
5.7 KiB
C++
192 lines
5.7 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "DnDissolveDebufBlow.h"
|
|||
|
|
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
CDnDissolveDebufBlow::CDnDissolveDebufBlow( DnActorHandle hActor, const char* szValue ) : CDnBlow( hActor )
|
|||
|
|
{
|
|||
|
|
m_StateBlow.emBlowIndex = STATE_BLOW::BLOW_069;
|
|||
|
|
SetValue( szValue );
|
|||
|
|
//m_nValue = atoi( szValue );
|
|||
|
|
m_fValue = (float)atof(szValue);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CDnDissolveDebufBlow::~CDnDissolveDebufBlow(void)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
bool CDnDissolveDebufBlow::_IsBadStateBlow( DnBlowHandle hBlow )
|
|||
|
|
{
|
|||
|
|
return hBlow->GetBlowIndex() == STATE_BLOW::BLOW_041 ||
|
|||
|
|
hBlow->GetBlowIndex() == STATE_BLOW::BLOW_042 ||
|
|||
|
|
hBlow->GetBlowIndex() == STATE_BLOW::BLOW_043 ||
|
|||
|
|
hBlow->GetBlowIndex() == STATE_BLOW::BLOW_044 ||
|
|||
|
|
hBlow->GetBlowIndex() == STATE_BLOW::BLOW_045 || // <20><><EFBFBD><EFBFBD>
|
|||
|
|
hBlow->GetBlowIndex() == STATE_BLOW::BLOW_078 || // <20><>ų <20><><EFBFBD><EFBFBD> <20>Ұ<EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF>
|
|||
|
|
hBlow->GetBlowIndex() == STATE_BLOW::BLOW_070 ||
|
|||
|
|
hBlow->GetBlowIndex() == STATE_BLOW::BLOW_071;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void CDnDissolveDebufBlow::OnBegin( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
#ifdef _GAMESERVER
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴ϶<C6B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ų <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
multimap<int, DnBlowHandle> mmapDebuffBlowsBySkill;
|
|||
|
|
|
|||
|
|
int iDissolveCount = 0;
|
|||
|
|
int iNumAppliedBlow = m_hActor->GetNumAppliedStateBlow();
|
|||
|
|
vector<int> vlDebuffSkillID;
|
|||
|
|
for( int iBlow = 0; iBlow < iNumAppliedBlow; ++iBlow )
|
|||
|
|
{
|
|||
|
|
DnBlowHandle hBlow = m_hActor->GetAppliedStateBlow( iBlow );
|
|||
|
|
if( !hBlow )
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
CDnSkill::SkillInfo* pSkillInfo = const_cast<CDnSkill::SkillInfo*>(hBlow->GetParentSkillInfo());
|
|||
|
|
|
|||
|
|
if( pSkillInfo && pSkillInfo->iSkillID )
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF>. <20><><EFBFBD><EFBFBD>, <20>ߵ<EFBFBD>, ȭ<><C8AD>, <20>ൿ<EFBFBD>Ұ<EFBFBD>, <20>̵<EFBFBD><CCB5>Ұ<EFBFBD>, Ȥ<><C8A4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>õ<EFBFBD> <20><>ų<EFBFBD><C5B3>
|
|||
|
|
if( (0 == pSkillInfo->iDissolvable) &&
|
|||
|
|
(CDnSkill::Debuff == pSkillInfo->eDurationType || _IsBadStateBlow(hBlow)) )
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD> <20>ƴ϶<C6B4><CFB6><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD> <20>Ѵ<EFBFBD>.
|
|||
|
|
bool bBadBlow = true;
|
|||
|
|
if( (pSkillInfo->hSkillUser) && (false == _IsBadStateBlow(hBlow)) )
|
|||
|
|
{
|
|||
|
|
bBadBlow = false;
|
|||
|
|
bool bOtherTeam = (m_hActor->GetTeam() != pSkillInfo->hSkillUser->GetTeam());
|
|||
|
|
if( (CDnSkill::Enemy == pSkillInfo->eTargetType) && bOtherTeam )
|
|||
|
|
{
|
|||
|
|
bBadBlow = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3> <20><>ų Ÿ<><C5B8>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> All <20>̰<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<><C5B8><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
if( (CDnSkill::All == pSkillInfo->eTargetType) && bOtherTeam )
|
|||
|
|
{
|
|||
|
|
DnSkillHandle hSkill = pSkillInfo->hSkillUser->FindSkill( pSkillInfo->iSkillID );
|
|||
|
|
if( hSkill )
|
|||
|
|
{
|
|||
|
|
DWORD dwNumSE = hSkill->GetStateEffectCount();
|
|||
|
|
for( DWORD dwSE = 0; dwSE < dwNumSE; ++dwSE )
|
|||
|
|
{
|
|||
|
|
const CDnSkill::StateEffectStruct* pSE = hSkill->GetStateEffectFromIndex( dwSE );
|
|||
|
|
if( pSE && pSE->ApplyType == CDnSkill::StateEffectApplyType::ApplyEnemy )
|
|||
|
|
{
|
|||
|
|
if( (STATE_BLOW::emBLOW_INDEX)pSE->nID == hBlow->GetBlowIndex() )
|
|||
|
|
{
|
|||
|
|
bBadBlow = true;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if( bBadBlow )
|
|||
|
|
{
|
|||
|
|
mmapDebuffBlowsBySkill.insert( make_pair(pSkillInfo->iSkillID, hBlow) );
|
|||
|
|
|
|||
|
|
// <20>ϳ<EFBFBD><CFB3><EFBFBD> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>. <20><><EFBFBD><EFBFBD>ũ<EFBFBD><C5A9> <20><>ų <20><><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20>־<EFBFBD><D6BE>ش<EFBFBD>.
|
|||
|
|
if( vlDebuffSkillID.end() == find( vlDebuffSkillID.begin(), vlDebuffSkillID.end(), pSkillInfo->iSkillID ) )
|
|||
|
|
vlDebuffSkillID.push_back( pSkillInfo->iSkillID );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DNVector(int) vlAppliedDebuffBlowIds;
|
|||
|
|
for( int i = 0; i < (int)vlDebuffSkillID.size(); ++i )
|
|||
|
|
{
|
|||
|
|
if( iDissolveCount >= (int)m_fValue )
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
pair<multimap<int, DnBlowHandle>::iterator, multimap<int, DnBlowHandle>::iterator> iter_pair =
|
|||
|
|
mmapDebuffBlowsBySkill.equal_range( vlDebuffSkillID.at(i) );
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><>ų<EFBFBD><C5B3><EFBFBD><EFBFBD> <20><><EFBFBD>Ե<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ƶд<C6B5>.
|
|||
|
|
multimap<int, DnBlowHandle>::iterator iter = iter_pair.first;
|
|||
|
|
for( iter; iter != iter_pair.second; ++iter )
|
|||
|
|
vlAppliedDebuffBlowIds.push_back( iter->second->GetBlowID() );
|
|||
|
|
|
|||
|
|
++iDissolveCount;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ų, <20><><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
int iNumBlow = (int)vlAppliedDebuffBlowIds.size();
|
|||
|
|
for( int iBlow = 0; iBlow < iNumBlow; ++iBlow )
|
|||
|
|
{
|
|||
|
|
int iBlowID = vlAppliedDebuffBlowIds.at( iBlow );
|
|||
|
|
m_hActor->CmdRemoveStateEffectFromID( iBlowID );
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void CDnDissolveDebufBlow::OnEnd( LOCAL_TIME LocalTime, float fDelta )
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#if defined(PRE_ADD_PREFIX_SYSTE_RENEW)
|
|||
|
|
void CDnDissolveDebufBlow::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 CDnDissolveDebufBlow::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
|