• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TMonsterAIUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ApplyElementAvoid

BOOL TMonsterAIElement::ApplyElementAvoid(int iIndex, int iTargetIndex, TMonsterAIState * pAIState)
{
	LPOBJ lpObj = &gObj[iIndex];
	UTIL.SendCrywolfChattingMsg(iIndex, "Element-회피");
	KANTURU_UTIL.SendKanturuChattingMsg(iIndex, "Element-회피");
	BOOL bFindXY = MONSTER_UTIL.GetXYToEascape(lpObj);

	if ( bFindXY )
	{
		MONSTER_UTIL.FindPathToMoveMonster(lpObj, lpObj->MTX, lpObj->MTY, 5, 1);
	}

	return FALSE;
}
开发者ID:AkiraJue,项目名称:OpenMuS9,代码行数:14,代码来源:TMonsterAIElement.cpp


示例2: ApplyElementMove

BOOL TMonsterAIElement::ApplyElementMove(int iIndex, int iTargetIndex, TMonsterAIState * pAIState)
{
	LPOBJ lpObj = &gObj[iIndex];
	UTIL.SendCrywolfChattingMsg(iIndex, "Element-이동");
	KANTURU_UTIL.SendKanturuChattingMsg(iIndex, "Element-이동");

	if ( lpObj->PathStartEnd )
		return FALSE;

	BOOL bFindXY = FALSE;

	if ( pAIState->m_iTransitionType == 2 )
		bFindXY = MONSTER_UTIL.GetXYToChase(lpObj);
	else
		bFindXY = MONSTER_UTIL.GetXYToPatrol(lpObj);

	if ( bFindXY )
		MONSTER_UTIL.FindPathToMoveMonster(lpObj, lpObj->MTX, lpObj->MTY, 5, 1);

	return FALSE;
}
开发者ID:AkiraJue,项目名称:OpenMuS9,代码行数:21,代码来源:TMonsterAIElement.cpp


示例3: MoveProc

void CDoppelganger::MoveProc(LPOBJ lpObj)
{
	if(DOPPELGANGER_MAP_RANGE(lpObj->MapNumber) && lpObj->Type == OBJ_MONSTER){
		
		for(int X=0; X < this->MonstersCount;X++){
			
			if(this->CurrentMonster[X] == lpObj->m_Index){
				lpObj->MTX = this->PosX[this->EventMap-65];
				lpObj->MTY = this->PosY[this->EventMap-65];
				MonsterAIUtil.FindPathToMoveMonster(lpObj,lpObj->MTX,lpObj->MTY,15,2);
			}
		}
	}
}
开发者ID:Natzugen,项目名称:server-xmtur,代码行数:14,代码来源:Doppelganger.cpp


示例4: ApplyElementGroupMove

BOOL TMonsterAIElement::ApplyElementGroupMove(int iIndex, int iTargetIndex, TMonsterAIState * pAIState)
{
	LPOBJ lpObj = &gObj[iIndex];
	UTIL.SendCrywolfChattingMsg(iIndex, "Element-그룹이동");

	if ( lpObj->PathStartEnd )
		return FALSE;

	BOOL bFindXY = FALSE;
	BOOL bFoundLeader = TRUE;
	int iLeaderIndex = -1;
	iLeaderIndex = TMonsterAIGroup::FindGroupLeader(lpObj->m_iGroupNumber);

	if ( iLeaderIndex == -1 || gObj[iLeaderIndex].Live == FALSE )
		bFoundLeader = FALSE;

	if ( bFoundLeader && gObjCalDistance(lpObj, &gObj[iLeaderIndex]) > 6 )
	{
		lpObj->TargetNumber = iLeaderIndex;
		bFindXY = MONSTER_UTIL.GetXYToChase(lpObj);
	}
	else if ( pAIState->m_iTransitionType == 2 )
	{
		bFindXY = MONSTER_UTIL.GetXYToChase(lpObj);
	}
	else
	{
		bFindXY = MONSTER_UTIL.GetXYToPatrol(lpObj);
	}

	if ( bFindXY )
	{
		if ( MONSTER_UTIL.FindPathToMoveMonster(lpObj, lpObj->MTX, lpObj->MTY, 5, TRUE) )
		{

		}
		else
		{
			MONSTER_UTIL.GetXYToPatrol(lpObj);
			MONSTER_UTIL.FindPathToMoveMonster(lpObj, lpObj->MTX, lpObj->MTY, 5, TRUE);
		}
	}

	return FALSE;
}
开发者ID:AkiraJue,项目名称:OpenMuS9,代码行数:45,代码来源:TMonsterAIElement.cpp


示例5: MonsterMove

