当前位置: 首页>>代码示例>>C++>>正文


C++ Obj_Character类代码示例

本文整理汇总了C++中Obj_Character的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Character类的具体用法?C++ Obj_Character怎么用?C++ Obj_Character使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Obj_Character类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Assert

uint CGAskDetailXinFaListHandler::Execute( CGAskDetailXinFaList* 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 ) ;

	ObjID_t ObjID = pHuman->GetID();
	if( ObjID == INVALID_ID )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	Obj_Character *pTarget = (Obj_Character*)(pScene->GetObjManager()->GetObj(pPacket->getTargetID()));
	if( pTarget==NULL )
	{
		Assert( pTarget ) ;
		return PACKET_EXE_ERROR ;
	}

	// 权限判断
	// to be continue...
	if ( pTarget->GetObjType() != Obj::OBJ_TYPE_HUMAN
		&& pTarget->GetObjType() != Obj::OBJ_TYPE_PET )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGAskDetailXinFaListHandler: faile obj=%d scene=%d", 
			ObjID, pScene->SceneID() ) ;
		return PACKET_EXE_CONTINUE;
	}

	GCDetailXinFaList	Msg;

	Msg.setObjID( pTarget->GetID() );

	Msg.setXinFaList(pHuman->Skill_GetXinFaList().m_Count, pHuman->Skill_GetXinFaList().m_aXinFa);
	pGamePlayer->SendPacket( &Msg ) ;

	g_pLog->FastSaveLog( LOG_FILE_1, "CGAskDetailXinFaListHandler: ok obj=%d scene=%d", 
		ObjID, pScene->SceneID() ) ;

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:,项目名称:,代码行数:60,代码来源:

示例2: AssertEx

BOOL RootTrap01_T::EffectOnChar(Obj_Special& rThis, Obj_Character& rTar) const
{
    SpecialObjData_T const* pData = rThis.GetDataRecord();
    if(NULL==pData)
    {
        AssertEx(FALSE,"[RootTrap01_T::EffectOnChar]: Can't find Data record.");
        return FALSE;
    }
    INT nImpactID = pData->GetDescriptorByIndex(0)->GetValue();
    Time_t nContinuance = pData->GetDescriptorByIndex(1)->GetValue();
    OWN_IMPACT impact;
    SOT_Root_T ImpactLogic;
    ImpactLogic.InitStruct(impact);
    impact.m_nCasterID = rThis.GetOwnerID();
    impact.m_nSkillID = INVALID_ID;
    impact.m_nImpactID = nImpactID;
    ImpactLogic.SetContinuance(impact, nContinuance);
    impact.m_nPRI = rThis.GetXinFaLevelForBuffMutex();

    Scene* pScene = rThis.getScene();
    if(NULL!=pScene)
    {
        pScene->GetEventCore().RegisterBeSkillEvent(rTar.GetID(), rThis.GetOwnerID(), BEHAVIOR_TYPE_HOSTILITY, 500);
        pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), rThis.GetOwnerID(), impact, 500);
    }
    return FALSE;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:27,代码来源:RootTrap01.cpp

示例3: Assert

