using System;
using System.Collections.Generic;
using TheGameExtreme.model.card;
using TheGameExtreme.model.deck;
using TheGameExtreme.model.piles;

namespace TheGameExtreme.model.gameActions.classic
{
    public class Piocher : GameAction
    {

        public Piocher(Piles ListOrderedStacks) : base(ListOrderedStacks)
        {
        }

        protected bool checkRule()
        {
            return true;
        }

        public void pioche(List<Card> CurrentHand, Deck deck, Player player, int nbMaxCard)
        {
            int nbPickedCard = nbMaxCard - CurrentHand.Count;
            for (int i = 0; i < nbPickedCard; i++)
            {
                if (deck.size() == 0)
                {
                    return;
                }
                int random = new Random().Next(0, deck.size() - 1);
                player.pioche(deck.getCard(random));
                deck.removeAt(random);
            }
        }
    }
}
