class CrosshairGameController_BlackwallForce extends CrosshairGameController_Smart_Rifl
{
	var m_lastSmartParams : smartGunUIParameters;
	var m_smartGunData : smartGunUIParameters;
	var m_targetList : array< smartGunUITargetParameters >;
	var m_targetData : smartGunUITargetParameters;
	var m_numOfTargets : Int32;
	var m_owner : weak< GameObject >;

	protected event OnSmartGunParams( argParams : Variant )
	{
		var statusEffectSystem : StatusEffectSystem;
		var i : Int32;
		statusEffectSystem = GameInstance.GetStatusEffectSystem( GetGame() );
		super.OnSmartGunParams( argParams );
		m_smartGunData = ( ( smartGunUIParameters )argParams );
		m_lastSmartParams = m_smartGunData;
		m_targetList = m_smartGunData.targets;
		m_numOfTargets = m_targetList.Size();
		for( i = 0; i < m_numOfTargets; i += 1 )
		{
			m_targetData = m_targetList[ i ];
			if( m_targetData.state == gamesmartGunTargetState.Locked && !( statusEffectSystem.HasStatusEffectWithTag( m_targetData.entityID, 'BlackwallMark' ) ) )
			{
				statusEffectSystem.ApplyStatusEffect( m_targetData.entityID, T"BaseStatusEffect.SoMi_Q306_BlackwallMark" );
			}
		}
	}

	protected event OnInputActivatedToUploadBlackwallEvent( evt : InputActivatedToUploadBlackwallEvent )
	{
		var statusEffectSystem : StatusEffectSystem;
		var i : Int32;
		var maxDelay : Float;
		var minDelay : Float;
		var randomDelay : Float;
		var forceKillEvt : ForceBlackwallKillNPCSEvent;
		statusEffectSystem = GameInstance.GetStatusEffectSystem( GetGame() );
		m_owner = ( ( GameObject )( GetOwnerEntity() ) );
		minDelay = TDB.GetFloat( T"Items.BlackwallForce.minRandomDelay" );
		maxDelay = TDB.GetFloat( T"Items.BlackwallForce.maxRandomDelay" );
		StatusEffectHelper.ApplyStatusEffect( m_owner, T"BaseStatusEffect.BlackwallSQCooldown" );
		GameObjectEffectHelper.StartEffectEvent( m_owner, 'blackwall_use_force' );
		GameInstance.GetAudioSystem( GetGame() ).SetTriggerEffectModeTimed( 'te_wea_somi_blackwall_charge_attack', 3.0 );
		for( i = 0; i < m_numOfTargets; i += 1 )
		{
			m_targetData = m_targetList[ i ];
			if( statusEffectSystem.HasStatusEffectWithTag( m_targetData.entityID, 'BlackwallMark' ) && !( statusEffectSystem.HasStatusEffectWithTag( m_targetData.entityID, 'BlackwallHack' ) ) )
			{
				if( m_numOfTargets == 1 )
				{
					statusEffectSystem.ApplyStatusEffect( m_targetData.entityID, T"BaseStatusEffect.SoMi_Q306_BlackwallHackUpload" );
				}
				else
				{
					forceKillEvt = new ForceBlackwallKillNPCSEvent;
					forceKillEvt.targetID = m_targetData.entityID;
					randomDelay = RandRangeF( minDelay, maxDelay );
					GameInstance.GetDelaySystem( GetGame() ).DelayEvent( m_owner, forceKillEvt, randomDelay );
				}
			}
		}
	}

	protected event OnForceKillNPCEvent( evt : ForceBlackwallKillNPCSEvent )
	{
		var statusEffectSystem : StatusEffectSystem;
		statusEffectSystem = GameInstance.GetStatusEffectSystem( GetGame() );
		statusEffectSystem.ApplyStatusEffect( evt.targetID, T"BaseStatusEffect.SoMi_Q306_BlackwallHackUpload" );
	}

}

class InputActivatedToUploadBlackwallEvent extends Event
{
}

class ForceBlackwallKillNPCSEvent extends Event
{
	var targetID : EntityID;
}

