예제 #1
0
 /// <summary>
 /// These cards will enter the player's Hand (playable cards), and not their local deck (earned cards).
 /// </summary>
 /// <param name="newCards">Cards received directly from Deck. Must be limited to max number of cards available in Hand at once.</param>
 public bool ReceiveCards(List <byte> newCards)
 {
     if (newCards.Count > (MAX_NUMBER_OF_CARDS - CountCardsInHand))
     {
         throw new Exception(Errorstr.TooManyCards(Name + "'s hand",
                                                   MAX_NUMBER_OF_CARDS, newCards.Count));
     }
     _hand.AddRange(newCards);
     return(true);
 }
예제 #2
0
파일: Deck.cs 프로젝트: Primaski/Casino
 /// <summary>
 /// Adds cards directly to the deck at a specified index.
 /// </summary>
 /// <param name="atIndex">For atIndex = 0 being the top-most position, state the index to insert the first card.</param>
 /// <param name="cards">How many cards should be inserted?</param>
 public virtual Deck AddCards(short atIndex, List <byte> cards)
 {
     if (cards.Count + CardCount <= DECK_SIZE)
     {
         _cardDeck.InsertRange(atIndex, cards);
     }
     else
     {
         throw new Exception(Errorstr.TooManyCards("Adding cards", DECK_SIZE, cards.Count));
     }
     canCreateNewDeck = false;
     return(this);
 }
예제 #3
0
파일: Deck.cs 프로젝트: Primaski/Casino
 /// <summary>
 /// Remove cards directly from this deck. NOTE: Use DrawCards() instead to have the function return the removed cards.
 /// </summary>
 /// <param name="startIndex">For startIndex = 0 being the top card, state index of first removable card.</param>
 /// <param name="count">From startIndex, how many cards should be removed?</param>
 public Deck RemoveCards(short startIndex, short count)
 {
     if (count == 0)
     {
         return(this);
     }
     if (count <= _cardDeck.Count)
     {
         _cardDeck.RemoveRange(startIndex, count);
     }
     else
     {
         throw new Exception(Errorstr.TooManyCards("Removing cards", CardCount, count));
     }
     return(this);
 }