Ejemplo n.º 1
0
        /// <summary>
        /// The player takes a card from their hand and places it face up in front of them.
        /// There are then 2 possibilies:
        /// (*) if the card can start, or can be added to a firework,
        ///     it is placed face-up on that firework's pile
        /// (*) if the card cannot be added to a firework,
        ///     it is discarded, and the red counter is placed
        ///     in the tin lid.
        ///
        /// In either case, the player then draws a new card, without looking at it,
        /// and adds it to their hand.
        /// </summary>
        /// <param name="cardInHand"></param>
        public void PlayCard(CardInHand cardInHand)
        {
            if (cardInHand == null)
            {
                throw new ArgumentNullException(nameof(cardInHand));
            }
            if (cardInHand.Player != this)
            {
                throw new IncorrectPlayActionException("You can play only own cards");
            }

            _memory.Remove(cardInHand);
            _game.AddCardToFirework(this, cardInHand.Card);
        }