class UseHealChargeAction extends BaseItemAction
{

	public override function CompleteAction( gameInstance : GameInstance )
	{
		var healActionCost : Float;
		super.CompleteAction( gameInstance );
		healActionCost = GameInstance.GetStatsSystem( gameInstance ).GetStatValue( GetPlayer( gameInstance ).GetEntityID(), gamedataStatType.HealingItemsRechargeDuration );
		GameInstance.GetStatPoolsSystem( gameInstance ).RequestChangingStatPoolValue( GetPlayer( gameInstance ).GetEntityID(), gamedataStatPoolType.HealingItemsCharges, -( healActionCost ), NULL, false, false );
		ConsumablesChargesHelper.HotkeyRefresh( gameInstance );
	}

	protected override function ProcessStatusEffects( const actionEffects : ref< array< weak< ObjectActionEffect_Record > > >, gameInstance : GameInstance )
	{
		var effectInstigator : TweakDBID;
		var appliedEffects : array< StatusEffect >;
		var newConsumableTDBID : TweakDBID;
		var newConsumableName : gamedataConsumableBaseName;
		var usedConsumableName : gamedataConsumableBaseName;
		var i : Int32;
		appliedEffects = StatusEffectHelper.GetAppliedEffects( GetExecutor() );
		newConsumableTDBID = ItemID.GetTDBID( GetItemData().GetID() );
		newConsumableName = TweakDBInterface.GetConsumableItemRecord( newConsumableTDBID ).ConsumableBaseName().Type();
		for( i = 0; i < appliedEffects.Size(); i += 1 )
		{
			effectInstigator = appliedEffects[ i ].GetInstigatorStaticDataID();
			usedConsumableName = TweakDBInterface.GetConsumableItemRecord( effectInstigator ).ConsumableBaseName().Type();
			if( newConsumableName == usedConsumableName && ( ( ( Int32 )( appliedEffects[ i ].GetMaxStacks() ) ) == 1 ) )
			{
				StatusEffectHelper.RemoveStatusEffect( GetExecutor(), appliedEffects[ i ] );
				break;
			}
		}
		for( i = 0; i < actionEffects.Size(); i += 1 )
		{
			StatusEffectHelper.ApplyStatusEffect( GetExecutor(), actionEffects[ i ].StatusEffect().GetID(), ItemID.GetTDBID( GetItemData().GetID() ) );
		}
	}

}

