class StatusEffectPresentHitPrereqCondition extends BaseHitPrereqCondition
{
	var m_checkType : gamedataCheckType;
	var m_statusEffectParam : CName;
	var m_tag : CName;
	var m_objectToCheck : CName;
	default m_objectToCheck = 'Target';

	public override function SetData( recordID : TweakDBID )
	{
		m_statusEffectParam = TweakDBInterface.GetCName( recordID + T".statusEffect", '' );
		m_checkType = TweakDBInterface.GetCheckTypeRecord( TweakDBInterface.GetForeignKeyDefault( recordID + T".checkType" ) ).Type();
		m_tag = TweakDBInterface.GetCName( recordID + T".tagToCheck", '' );
		m_objectToCheck = TweakDBInterface.GetCName( recordID + T".objectToCheck", '' );
		super.SetData( recordID );
	}

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var result : Bool;
		var objectToCheck : weak< gamePuppet >;
		var statusEffectType : gamedataStatusEffectType;
		objectToCheck = ( ( gamePuppet )( GetObjectToCheck( m_objectToCheck, hitEvent ) ) );
		if( objectToCheck )
		{
			switch( m_checkType )
			{
				case gamedataCheckType.Tag:
					result = StatusEffectSystem.ObjectHasStatusEffectWithTag( objectToCheck, m_tag );
				break;
				case gamedataCheckType.Type:
					statusEffectType = ( ( gamedataStatusEffectType )( ( ( Int32 )( EnumValueFromName( 'gamedataStatusEffectType', m_statusEffectParam ) ) ) ) );
				result = StatusEffectSystem.ObjectHasStatusEffectOfType( objectToCheck, statusEffectType );
				break;
				case gamedataCheckType.Record:
					result = StatusEffectSystem.ObjectHasStatusEffect( objectToCheck, TDBID.Create( "BaseStatusEffect." + NameToString( m_statusEffectParam ) ) );
				break;
				default:
					return false;
			}
		}
		if( result )
		{
			result = CheckOnlyOncePerShot( hitEvent );
		}
		return ( ( m_invert ) ? ( !( result ) ) : ( result ) );
	}

}

