示例#1
0
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;
}
示例#2
0
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;
}
示例#3
0
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);
			}
		}
	}
}
示例#4
0
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;
}
示例#5
0
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;
}