本文整理汇总了C++中CUser::Attack方法的典型用法代码示例。如果您正苦于以下问题:C++ CUser::Attack方法的具体用法?C++ CUser::Attack怎么用?C++ CUser::Attack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::Attack方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecvAttackReq
void CGameSocket::RecvAttackReq(Packet & pkt)
{
uint16 sid, tid;
float rx=0.0f, ry=0.0f, rz=0.0f, fDir = 0.0f, fHitAgi, fAvoidAgi;
short sDamage, sAC, sItemAC, sAmountLeft, sAmountRight;
uint8 type, result, bTypeLeft, bTypeRight;
pkt >> type >> result >> sid >> tid >> sDamage >> sAC >> fHitAgi >> fAvoidAgi
>> sItemAC >> bTypeLeft >> bTypeRight >> sAmountLeft >> sAmountRight;
CUser* pUser = g_pMain->GetUserPtr(sid);
if (pUser == nullptr
|| pUser->m_bLive == AI_USER_DEAD
|| pUser->m_sHP <= 0)
return;
pUser->m_sHitDamage = sDamage;
pUser->m_fHitrate = fHitAgi;
pUser->m_fAvoidrate = fAvoidAgi;
pUser->m_sAC = sAC;
pUser->m_sItemAC = sItemAC;
pUser->m_bMagicTypeLeftHand = bTypeLeft;
pUser->m_bMagicTypeRightHand = bTypeRight;
pUser->m_sMagicAmountLeftHand = sAmountLeft;
pUser->m_sMagicAmountRightHand = sAmountRight;
pUser->Attack(sid, tid);
}
示例2: RecvAttackReq
void CGameSocket::RecvAttackReq(Packet & pkt)
{
uint16 sid, tid;
uint8 type, result;
pkt >> type >> result >> sid >> tid;
CUser* pUser = g_pMain->GetUserPtr(sid);
if (pUser == nullptr
|| pUser->isDead())
return;
pUser->Attack(sid, tid);
}
示例3: RecvAttackReq
void CGameSocket::RecvAttackReq(Packet & pkt)
{
uint16 sid, tid;
float rx=0.0f, ry=0.0f, rz=0.0f, fDir = 0.0f, fHitAgi, fAvoidAgi;
short sDamage, sAC, sItemAC, sAmountLeft, sAmountRight;
BYTE type, result, bTypeLeft, bTypeRight;
pkt >> type >> result >> sid >> tid >> sDamage >> sAC >> fHitAgi >> fAvoidAgi
>> sItemAC >> bTypeLeft >> bTypeRight >> sAmountLeft >> sAmountRight;
CUser* pUser = g_pMain->GetUserPtr(sid);
if(pUser == NULL) return;
if(pUser->m_bLive == USER_DEAD || pUser->m_sHP <= 0)
{
if(pUser->m_sHP > 0)
{
pUser->m_bLive = USER_LIVE;
TRACE("##### CGameSocket-Attack Fail : User가 Heal된 경우.. [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
}
else
{
TRACE("##### CGameSocket-Attack Fail : UserDead [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
// 죽은 유저이므로 게임서버에 죽은 처리를 한다...
Send_UserError(sid, tid);
return;
}
}
pUser->m_sHitDamage = sDamage;
pUser->m_fHitrate = fHitAgi;
pUser->m_fAvoidrate = fAvoidAgi;
pUser->m_sAC = sAC;
pUser->m_sItemAC = sItemAC;
pUser->m_bMagicTypeLeftHand = bTypeLeft;
pUser->m_bMagicTypeRightHand = bTypeRight;
pUser->m_sMagicAmountLeftHand = sAmountLeft;
pUser->m_sMagicAmountRightHand = sAmountRight;
pUser->Attack(sid, tid);
}
示例4: RecvAttackReq
void CGameSocket::RecvAttackReq(char* pBuf)
{
int index = 0;
int sid = -1, tid = -1;
BYTE type, result;
char buff[256];
memset( buff, 0x00, 256 );
float rx=0.0f, ry=0.0f, rz=0.0f;
float fDir = 0.0f;
short sDamage, sAC;
float fHitAgi, fAvoidAgi;
//
short sItemAC;
BYTE bTypeLeft;
BYTE bTypeRight;
short sAmountLeft;
short sAmountRight;
//
type = GetByte(pBuf,index);
result = GetByte(pBuf,index);
sid = GetShort(pBuf,index);
tid = GetShort(pBuf,index);
sDamage = GetShort( pBuf, index );
sAC = GetShort( pBuf, index );
fHitAgi = Getfloat( pBuf, index );
fAvoidAgi = Getfloat( pBuf, index );
//
sItemAC = GetShort(pBuf, index);
bTypeLeft = GetByte(pBuf, index);
bTypeRight = GetByte(pBuf, index);
sAmountLeft = GetShort(pBuf, index);
sAmountRight = GetShort(pBuf, index);
//
//TRACE("RecvAttackReq : [sid=%d, tid=%d, zone_num=%d] \n", sid, tid, m_sSocketID);
CUser* pUser = NULL;
pUser = m_pMain->GetUserPtr(sid);
if(pUser == NULL) return;
//TRACE("RecvAttackReq 222 : [id=%d, %s, bLive=%d, zone_num=%d] \n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, m_sSocketID);
if(pUser->m_bLive == USER_DEAD || pUser->m_sHP <= 0)
{
if(pUser->m_sHP > 0)
{
pUser->m_bLive = USER_LIVE;
TRACE("##### CGameSocket-Attack Fail : User가 Heal된 경우.. [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
}
else
{
TRACE("##### CGameSocket-Attack Fail : UserDead [id=%d, %s, bLive=%d, hp=%d] ######\n", pUser->m_iUserId, pUser->m_strUserID, pUser->m_bLive, pUser->m_sHP);
// 죽은 유저이므로 게임서버에 죽은 처리를 한다...
Send_UserError(sid, tid);
return;
}
}
pUser->m_sHitDamage = sDamage;
pUser->m_fHitrate = fHitAgi;
pUser->m_fAvoidrate = fAvoidAgi;
pUser->m_sAC = sAC;
//
pUser->m_sItemAC = sItemAC;
pUser->m_bMagicTypeLeftHand = bTypeLeft;
pUser->m_bMagicTypeRightHand = bTypeRight;
pUser->m_sMagicAmountLeftHand = sAmountLeft;
pUser->m_sMagicAmountRightHand = sAmountRight;
//
pUser->Attack(sid, tid);
}