BOOL CharacterManager::DelCharacter( ObjID_t ObjID )
{
__ENTER_FUNCTION

    Obj_Character* pCharacter = (Obj_Character*)(GetScene()->GetObjManager()->GetObj(ObjID)) ;
    Assert( pCharacter ) ;
    
    UINT index = (UINT)(pCharacter->GetCharacterID()) ;
    Assert( index<m_Count ) ;

    Assert( m_Count > 0 ) ;
    Assert( m_pObjIDs[index]==ObjID ) ;

    m_pObjIDs[index] = m_pObjIDs[m_Count-1] ;
    pCharacter->SetCharacterID( INVALID_ID ) ;

    Obj_Character* pNewCharacter = (Obj_Character*)(GetScene()->GetObjManager()->GetObj(m_pObjIDs[index])) ;
    Assert( pNewCharacter ) ;

    pNewCharacter->SetCharacterID( index ) ;

    m_Count -- ;
    Assert( m_Count>=0 ) ;


    return TRUE ;

__LEAVE_FUNCTION

    return FALSE ;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:31,代码来源:CharacterManager.cpp

示例4:

		VOID StdImpact072_T::GetRealPos( Obj_Character &rMe, WORLD_POS &sFinalPos, WORLD_POS &sPosTag, WORLD_POS &sDir ) const
		{
			__ENTER_FUNCTION

			FLOAT fLengthOfStep = 0.5f;
			FLOAT fLengthTmp	= 0;
			WORLD_POS sPosTmp;
			//按照前进方向以格子边长(0.5)为步长向目标方向查询,遇障碍或到达目标点为止
			while( TRUE )
			{
				//比较当前位置和目标点的距离,如果小于步长则直接到达并结束
				fLengthTmp = rMe.WordPosLength( sFinalPos.m_fX-sPosTag.m_fX, sFinalPos.m_fZ-sPosTag.m_fZ );
				if( fLengthTmp < fLengthOfStep )
				{
					if ( rMe.getScene()->GetMap()->IsCanGo(sFinalPos) )
						sPosTag = sFinalPos;
					break;
				}
				//如果大于步长则增加一个步长的距离
				sPosTmp.m_fX = sPosTag.m_fX + sDir.m_fX*fLengthOfStep;
				sPosTmp.m_fZ = sPosTag.m_fZ + sDir.m_fZ*fLengthOfStep;
				//判断新位置是否可以通过
				if ( rMe.getScene()->GetMap()->IsCanGo(sPosTmp) )
					sPosTag = sPosTmp;
				//不可通过则结束
				else break;
			}
			__LEAVE_FUNCTION

		}
开发者ID:uvbs,项目名称:wx2Server,代码行数:30,代码来源:StdImpact072.cpp

示例5: AssertEx

 VOID StdImpact030_T::OnFadeOut(OWN_IMPACT& rImp, Obj_Character& rMe) const
 {
     __ENTER_FUNCTION
     Obj_Character* pTar=NULL;
     Scene* pScene = rMe.getScene();
     if(NULL==pScene)
     {
         AssertEx(FALSE, "[StdImpact030_T::OnFadeOut]: Empty scene pointer found!!");
         return;
     }
     OBJLIST Targets;
     if(FALSE==ScanUnitForTarget(rImp, rMe, *(rMe.getWorldPos()), (FLOAT)GetScanRadius(rImp), GetEffectedObjCount(rImp), Targets))
     {
         return;
     }
     INT nImpact = GetSubImpactIndex(rImp);
     if(INVALID_ID==nImpact)
     {
         return;
     }
     // impacts init finished
     for(INT nIdx=0; Targets.m_Count>nIdx;++nIdx)
     {
         pTar = (Obj_Character*)Targets.m_aObj[nIdx];
         if(NULL!=pTar)
         {
             pScene->GetEventCore().RegisterBeSkillEvent(pTar->GetID(), rMe.GetID(), BEHAVIOR_TYPE_HOSTILITY, 500);
             g_ImpactCore.SendImpactToUnit(*pTar, nImpact, rMe.GetID(), 500);
         }
     }
     return;
     __LEAVE_FUNCTION
 }
开发者ID:gangzi4494,项目名称:web-pap,代码行数:33,代码来源:StdImpact030.cpp

示例6:

		BOOL XingXiuSkill008_T::EffectOnUnitEachTick(Obj_Character& rMe, Obj_Character& rTar, BOOL bCriticalFlag) const
		{
			__ENTER_FUNCTION
			SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();

			INT nDamage = rSkillInfo.GetDescriptorByIndex(1)->GetValue();
			INT nTransferRate = rSkillInfo.GetDescriptorByIndex(2)->GetValue();
			INT nAbsorbed = (nDamage*nTransferRate+50)/100;

			OWN_IMPACT impact1;
			DI_Damage_T const logic1;
			logic1.InitStruct(impact1);
			logic1.SetDamage(impact1, nDamage);

			OWN_IMPACT impact2;
			DI_Heal_T const logic2;
			logic2.InitStruct(impact2);
			logic2.SetHealedHP(impact2, nAbsorbed);
			impact2.m_nImpactID = rSkillInfo.GetDescriptorByIndex(0)->GetValue();

			//register impact event
			RegisterImpactEvent(rTar, rMe, impact1, rParams.GetDelayTime(), bCriticalFlag);
			RegisterImpactEvent(rMe, rMe, impact2, rParams.GetDelayTime(), bCriticalFlag);
			return TRUE;
			__LEAVE_FUNCTION
			return FALSE;
		}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:28,代码来源:XingXiuSkill008.cpp

示例7: if

		BOOL GaiBangSkill004_T::EffectOnUnitOnce(Obj_Character& rMe, Obj_Character& rTar, BOOL bCriticalFlag) const
		{
			__ENTER_FUNCTION
			SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();

			INT nDepleteStrikePointSegment = rParams.GetDepletedStrikePoints()/STRIKE_POINT_SEGMENT_SIZE;
			if(1>nDepleteStrikePointSegment)
			{
				AssertEx(FALSE,"[GaiBangSkill004_T::TakeEffectNow]: Depleted strike point segment illegal!");
				nDepleteStrikePointSegment=1;
			}
			else if(MAX_STRIKE_POINT_SEGMENT<nDepleteStrikePointSegment)
			{
				AssertEx(FALSE,"[GaiBangSkill004_T::TakeEffectNow]: Depleted strike point segment illegal!");
				nDepleteStrikePointSegment=MAX_STRIKE_POINT_SEGMENT;
			}
			INT nAdditionalAttackPower = rSkillInfo.GetDescriptorByIndex(nDepleteStrikePointSegment)->GetValue();
			// init impact1
			OWN_IMPACT impact;
			
			CombatCore_T myCombatCore;
			myCombatCore.Reset();			
			myCombatCore.SetAdditionalAttackLight(nAdditionalAttackPower);
			myCombatCore.GetResultImpact(rMe, rTar, impact);

			// register impact event
			RegisterImpactEvent(rTar, rMe, impact, rParams.GetDelayTime(), bCriticalFlag);
			return TRUE;
			__LEAVE_FUNCTION
			return FALSE;
		}
开发者ID:brock7,项目名称:TianLong,代码行数:32,代码来源:GaiBangSkill004.cpp

示例8:

		VOID StdImpact059_T::SendLayerChangeMsg( OWN_IMPACT& rImp, Obj_Character& rMe ) const
		{
			__ENTER_FUNCTION

			//通知客户端层数改变
			// Info Other Impact
			//通知其它客户端效果生效
			Scene * pScene = rMe.getScene();
			if(NULL==pScene||FALSE==rMe.IsActiveObj())
			{
				return;
			}
			GCCharBuff Msg2Other;
			Msg2Other.SetReceiverID(rImp.GetCasterObjID());
			Msg2Other.SetSenderID(rImp.GetCasterObjID());
			Msg2Other.SetEnable(TRUE);
			Msg2Other.SetSN(rImp.GetSN());
			Msg2Other.SetBuffID(Impact_GetImpactID(rImp));
			Msg2Other.SetSenderLogicCount(rImp.GetCasterLogicCount());
			Msg2Other.SetSkillID( rImp.GetSkillID() );
			Msg2Other.SetLayerCount( rImp.GetLayerCount() );

			// 设置技能效果的持续时间  20100531 BLL
			Msg2Other.SetContinuance( rImp.GetContinuance() );

			if(INVALID_ID!=Impact_GetImpactID(rImp))
			{
				pScene->BroadCast(&Msg2Other, &rMe, TRUE);
			}
			__LEAVE_FUNCTION
		}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例9: MagicalDamage

	INT CombatCore_T::MagicalDamage(Obj_Character& rMe, Obj_Character& rTar, INT nAdditionAttack, INT nAdditionDefence)
	{
		__ENTER_FUNCTION
		INT	nDamage;
		INT nAttack = Attr_VerifyGeneralAttack(rMe.GetAttackMagic()+nAdditionAttack);
		INT nDefence = Attr_VerifyDefence(rTar.GetDefenceMagic()+nAdditionDefence);
		INT nIgnoreRate = 0;
		// calculate damage
		if(Obj::OBJ_TYPE_HUMAN==rTar.GetObjType())
		{
			nIgnoreRate= rTar.ItemValue(IATTRIBUTE_IMMUNITY_P).m_Value;
		}
		if(0==nAttack+nDefence)
		{
			//never enter here
			nDamage = 0;
		}
		else
		{
			nDamage = nAttack*nAttack/(nAttack+nDefence);
		}
		0>nIgnoreRate?nIgnoreRate=0:NULL;
		100<nIgnoreRate?nIgnoreRate=100:NULL;
		nDamage = nDamage - Float2Int((nDamage*nIgnoreRate)/100.0f);
		0>nDamage?nDamage=0:NULL;
		return nDamage;
		__LEAVE_FUNCTION
		return 0;
	}
开发者ID:brock7,项目名称:TianLong,代码行数:29,代码来源:Combat_Core.cpp

示例10: GET_MONSTER_SCENE

VOID AI_Monster::AI_Logic_Approach( UINT uTime )
{
__ENTER_FUNCTION
	/** 先进行Approach类型的判断 */
	GET_MONSTER_SCENE((VOID)0)

	Obj* pObj = pScene->GetObjManager()->GetObj(m_CurEnemyID);
	if (!pObj 
		|| !IsCharacterObj(pObj->GetObjType()) 
		|| !((Obj_Character*)pObj)->IsAlive() 
		|| !((Obj_Character*)pObj)->IsCanViewMe(pMonster) 
		)
	{/** 当前敌人无效后转向下一个敌人,直到全部找完为止 */
		DelEnemy(m_CurEnemyID);
		m_CurEnemyID = GetNextEnemy();
		if (INVALID_ID == m_CurEnemyID) {
			ToGoHome();
		}
		return ;
	}
	Obj_Character* pCurEnemy = (Obj_Character*)pObj;

	
	FLOAT fMTDist,fETDist;
	if (!pCurEnemy)
	{
		Assert(NULL && "AI_Monster::Logic_Approach...pCurEnemy=NULL...");
		ToGoHome();
		return  ;
	}
	FLOAT fDist = MySqrt(pMonster->getWorldPos(), pCurEnemy->getWorldPos());
	if ( IsToGoHome(fMTDist, fETDist) ) 
	{
		return ;
	}

	if (ZERO_VALUE > fMTDist) 
	{/** 如果到达目的地 */
		ToAttack();
	}
	else
	{
		if( fETDist > (FLOAT)AIParam(AIPARAM_RESETTARGET_DIST)/1000.0f)
		{/** 如果目标位置和敌人位置的距离大与一定值则需要重新制定移动目标 */
			ToApproachTar( ) ;
		}
		else if(!GetCharacter()->IsMoving())
		{
			ToApproachTar( );
		}
	}
	ExcuteAIScript(SAPPROACH);

__LEAVE_FUNCTION
}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例11: IsHappend

		VOID StdImpact081_T::SendImpactToMe( OWN_IMPACT& rImp, Obj_Character& rMe ) const
		{
			//第一个技能是否可以被触发
			BOOL bFirstHappend = IsHappend(rMe, rImp, 0);

			for(INT nID = 0; nID < MAX_IMPACT_NUM_AT_SAME_TIME; nID++)
			{
				INT iImpactID = GetImpactID(rImp, nID);
				if(INVALID_ID == iImpactID)
				{
					break;
				}
				if(0 == nID)
				{
					//如果第一个技能没有概率触发
					if(!bFirstHappend)
					{
						continue;
					}
				}
				else
				{
					if(INVALID_ID == GetEffectRate( rImp , nID))
					{
						//其它的impact的概率值写-1,认为应该取第一项计算出的概率值
						if(!bFirstHappend)
						{
							continue;
						}
					}
					else
					{
						//单独计算其概率值
						if(!IsHappend(rMe, rImp, nID))
						{
							continue;
						}
					}
				}
				
				Obj_Character* pAttacker = GetBeHitTarget( rMe, rImp );
				if(pAttacker)
				{
					INT iTargetType = GetTargetType( rImp, nID );
					if( iTargetType == TargetTypeMe )
					{
						g_ImpactCore.SendImpactToUnit(rMe, iImpactID, pAttacker->GetID(), 0);
					}
					else
					{
						g_ImpactCore.SendImpactToUnit(*pAttacker, iImpactID, rMe.GetID(), 0);
					}				
				}
			}
		}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例12: Impact_GetLogic

		BOOL ImpactCore_T::SendImpactToUnit(Obj_Character& rTar, ID_t nDataIndex, ObjID_t nSender, Time_t nDelayTime, BOOL bCriticalFlag, INT nRefixRate, INT nReserveParam1, INT nReserveParam2) const
		{
			__ENTER_FUNCTION
			OWN_IMPACT impact;
			if(INVALID_ID == nDataIndex)
			{
				return FALSE;
			}
			//根据nDataIndex对应的效果逻辑初始化rImp
			if(TRUE == InitImpactFromData(nDataIndex, impact, rTar, nReserveParam1))
			{
				//获得逻辑对象
				ImpactLogic_T const* pLogic = Impact_GetLogic(impact);
				if(NULL==pLogic)
				{
					Assert(NULL=="[ImpactCore_T::SendImpactToUnit]: Can't find sprcific logic for this impact.");
					return FALSE;
				}
				//设置会心标记
				if(TRUE == bCriticalFlag)
				{
					impact.MarkCriticalFlag();
				}
				if(0!=nRefixRate)
				{
					//向效果逻辑设置修正率
					pLogic->RefixPowerByRate(impact, nRefixRate);
				}
				if(0>nDelayTime)
				{
					nDelayTime = 0;
				}
				Scene* pScene = rTar.getScene();
				Obj_Character* pChar = NULL;
				if(NULL!=pScene)
				{
					Obj* pObj = pScene->GetSpecificObjByID( nSender );
					
					if( IsCharacterObj(pObj->GetObjType()) )
					{
						pChar = static_cast<Obj_Character*>(pObj);
						SkillInfo_T& rSkillInfo = pChar->GetSkillInfo();
						impact.SetSkillID( rSkillInfo.GetSkillID() );
						rSkillInfo.SetSendSkillImpactID(impact.GetDataIndex());
					}
					pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), nSender, impact, nDelayTime);
					return TRUE;
				}
			}
			// start to fill impact struct
			return TRUE;
			__LEAVE_FUNCTION
			return FALSE;
		}
