class TargetKilledHitPrereqCondition extends BaseHitPrereqCondition
{
	private var m_lastTarget : weak< GameObject >;

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var target : weak< NPCPuppet >;
		var result : Bool;
		target = ( ( NPCPuppet )( hitEvent.target ) );
		if( !( target ) || ( m_lastTarget == target ) )
		{
			return false;
		}
		result = target.WasJustKilledOrDefeated() || target.IsAboutToDieOrDefeated();
		if( result )
		{
			m_lastTarget = target;
			result = CheckOnlyOncePerShot( hitEvent );
		}
		return ( ( m_invert ) ? ( !( result ) ) : ( result ) );
	}

}

class TargetCanGetKilledByDamagePrereqCondition extends BaseHitPrereqCondition
{
	private var m_lastTarget : weak< GameObject >;

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var target : weak< NPCPuppet >;
		var targetHealthPercent : Float;
		var targetMaxHealth : Float;
		var targetHealth : Float;
		var damage : Float;
		var result : Bool;
		target = ( ( NPCPuppet )( hitEvent.target ) );
		if( !( target ) || ( m_lastTarget == target ) )
		{
			return false;
		}
		targetHealthPercent = GameInstance.GetStatPoolsSystem( target.GetGame() ).GetStatPoolValue( hitEvent.target.GetEntityID(), gamedataStatPoolType.Health );
		targetMaxHealth = GameInstance.GetStatsSystem( target.GetGame() ).GetStatValue( hitEvent.target.GetEntityID(), gamedataStatType.Health );
		targetHealth = ( targetMaxHealth * targetHealthPercent ) / 100.0;
		damage = hitEvent.attackComputed.GetTotalAttackValue( gamedataStatPoolType.Health );
		result = ( damage > 0.0 ) && ( damage >= targetHealth );
		if( result )
		{
			m_lastTarget = target;
			result = CheckOnlyOncePerShot( hitEvent );
		}
		return ( ( m_invert ) ? ( !( result ) ) : ( result ) );
	}

}

class TargetBreachCanGetKilledByDamagePrereqCondition extends BaseHitPrereqCondition
{
	private var m_lastTarget : weak< GameObject >;

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var target : weak< GameObject >;
		var player : PlayerPuppet;
		var breachFinder : BreachFinderComponent;
		var damage : Float;
		var result : Bool;
		target = hitEvent.target;
		if( !( target ) || ( m_lastTarget == target ) )
		{
			return false;
		}
		player = ( ( PlayerPuppet )( hitEvent.attackData.GetInstigator() ) );
		if( !( player ) )
		{
			return false;
		}
		breachFinder = player.GetBreachFinderComponent();
		if( !( breachFinder ) )
		{
			return false;
		}
		damage = hitEvent.attackComputed.GetTotalAttackValue( gamedataStatPoolType.Health );
		result = breachFinder.CanTrackedBreachBeKilledByDamage( damage );
		if( result )
		{
			m_lastTarget = target;
			result = CheckOnlyOncePerShot( hitEvent );
		}
		return ( ( m_invert ) ? ( !( result ) ) : ( result ) );
	}

}

