/// <summary> /// Initializes a new instance of the CardInHand class. /// </summary> /// <param name="Parent">Placeholder for the Parent object.</param> /// <param name="MasterParent">Placeholder for the Master Parent object.</param> /// <param name="BaseCard">The card in which to hold this class's data.</param> public CardInHand(PlayerHandViewModel Parent, TableViewModel MasterParent, Card BaseCard) { m_Parent = Parent; m_MasterParent = MasterParent; m_Card = BaseCard; if (!m_MasterParent.HouseRulesVM.FastMode) { OnPropertyChanged("CardImage"); } }
/// <summary> /// Initializes a new instance of the DealerCardInHand class. /// </summary> /// <param name="Parent">Placeholder for the Parent object.</param> /// <param name="MasterParent">Placeholder for the Master Parent object.</param> /// <param name="BaseCard">The card in which to hold this class's data.</param> /// <param name="ShowCard">Whether or not the card is shown face up or face down.</param> public DealerCardInHand(DealerHandViewModel Parent, TableViewModel MasterParent, Card BaseCard, bool ShowCard) { m_MasterParent = MasterParent; m_Parent = Parent; m_Card = BaseCard; m_IsShowing = ShowCard; if (!m_MasterParent.HouseRulesVM.FastMode) { OnPropertyChanged("CardImage"); } }
/// <summary> /// Resets a deck to a brand new deck (2-A of each suit). No Jokers. /// </summary> public void ResetDeck() { int CardIndex = 0; for (int CardSuit = 0; CardSuit < 4; CardSuit++) { for (int CardType = 2; CardType < 15; CardType++) { m_Card[CardIndex] = new Card((CardType)CardType, (CardSuit)CardSuit); CardIndex++; } } }
/// <summary> /// Adds a card to the player's hand. /// </summary> /// <param name="DealtCard">The card that the player is dealt.</param> /// <param name="ShowCard">Whether or not the card is shown initially.</param> public void RecieveCard(Card DealtCard, bool ShowCard) { Hand.Add(new DealerCardInHand(this, m_MasterParent, DealtCard, ShowCard)); m_MasterParent.GameStatisticsVM.CardsDealt++; CalculateCount(); SetCardPositions(); }
/// <summary> /// Provides an abstraction for the RecieveCard method. /// </summary> /// <param name="DealtCard">The card that the player is dealt.</param> public void Hit(Card DealtCard) { RecieveCard(DealtCard, true); }
/// <summary> /// Adds a card to the player's hand. /// </summary> /// <param name="DealtCard">The card that the player is dealt.</param> public void RecieveCard(Card DealtCard) { Hand.Add(new CardInHand(this, m_MasterParent, DealtCard)); m_MasterParent.GameStatisticsVM.CardsDealt++; if (Hand.Count == 2) { CanSurrender = true; } else { CanSurrender = false; } CalculateCount(); SetCardPositions(); }
/// <summary> /// A player hits and can no longer surrender. /// </summary> /// <param name="DealtCard">The card that the player is dealt.</param> public void Hit(Card DealtCard) { CanSurrender = false; RecieveCard(DealtCard); }
/// <summary> /// A player doubles down. Changes the hand mode and the player can no longer surrender. /// </summary> /// <param name="DealtCard">The card that the player is dealt.</param> public void DoubleDown(Card DealtCard) { CanSurrender = false; HandMode = HandMode.DoubleDown; RecieveCard(DealtCard); }