Ejemplo n.º 1
0
		BOOL StdImpact072_T::GetTargetPos( OWN_IMPACT& rImp, Obj_Character &rMe, WORLD_POS& oTargetPos, FLOAT& fDistance ) const
		{
			__ENTER_FUNCTION

			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();

			//计算方向
			FLOAT fMaxDistance = (FLOAT)GetDistance( rImp );
			ID_t nTargetMode = rMe.GetSkillInfo().GetTargetingLogic();
			
			if( INVALID_ID == nTargetMode )
			{
				//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 error, INVALID_ID == nTargetMode" );

				return FALSE;
			}
			WORLD_POS oMyPos = *(rMe.getWorldPos());
			if( TARGET_POS == nTargetMode )
			{
				oTargetPos	= rParams.GetTargetPosition();
				fDistance = GetFinalDistance(rMe, oMyPos, oTargetPos, fMaxDistance);

			}
			else if( TARGET_SPECIFIC_UNIT == nTargetMode )
			{
				ObjID_t iID = rParams.GetTargetObj();
				
				Obj_Character* pTag = (Obj_Character*)rMe.getScene()->GetObjManager()->GetObj( iID );
				if( NULL == pTag )
				{
					//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 error, NULL == pTag" );

					return FALSE;
				}
				oTargetPos = *(pTag->getWorldPos());

				fDistance = GetFinalDistance(rMe, oMyPos, oTargetPos, fMaxDistance);
				fDistance -= 0.5f;
			}
			else if( TARGET_SELF == nTargetMode )
			{
				fDistance		= fMaxDistance;
				oTargetPos		= *(rMe.getWorldPos());
				FLOAT fDir		= rParams.GetTargetDirection();
				oTargetPos.m_fX	+= sinf( fDir ) * fDistance;
				oTargetPos.m_fZ	+= cosf( fDir ) * fDistance;
			}
			else 
			{
				//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 error, TargetMode invalid" );

				return FALSE;
			}
			
			if( fDistance < 0.005f )
			{
				rMe.DirectTo( &oMyPos, FALSE );
				//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 OK, but too near to target" );
				return FALSE;
			}

			return TRUE;
			__LEAVE_FUNCTION
			return FALSE;
		}