本文整理汇总了C++中CMoveShape::SetHp方法的典型用法代码示例。如果您正苦于以下问题:C++ CMoveShape::SetHp方法的具体用法?C++ CMoveShape::SetHp怎么用?C++ CMoveShape::SetHp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMoveShape
的用法示例。
在下文中一共展示了CMoveShape::SetHp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSkillMessage
// 响应SKILL消息
void OnSkillMessage(CMessage* pMsg)
{
switch(pMsg->GetType())
{
case MSG_S2C_SKILL_LOCK_GOODS:
{
long lExtendID = pMsg->GetLong();
long lPos = pMsg->GetLong();
CPlayer* pMainPlayer = GetGame()->GetMainPlayer();
if (pMainPlayer!=NULL)
{
CGoods* pGoods = pMainPlayer->GetGoodsByPosition(lExtendID,lPos);
if (pGoods!=NULL&&!pGoods->IsLocked())
{
pGoods->Lock();
//CItemPageEx* pPage = GetGame()->GetCGuiEx()->GetItemPageEx();
//if (pPage!=NULL)
//{
// pPage->UpdateGoodsShow(lExtendID,(int)lPos);
//}
}
}
}
break;
case MSG_S2C_SKILL_UNLOCK_GOODS:
{
DWORD lExtendID = pMsg->GetDWord();
DWORD lPos = pMsg->GetDWord();
CPlayer* pMainPlayer = GetGame()->GetMainPlayer();
if (pMainPlayer!=NULL)
{
CGoods* pGoods = pMainPlayer->GetGoodsByPosition(lExtendID,lPos);
if (pGoods!=NULL&&pGoods->IsLocked())
{
pGoods->UnLock();
CMainPlayerHand* pHand = 0;//GetGame()->GetCGuiEx()->GetPMainPlayerHand();
if (pHand!=NULL&&pHand->GetPGoodsOfMainPlayerHand()!=NULL&&
pHand->GetPGoodsOfMainPlayerHand()->GetExID()==pGoods->GetExID())
{
pGoods->SetHaveShadowState(true);
}
}
}
}
break;
case MSG_S2C_SKILL_STATE_CHANGE:
//##同步状态消息
{
LONG lType = pMsg -> GetLong();
CGUID ID;
pMsg->GetGUID(ID);
DWORD dwHP = pMsg -> GetDWord();
WORD wMP = pMsg -> GetWord();
WORD eg = pMsg -> GetWord();
if(lType==TYPE_PLAYER)
{
CPlayer* pMainPlayer = pMsg -> GetPlayer();
//是自己则改变自己
if(pMainPlayer->GetExID() == ID)
{
pMainPlayer -> SetHp( dwHP );
pMainPlayer -> SetMp(wMP);
pMainPlayer -> SetEnergy(eg);
//pMainPlayer -> SetRP( wRP );
//pMainPlayer -> SetYP( wYP );
}
else
{
//看是否是队友
vector<CPlayer::tagTeammate>& vTeammate = pMainPlayer -> GetTeam();
for( size_t i = 0; i < vTeammate.size(); i ++ )
{
if( vTeammate[i].ID == ID )
{
vTeammate[i].wHP = (WORD)dwHP;
break;
}
}
}
}
else
{
//改变怪物状态
CMoveShape* pShape = (CMoveShape*)GetGame()->GetRegion()->FindChildObject(lType, ID);
if (pShape)
{
pShape->SetHp(dwHP);
}
}
}
break;
case MSG_S2C_SKILL_USE:
{
CHAR cResult = pMsg->GetChar();
DWORD dwCurTime = GetCurTickCount();
switch(cResult)
{
case SKILL_USE_RESULT_BEGIN:
{
//.........这里部分代码省略.........