class ModifyDamagePerHackEffector extends ModifyDamageEffector
{
	var m_countOnlyUnique : Bool;

	protected override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		super.Initialize( record, game, parentRecord );
		m_countOnlyUnique = TweakDBInterface.GetBool( record + T".countOnlyUnique", true );
	}

	protected override function RepeatedAction( owner : GameObject )
	{
		var hitEvent : gameHitEvent;
		var appliedQH : array< StatusEffect >;
		var appliedDoT : array< StatusEffect >;
		var finalDmg : Float;
		var count : Float;
		hitEvent = GetHitEvent();
		if( !( hitEvent ) )
		{
			return;
		}
		GameInstance.GetStatusEffectSystem( owner.GetGame() ).GetAppliedEffectsWithTag( hitEvent.target.GetEntityID(), 'Quickhack', appliedQH );
		GameInstance.GetStatusEffectSystem( owner.GetGame() ).GetAppliedEffectsWithTag( hitEvent.target.GetEntityID(), 'DoT', appliedDoT );
		CountEffects( appliedQH, count );
		CountEffects( appliedDoT, count );
		finalDmg = 1.0 + ( m_value * count );
		ModifyDamage( hitEvent, m_operationType, finalDmg );
	}

	private function CountEffects( list : array< StatusEffect >, out count : Float )
	{
		var effectID : TweakDBID;
		var uniqueEffectList : array< TweakDBID >;
		var i : Int32;
		for( i = 0; i < list.Size(); i += 1 )
		{
			if( m_countOnlyUnique )
			{
				effectID = list[ i ].GetRecord().GetID();
				if( !( uniqueEffectList.Contains( effectID ) ) )
				{
					count += 1.0;
					uniqueEffectList.PushBack( effectID );
				}
			}
			else
			{
				count += ( ( Float )( list[ i ].GetStackCount() ) );
			}
		}
	}

}