void TMonsterAI::MonsterMove(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];

	if ( MONSTER_UTIL.CheckMovingCondition(lpObj) == FALSE )
	{
		lpObj->PathCur = 0;
		lpObj->PathCount = 0;
		lpObj->PathStartEnd = 0;
		memset(lpObj->PathX, 0, sizeof(lpObj->PathX));
		memset(lpObj->PathY, 0, sizeof(lpObj->PathY));
		memset(lpObj->PathDir, 0, sizeof(lpObj->PathY)); //check this out

		return ;
	}

	if ( lpObj->PathCount != 0 )
	{
		DWORD dwMoveTime = 0;
		DWORD dwDelayTime = 0;

		if ( lpObj->DelayLevel != 0 )
			dwDelayTime = 300;
		else
			dwDelayTime = 0;

		lpObj->m_MoveSpeed = 300;
		
		if ( (lpObj->PathDir[lpObj->PathCur] % 2 ) == 0 )
			dwMoveTime = (DWORD)((double)(lpObj->m_MoveSpeed + dwDelayTime) * 1.3);
		else
			dwMoveTime = lpObj->m_MoveSpeed + dwDelayTime;

		if ( (GetTickCount() - lpObj->PathTime) > dwMoveTime )
		{
			if ( lpObj->PathCur < 15 )
			{
				lpObj->X = lpObj->PathX[lpObj->PathCur];
				lpObj->Y = lpObj->PathY[lpObj->PathCur];
				lpObj->Dir = lpObj->PathDir[lpObj->PathCur];
				lpObj->PathTime = GetTickCount();
				lpObj->PathCur++;

				if ( lpObj->PathCur >= lpObj->PathCount )
				{
					lpObj->PathCur = 0;
					lpObj->PathCount = 0;
					lpObj->PathStartEnd = 0;
				}
			}

			CreateFrustrum(lpObj->X, lpObj->Y, iIndex);
		}

		return;

	}

	lpObj->PathCur = 0;
	lpObj->PathCount = 0;
	lpObj->PathStartEnd = 0;
	memset(lpObj->PathX, 0, sizeof(lpObj->PathX));
	memset(lpObj->PathY, 0, sizeof(lpObj->PathY));
	memset(lpObj->PathDir, 0, sizeof(lpObj->PathY)); //check this out
}
开发者ID:kamilj1988,项目名称:Exodus-V1,代码行数:65,代码来源:TMonsterAI.cpp


示例6: ApplyElementMoveTarget

BOOL TMonsterAIElement::ApplyElementMoveTarget(int iIndex, int iTargetIndex, TMonsterAIState * pAIState)
{
	LPOBJ lpObj = &gObj[iIndex];

	UTIL.SendCrywolfChattingMsg(iIndex, "Element-MoveTarget");
#if (__CUSTOM__ == 0)
	KANTURU_UTIL.SendKanturuChattingMsg(iIndex, "Element-타겟이동");
#endif

	if ( lpObj->PathStartEnd )
		return FALSE;

	if ( lpObj->X == this->m_iX &&
		 lpObj->Y == this->m_iY )
	{
		this->ApplyElementMove(iIndex, iTargetIndex, pAIState);
		return FALSE;
	}

	BOOL bFindXY = TRUE;
	int iTargetX = this->m_iX;
	int iTargetY = this->m_iY;
	int iTargetDistance = (int)sqrt(double(((lpObj->X - iTargetX)*(lpObj->X - iTargetX))+ ((lpObj->Y - iTargetY)*(lpObj->Y - iTargetY))));
	
	if ( TMonsterAIElement::s_MonsterAIMovePath[lpObj->MapNumber].m_bDataLoad )
	{
		if ( iTargetDistance > 10 )
		{
			int iMinCost = 1000000;
			int iMidX = -1;
			int iMidY = -1;
			int iSpotNum = -1;

			for ( int i=0;i<MAX_MONSTER_AI_MOVE_PATH;i++)
			{
				TMonsterAIMovePathInfo & PathInfo = TMonsterAIElement::s_MonsterAIMovePath[lpObj->MapNumber].m_MovePathInfo[i];
				float fDistX = (float)(lpObj->X - PathInfo.m_iPathX);
				float fDistY = (float)(lpObj->Y - PathInfo.m_iPathY);
				int iPathSpotDist =  (int)sqrt( (fDistX*fDistX) + (fDistY*fDistY) );

				if ( iPathSpotDist < 20 )
				{
					fDistX = (float)(iTargetX - PathInfo.m_iPathX);
					fDistY = (float)(iTargetY - PathInfo.m_iPathY);
					int iMidDist = (int)sqrt( (fDistX*fDistX) + (fDistY*fDistY) );

					if ( iMinCost > iMidDist )
					{
						if ( iMidDist )
						{
							iMinCost = iMidDist;
							iMidX = PathInfo.m_iPathX;
							iMidY = PathInfo.m_iPathY;
							iSpotNum = i;
						}
					}
				}
			}

			if ( iMinCost != 1000000 )
			{
				iTargetX = iMidX;
				iTargetY = iMidY;
			}
		}
	}

	if ( bFindXY )
	{
		if ( MONSTER_UTIL.FindPathToMoveMonster(lpObj, iTargetX, iTargetY, 7, FALSE) )
			lpObj->PathStartEnd = 1;
		else
			lpObj->PathStartEnd = 0;
	}

	return FALSE;
}
开发者ID:AkiraJue,项目名称:OpenMuS9,代码行数:77,代码来源:TMonsterAIElement.cpp


