Beispiel #1
0
        /// <summary>
        /// Draws a card from the player's deck
        /// </summary>
        /// <returns>The card that was drawn</returns>
        public BaseCard DrawCard()
        {
            if (TopDeckIndex < 0)
            {
                fatigueDamage++;
                return(new FatigueCard(fatigueDamage));
            }

            BaseCard card = this.Cards[TopDeckIndex];

            this.Cards.RemoveAt(TopDeckIndex);
            return(card);
        }
Beispiel #2
0
 /// <summary>
 /// Shuffle the deck
 /// </summary>
 /// <param name="n">The number of times to shuffle the deck</param>
 public void Shuffle(int n = 5)
 {
     for (int i = 0; i < n; i++)
     {
         for (int j = 0; j < this.Cards.Count; j++)
         {
             var      swapIndex = GameEngine.Random.Next(this.Cards.Count);
             BaseCard temp      = this.Cards[swapIndex];
             this.Cards[swapIndex] = this.Cards[j];
             this.Cards[j]         = temp;
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// Adds a card to the current deck
 /// </summary>
 /// <param name="card">The card to add</param>
 /// <remarks>Adds to the end of the deck by default</remarks>
 public void AddCard(BaseCard card)
 {
     this.Cards.Add(card);
 }