Beispiel #1
0
        /// <summary>
        /// Add a card to the beanfield. If it is the first card then store it in the firstCardToBeanField property as well.
        /// </summary>
        /// <param name="card"></param>
        public void PutCardToBeanField(Card card)
        {
            if(NumberOfCards == 0)
            {
            }

            PutCard(card);
        }
Beispiel #2
0
 /// <summary>
 /// Add a single card to the end of the deck. Note that placement of a null-card is ignored!
 /// </summary>
 /// <param name="card"> </param>
 public void PutCard(Card card)
 {
     if (card != null)
     {
         Stack.Add(card);
     }
 }
        /// <summary>
        /// Adds a card to the given beanfield.
        /// </summary>
        /// <param name="card"> Some card. </param>
        /// <param name="beanField"> Some beanField. </param>
        /// <returns> List of cards that is possible harvested when the card you wanted to place did not match the type of the beanField. </returns>
        internal List<Card> PutCardToBeanField(Card card, BeanField beanField)
        {
            List<Card> result = null;

            //If the cards on the beanField do not match the card-type you want to place, then harvest first.
            if(beanField.FirstCardOnBeanField != null)
            {
                if ( ((BohnanzaCard)card).TypeOfCard != ((BohnanzaCard)beanField.FirstCardOnBeanField).TypeOfCard)
                {
                    result = HarvestBeanField(beanField); //Cards returned from the harvest need to be returned.
                }
            }

            //The card needs to be placed on the chosen beanField.
            beanField.PutCardToBeanField(card);

            //Return cards that need to be put back on the discardPile (if any)
            return result;
        }