Example #1
0
        public int removeCard(int cardIndex, DiscardDeck discardDeck)
        {
            int cardsLeftInDeck = CardDeck.Count;

            if (cardsLeftInDeck > 1)
            {
                CardDeck.RemoveAt(cardIndex);
                cardsLeftInDeck--;
            }
            else if (cardsLeftInDeck == 1)
            {
                CardDeck.RemoveAt(cardIndex);
                refreshDeck(discardDeck);
                cardsLeftInDeck = CardDeck.Count;
            }
            else
            {
                errorNoCardsInDeck();
                refreshDeck(discardDeck);
                cardsLeftInDeck = CardDeck.Count;
                CardDeck.RemoveAt(topCardIndex());
            }

            return(cardsLeftInDeck);
        }
Example #2
0
        private int refreshDeck(DiscardDeck discardDeck)
        {
            Console.WriteLine("Refreshing the Draw Deck...");
            int cardsLeftInDeck = CardDeck.Count;

            int       discardDeckTopCardIndex = discardDeck.topCardIndex();
            BasicCard discardDeckTopCard      = discardDeck.CardDeck[discardDeckTopCardIndex];

            discardDeck.removeCard(discardDeckTopCardIndex);

            CardDeck.AddRange(discardDeck.CardDeck);
            shuffle();
            discardDeck.CardDeck.RemoveRange(0, discardDeck.CardDeck.Count);

            discardDeck.CardDeck.Add(discardDeckTopCard);

            return(cardsLeftInDeck);
        }