DragonNest/Server/DNGameServer/MAScannerFilter.cpp
2024-12-20 16:56:44 +08:00

49 lines
2.6 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


#include "stdafx.h"
#include "MAScannerFilter.h"
#include "DnActor.h"
// SameTeam Filter
bool MAScanSameTeamFilter::bIsCheck( DnActorHandle hActor, DnActorHandle hDestActor, float fMin/*=0.f*/ )
{
return hActor->GetTeam() == hDestActor->GetTeam();
}
// OpponentTeam Filter
bool MAScanOpponentTeamFilter::bIsCheck( DnActorHandle hActor, DnActorHandle hDestActor, float fMin/*=0.f*/ )
{
return hActor->GetTeam() != hDestActor->GetTeam();
}
// DestActor Die Filter
bool MAScanDestActorDieFilter::bIsCheck( DnActorHandle hActor, DnActorHandle hDestActor, float fMin/*=0.f*/ )
{
return hDestActor->IsDie();
}
// DestActor Npc Filter
bool MAScanDestActorNpcFilter::bIsCheck( DnActorHandle hActor, DnActorHandle hDestActor, float fMin/*=0.f*/ )
{
return hDestActor->IsNpcActor();
}
// MinDistance Filter
bool MAScanMinDistanceFilter::bIsCheck( DnActorHandle hActor, DnActorHandle hDestActor, float fMin/*=0.f*/ )
{
if( fMin <= 0.f )
return false;
EtVector3 vPos = *(hDestActor->GetPosition()) - *(hActor->GetPosition());
float fDistSq = EtVec3LengthSq( &vPos );
if ( fDistSq < fMin*fMin )
return true;
return false;
}
// EqualActor Filter
bool MAScanEqualActorFilter::bIsCheck( DnActorHandle hActor, DnActorHandle hDestActor, float fMin/*=0.f*/ )
{
return hActor == hDestActor;
}