本文整理汇总了C++中Obj_Human::CanActionFlag1方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Human::CanActionFlag1方法的具体用法?C++ Obj_Human::CanActionFlag1怎么用?C++ Obj_Human::CanActionFlag1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_Human
的用法示例。
在下文中一共展示了Obj_Human::CanActionFlag1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
uint CGUseAbilityHandler::Execute(CGUseAbility* pPacket,Player* pPlayer)
{
__ENTER_FUNCTION
GamePlayer* pGamePlayer = (GamePlayer*)pPlayer;
Assert( pGamePlayer );
Obj_Human* pHuman = pGamePlayer->GetHuman();
Assert( pHuman );
Scene* pScene = pHuman->getScene();
if( pScene==NULL )
{
Assert(FALSE);
return PACKET_EXE_ERROR;
}
// 检查线程执行资源是否正确
Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );
// 玩家处于不可行动状态
if( !pHuman->IsAlive() )
{ // 返给玩家一条错误信息
GCAbilityResult Msg ;
Msg.SetAbilityID( pPacket->GetAbilityID() );
Msg.SetPrescriptionID( pPacket->GetPrescriptionID() );
Msg.setResult( OR_DIE ) ;
pGamePlayer->SendPacket( &Msg ) ;
return PACKET_EXE_CONTINUE ;
}
//玩家有没有别昏迷或沉默?
if(FALSE==pHuman->CanActionFlag1() || FALSE==pHuman->CanActionFlag2())
{
GCAbilityResult Msg ;
Msg.SetAbilityID( pPacket->GetAbilityID() );
Msg.SetPrescriptionID( pPacket->GetPrescriptionID() );
Msg.setResult(OR_U_CANNT_DO_THIS_RIGHT_NOW) ;
pGamePlayer->SendPacket( &Msg );
return PACKET_EXE_CONTINUE;
}
//玩家有没有在做别的事?
if(FALSE==GetGlobalActionDelegator().CanDoNextAction(*pHuman))
{
GCAbilityResult Msg ;
Msg.SetAbilityID( pPacket->GetAbilityID() );
Msg.SetPrescriptionID( pPacket->GetPrescriptionID() );
Msg.setResult(OR_BUSY) ;
pGamePlayer->SendPacket( &Msg ) ;
return PACKET_EXE_CONTINUE;
}
Ability* pAbility = g_pAbilityManager->GetAbility(pPacket->GetAbilityID());
if( pAbility == NULL )
{ // 不存在该技能
return PACKET_EXE_CONTINUE;
}
pHuman->reset_AbilityOpera();
AbilityOpera* pAbilityOpera;
pAbilityOpera = pHuman->GetAbilityOpera();
pAbilityOpera->m_AbilityID = pPacket->GetAbilityID();
pAbilityOpera->m_PresID = pPacket->GetPrescriptionID();
pAbilityOpera->m_Obj = pPacket->GetPlatformGUID();
pAbilityOpera->m_nMaxTime = pAbility->OperationTime();
ORESULT res = pHuman->GetHumanAI()->PushCommand_UseAbility();
if( res == OR_OK )
{
//GCAbilityAction Msg;
//Msg.setObjID( pHuman->GetID() );
//Msg.setAction( pAbility->AbilityID() );
//Msg.setTargetID( pAbilityOpera->m_Obj );
//Msg.setBeginOrEnd( GCAbilityAction::ABILITY_BEGIN );
//pScene->BroadCast( &Msg, pHuman, FALSE );
}
GCAbilityResult Msg;
Msg.SetAbilityID( pAbilityOpera->m_AbilityID );
Msg.SetPrescriptionID( pAbilityOpera->m_PresID );
Msg.setResult( res );
pGamePlayer->SendPacket( &Msg );
g_pLog->FastSaveLog( LOG_FILE_1, "CGUseAbilityHandler AbilityID=%d PrescriptionID=%d PlatformGUID=%d Result=%d",
pPacket->GetAbilityID(), pPacket->GetPrescriptionID(), pPacket->GetPlatformGUID(), res ) ;
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}