开发者ID:uvbs,项目名称:wx2Server,代码行数:54,代码来源:Impact_Core.cpp

示例13: CalculateHitRate

	INT CombatCore_T::CalculateHitRate(Obj_Character& rAttacker, Obj_Character& rTag)
	{
		__ENTER_FUNCTION
		INT nHit  = rAttacker.GetHit();
		INT nMiss = rTag.GetMiss();
		nHit = Attr_VerifyHitMiss(nHit);
		nMiss = Attr_VerifyHitMiss(nMiss);

		//INT iItemPointRefix  = 0;
		//INT iSkillPointRefix = 0;
		//if( rAttacker.GetObjType() == Obj::OBJ_TYPE_HUMAN )
		//{
		//	//装备对属性的点数影响
		//	iItemPointRefix  = static_cast<Obj_Human&>(rAttacker).GetIattributeHit();
		//}
		//iSkillPointRefix = rAttacker.GetHitRefix();

		//INT iItemPointRefixMiss  = 0;
		//INT iSkillPointRefixMiss = 0;
		//if( rTag.GetObjType() == Obj::OBJ_TYPE_HUMAN )
		//{
		//	//装备对属性的点数影响
		//	iItemPointRefixMiss  = static_cast<Obj_Human&>(rTag).GetIattributeMiss();
		//}
		//iSkillPointRefixMiss = rTag.GetMissRefix();

		INT iRateHit = 0;
		if (Obj::OBJ_TYPE_HUMAN==rAttacker.GetObjType())
		{
			Obj_Human& rHuman = (Obj_Human&)rAttacker;
			_ITEM_EFFECT* pIE=NULL;
			pIE = rHuman.ItemEffect(IATTRIBUTE_RATE_HIT);
			Assert( pIE );
			if( pIE->IsActive() )
			{
				iRateHit = pIE->m_Attr.m_Value;
			}
		}

		//总命中率=(75+攻击方总命中-受击方总闪避)/100+攻击方装备对命中率的影响+攻击方技能对命中率的影响-受击方装备对闪避率的影响-受击方技能对闪避率的影响
		SkillInfo_T& oSkillInf = rAttacker.GetSkillInfo();
		INT iRefix = oSkillInf.GetAccuracy();
		if( iRefix < 0 )
		{
			iRefix = 0;
		}
		INT iFainlHitRate = ((75 + nHit - nMiss)/100.0 + iRateHit/100.0 + iRefix/100.0) * 100.0;

		return iFainlHitRate;
		__LEAVE_FUNCTION
		return 0;
	}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例14: IsPerformingTheSpecificScript

	BOOL ActionDelegator_T::IsPerformingTheSpecificScript(Obj_Character& rActor, ScriptID_t nScriptID) const
	{
		__ENTER_FUNCTION
		ActionLogic_T const * pActionLogic = rActor.GetActionLogic();
		ActionParams_T&	rActionParams = rActor.GetActionParams();
		if(NULL==pActionLogic)
		{
			return FALSE;
		}
		return pActionLogic->IsPerformingSpecificScript(rActionParams, nScriptID);
		__LEAVE_FUNCTION
		return FALSE;
	}
开发者ID:brock7,项目名称:TianLong,代码行数:13,代码来源:ActionDelegator.cpp

示例15: MagicalFarDamage

	INT CombatCore_T::MagicalFarDamage(Obj_Character& rMe, Obj_Character& rTar, INT nAdditionAttack, INT nAdditionDefence)
	{
		__ENTER_FUNCTION
		INT	nDamage;
		INT nAttack = Attr_VerifyGeneralAttack(rMe.GetAttackMagicFar()+nAdditionAttack);
		INT nDefence = Attr_VerifyDefence(rTar.GetDefenceMagicFar()+nAdditionDefence);
		nDamage = NormalDamage(rTar, nAttack, nDefence, IATTRIBUTE_SHIELD_MAGIC_FAR);

		INT iResist =  rTar.GetMagicFarAttReduce();
		nDamage = GetFinalDamages(nDamage, iResist);
		return nDamage;
		__LEAVE_FUNCTION
		return 0;
	}
开发者ID:,项目名称:,代码行数:14,代码来源:


注:本文中的Obj_Character类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。