class SameTargetHitPrereqCondition extends BaseHitPrereqCondition
{
	var m_previousTarget : weak< GameObject >;
	var m_previousSource : weak< GameObject >;
	var m_previousWeapon : weak< WeaponObject >;

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var checkPassed : Bool;
		var attackType : gamedataAttackType;
		attackType = hitEvent.attackData.GetAttackType();
		if( !( hitEvent.target.IsActive() ) && attackType != gamedataAttackType.Effect )
		{
			return true;
		}
		if( ( ( !( m_previousTarget ) || !( m_previousSource ) ) || !( m_previousWeapon ) ) && attackType != gamedataAttackType.Effect )
		{
			m_previousTarget = hitEvent.target;
			m_previousSource = hitEvent.attackData.GetSource();
			m_previousWeapon = hitEvent.attackData.GetWeapon();
			return false;
		}
		checkPassed = ( ( m_previousTarget == hitEvent.target ) && ( m_previousSource == hitEvent.attackData.GetSource() ) ) && ( m_previousWeapon == hitEvent.attackData.GetWeapon() );
		if( !( checkPassed ) && attackType != gamedataAttackType.Effect )
		{
			m_previousTarget = hitEvent.target;
			m_previousSource = hitEvent.attackData.GetSource();
			m_previousWeapon = hitEvent.attackData.GetWeapon();
		}
		if( checkPassed && attackType != gamedataAttackType.Effect )
		{
			checkPassed = CheckOnlyOncePerShot( hitEvent );
		}
		return ( ( m_invert ) ? ( !( checkPassed ) ) : ( checkPassed ) );
	}

}

