class OvershieldEffectorBase extends ContinuousEffector
{
	var m_statSystem : StatsSystem;
	var m_poolSystem : StatPoolsSystem;
	var m_immunityTypes : array< gameStatModifierData >;
	var m_modifiersAdded : Bool;
	var m_owner : weak< GameObject >;

	protected override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		m_statSystem = GameInstance.GetStatsSystem( game );
		m_poolSystem = GameInstance.GetStatPoolsSystem( game );
		m_modifiersAdded = false;
		m_immunityTypes = SetStatsToModify();
	}

	protected export override function ContinuousAction( owner : GameObject, instigator : GameObject )
	{
		ProcessAction( owner );
	}

	protected virtual function ProcessAction( owner : GameObject )
	{
		var overShieldValue : Float;
		var i : Int32;
		overShieldValue = m_poolSystem.GetStatPoolValue( owner.GetEntityID(), gamedataStatPoolType.Overshield, false );
		if( overShieldValue > 0.0 )
		{
			if( !( m_modifiersAdded ) )
			{
				for( i = 0; i < m_immunityTypes.Size(); i += 1 )
				{
					m_statSystem.AddModifier( owner.GetEntityID(), m_immunityTypes[ i ] );
				}
			}
			m_modifiersAdded = true;
		}
		else
		{
			if( m_modifiersAdded )
			{
				for( i = 0; i < m_immunityTypes.Size(); i += 1 )
				{
					m_statSystem.RemoveModifier( owner.GetEntityID(), m_immunityTypes[ i ] );
				}
			}
			m_modifiersAdded = false;
		}
	}

	protected virtual function SetStatsToModify() : array< gameStatModifierData >
	{
		var result : array< gameStatModifierData >;
		return result;
	}

}

