コード例 #1
0
ファイル: Guard.cpp プロジェクト: ueverything/mmo-resourse
	/// return true to filter shape.
	bool operator() ( CShape *pShape )
	{
		CMoveShape *pDest = static_cast<CMoveShape*>( pShape );
		if( pDest->IsDied() )
		{
			return true;
		}
		if( pOwner->Distance( pShape ) > lRange )
		{
			return true;
		}

		if (!pDest->IsVisible(pOwner) )			// ÒþÐÎ
		{
			return true;
		}

		if(  pDest->GetExID() == pOwner->GetBefoolID() )
		{
			return true;
		}

		if( AIUtilities::IsInGodState( pShape ) )
		{
			return true;
		}

		return false;
	}
コード例 #2
0
ファイル: FightObj.cpp プロジェクト: Caoxuyang/klcommon
bool FightObj::CheckReturnPeace()
{
    if (m_Owner->GetIsFlyToPeace() == 0)
        return false;

    long dis = Distance(m_EnterFightPos.x, m_EnterFightPos.y, m_Owner->GetTileX(),
                        m_Owner->GetTileY());

    unsigned long thisTime = timeGetTime();
    if(m_AI->HasTarget())
    {
        CMoveShape *target = m_AI->GetTarget();

        if (target == NULL || PHASEMAN.PhasePlayerFilter(target,m_Owner))
        {
            ReturnPeace();
            return true;
        }

        if(target->IsDied() ||
                !target->IsAttackAble(m_Owner) ||
                !target->IsVisible(m_Owner))
        {
            ReturnPeace();
            return true;
        }

        if(dis > m_Owner->GetBaseChaseRange())
        {
            ReturnPeace();
            return true;
        }

        if(dis > m_Owner->GetReturnRange() && thisTime > m_HurtTime)
        {
            ReturnPeace();
            return true;
        }
    }
    else if(thisTime > m_GuardTime)
    {
        ReturnPeace();
        return true;
    }

    return false;
}