class HitStatusEffectPresentPrereqState extends GenericHitPrereqState
{

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		const var castedPrereq : HitStatusEffectPresentPrereq;
		var target : weak< ScriptedPuppet >;
		var statusEffectType : gamedataStatusEffectType;
		target = ( ( ScriptedPuppet )( hitEvent.target ) );
		if( !( target ) )
		{
			return false;
		}
		castedPrereq = ( ( HitStatusEffectPresentPrereq )( GetPrereq() ) );
		switch( castedPrereq.m_checkType )
		{
			case gamedataCheckType.Tag:
				return StatusEffectSystem.ObjectHasStatusEffectWithTag( target, castedPrereq.m_tag );
			case gamedataCheckType.Type:
				statusEffectType = ( ( gamedataStatusEffectType )( ( ( Int32 )( EnumValueFromString( "gamedataStatusEffectType", castedPrereq.m_statusEffectParam ) ) ) ) );
			return StatusEffectSystem.ObjectHasStatusEffectOfType( target, statusEffectType );
			case gamedataCheckType.Record:
				return StatusEffectSystem.ObjectHasStatusEffect( target, TDBID.Create( "BaseStatusEffect." + castedPrereq.m_statusEffectParam ) );
			default:
				return false;
		}
	}

}

class HitStatusEffectPresentPrereq extends GenericHitPrereq
{
	default m_callbackType = gameDamageCallbackType.HitTriggered;
	default m_pipelineStage = gameDamagePipelineStage.Process;
	default m_isSync = true;
	var m_checkType : gamedataCheckType;
	var m_statusEffectParam : String;
	var m_tag : CName;

	protected override function Initialize( recordID : TweakDBID )
	{
		m_statusEffectParam = TweakDBInterface.GetString( recordID + T".statusEffect", "" );
		m_checkType = TweakDBInterface.GetCheckTypeRecord( TweakDBInterface.GetForeignKeyDefault( recordID + T".checkType" ) ).Type();
		m_tag = TweakDBInterface.GetCName( recordID + T".tagToCheck", '' );
	}

}

