Пример #1
0
 public State AddCardToHand(Card card)
 {
     if (card is Occupation)
     {
         HandOccupations = HandOccupations.Add(card);
     }
     else if (card is MinorImprovement)
     {
         HandMinors = HandMinors.Add(card);
     }
     else
     {
         throw new InvalidOperationException("Only minor improvements and occupations can be added to a players hand.");
     }
     return(State);
 }
Пример #2
0
 public State RemoveCardFromHand(Card card)
 {
     if (card is Occupation)
     {
         HandOccupations = HandOccupations.Remove(card);
     }
     else if (card is MinorImprovement)
     {
         HandMinors = HandMinors.Remove(card);
     }
     else
     {
         throw new InvalidOperationException("Only minor improvements and occupations can be removed from a players hand.");
     }
     return(State);
 }
Пример #3
0
        public State PlayCard(Card card)
        {
            if (HandOccupations.Contains(card))
            {
                HandOccupations = HandOccupations.Remove(card);
            }
            else if (HandMinors.Contains(card))
            {
                HandMinors = HandMinors.Remove(card);
            }
            else
            {
                return(State);
            }

            OwnedCards = OwnedCards.Add(card);
            return(State);
        }