abstract class SkillCheckBase extends IScriptable
{
	[ customEditor = "TweakDBGroupInheritance;Interactions.InteractionChoice;Interactions.MountChoice" ]
	protected instanceeditable persistent var m_alternativeName : TweakDBID;
	protected instanceeditable persistent var m_difficulty : EGameplayChallengeLevel;
	protected instanceeditable inlined persistent var m_additionalRequirements : GameplayConditionContainer;
	protected instanceeditable persistent var m_duration : Float;
	protected persistent var m_isActive : Bool;
	protected persistent var m_wasPassed : Bool;
	protected var m_skillCheckPerformed : Bool;
	protected persistent var m_skillToCheck : EDeviceChallengeSkill;
	protected persistent var m_baseSkill : GameplaySkillCondition;
	protected persistent var m_isDynamic : Bool;

	public virtual function Initialize()
	{
		m_baseSkill = new GameplaySkillCondition;
		if( m_difficulty != EGameplayChallengeLevel.NONE )
		{
			m_isActive = true;
			m_baseSkill.SetProperties( m_skillToCheck, m_difficulty );
		}
	}

	public const virtual function Evaluate( requester : GameObject ) : Bool
	{
		var skillCheckPassed : Bool;
		if( IsActive() )
		{
			if( m_additionalRequirements && ( m_additionalRequirements.GetGroupsAmount() > 0 ) )
			{
				if( m_additionalRequirements.GetOperator() == ELogicOperator.AND )
				{
					skillCheckPassed = m_baseSkill.Evaluate( requester ) && m_additionalRequirements.Evaluate( requester );
				}
				else if( m_additionalRequirements.GetOperator() == ELogicOperator.OR )
				{
					skillCheckPassed = m_baseSkill.Evaluate( requester ) || m_additionalRequirements.Evaluate( requester );
				}
			}
			else
			{
				skillCheckPassed = m_baseSkill.Evaluate( requester );
			}
		}
		return skillCheckPassed;
	}

	public function SetAlternativeName( name : TweakDBID )
	{
		m_alternativeName = name;
	}

	public function SetDifficulty( difficulty : EGameplayChallengeLevel )
	{
		m_difficulty = difficulty;
	}

	public function SetDynamic( isDynamic : Bool )
	{
		m_isDynamic = isDynamic;
	}

	public function SetIsActive( value : Bool )
	{
		m_isActive = value;
	}

	public function SetIsPassed( value : Bool )
	{
		m_wasPassed = value;
	}

	public const function IsActive() : Bool
	{
		return m_isActive;
	}

	public const function IsDynamic() : Bool
	{
		return m_isDynamic;
	}

	public const function IsPassed() : Bool
	{
		return m_wasPassed;
	}

	public const function GetDifficulty() : EGameplayChallengeLevel
	{
		return m_difficulty;
	}

	public const function GetAdditionalRequirements() : GameplayConditionContainer
	{
		return m_additionalRequirements;
	}

	public const function GetSkill() : EDeviceChallengeSkill
	{
		return m_skillToCheck;
	}

	public const function GetBaseSkill() : GameplaySkillCondition
	{
		return m_baseSkill;
	}

	public function CheckPerformed()
	{
		m_skillCheckPerformed = true;
	}

	public const function WasPerformed() : Bool
	{
		return m_skillCheckPerformed;
	}

	public const function GetAlternativeName() : TweakDBID
	{
		return m_alternativeName;
	}

	public const function GetDuration() : Float
	{
		return m_duration;
	}

	public function SetDuration( duration : Float )
	{
		m_duration = duration;
	}

}

class HackingSkillCheck extends SkillCheckBase
{
	default m_skillToCheck = EDeviceChallengeSkill.Hacking;
}

class EngineeringSkillCheck extends SkillCheckBase
{
	default m_skillToCheck = EDeviceChallengeSkill.Engineering;
}

class DemolitionSkillCheck extends SkillCheckBase
{
	default m_skillToCheck = EDeviceChallengeSkill.Athletics;
}