示例7:

TMonsterAIState * TMonsterAIAutomata::RunAutomata(int iIndex)
{
	LPOBJ lpObj = &gObj[iIndex];

	if ( MAX_AI_STATE_RANGE(lpObj->m_iCurrentAIState) == FALSE )
		return NULL;

	LPOBJ lpTargetObj = NULL;
	int iMaxAgro = -1;

	int iTargetIndex = lpObj->m_Agro.GetMaxAgroUserIndex(lpObj->m_Index);

	// Search The user with Max Agro to make its enemy
	if ( iTargetIndex != -1 )
	{
		lpTargetObj = &gObj[iTargetIndex];

		if ( MONSTER_UTIL.FindMonViewportObj(lpObj->m_Index, lpTargetObj->m_Index) )
		{
			iMaxAgro = lpObj->m_Agro.GetAgro(iTargetIndex);
			lpObj->TargetNumber = iTargetIndex;
		}
		else
		{
			lpObj->TargetNumber = -1;
			lpTargetObj = NULL;
		}
	}

	BOOL bRateSuccess = FALSE;

	int iCurrentState = lpObj->m_iCurrentAIState;
	int iMaxStateTransCount = this->m_AIStateTransCount[iCurrentState];

	for ( int iPriority=0;iPriority<iMaxStateTransCount;iPriority++)
	{
		TMonsterAIState * AIState = &this->m_AIState[iCurrentState][iPriority];
		BOOL bTransition = MAI_STATE_TRANS_VALUE_;	// If there is an apropiate Value it is set to TRUE

		// Choose the right action according Transation Type 
		switch ( AIState->m_iTransitionType )
		{
			case MAI_STATE_TRANS_NO_ENEMY:
				if ( lpTargetObj == NULL )
				{
					bTransition = TRUE;
				}
				break;

			case MAI_STATE_TRANS_IN_ENEMY:
				if ( lpTargetObj )
				{
					if ( gObjCalDistance(lpObj, lpTargetObj) <= lpObj->m_AttackRange )
					{
						bTransition = TRUE;
					}
				}
				break;

			case MAI_STATE_TRANS_OUT_ENEMY:
				if ( lpTargetObj )
				{
					if ( gObjCalDistance(lpObj, lpTargetObj) > lpObj->m_AttackRange )
					{
						bTransition =  TRUE;
					}
				}
				break;

			//case MAI_STATE_TRANS_DIE_ENEMY:

			case MAI_STATE_TRANS_DEC_HP:
				if ( AIState->m_iTransitionValue > lpObj->Life )
				{
					bTransition = TRUE;
				}
				break;

			case MAI_STATE_TRANS_IMMEDIATELY:
				bTransition = TRUE;
				break;

			case MAI_STATE_TRANS_DEC_HP_PER:
				{
					AIState->m_iTransitionValue = (AIState->m_iTransitionValue > 0)? AIState->m_iTransitionValue : 0;
					AIState->m_iTransitionValue = (AIState->m_iTransitionValue < 100 )? AIState->m_iTransitionValue : 100 ;
					int iLife = ((float)lpObj->AddLife + lpObj->MaxLife) * (float)AIState->m_iTransitionValue / 100.0f;

					if ( iLife > lpObj->Life )
					{
						bTransition = TRUE;
					}
				}
				break;

			case MAI_STATE_TRANS_AGRO_UP:
				if ( lpTargetObj )
				{
					if ( iMaxAgro >= AIState->m_iTransitionValue )
					{
//.........这里部分代码省略.........
开发者ID:331515194,项目名称:zTeamS6.3,代码行数:101,代码来源:TMonsterAIAutomata.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TMsvEntry类代码示例发布时间:2022-05-31
下一篇:
C++ TMinuit类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap