//---------------------------------------------- public GameScreen() { m_players = new List <Player>(); m_actionQueue = new ActionQueue(); m_endState = EndState.None; m_deck = new BeloteDeck(this); m_currentFold = new Fold(); m_pastFolds = new List <Fold> [Enum.GetValues(typeof(PlayerTeam)).Length]; for (int i = 0; i < m_pastFolds.Length; ++i) { m_pastFolds[i] = new List <Fold>(); } Score = new Score(); }
protected BeloteDeck ComputePlayableCards(Fold fold, Card32Family trumpFamily) { BeloteDeck playables = new BeloteDeck(); m_trumpCards.Clear(); m_trumpBetterCards.Clear(); if (!Hand.Empty) { // No cards in the fold, all cards are valid if (fold.RequestedFamily == null) { playables.CopyFrom(Hand); } else { BeloteCard bestCard = fold.GetBest(trumpFamily); Player bestPlayer = bestCard.Owner as Player; Card32Family requestedFamily = (Card32Family)fold.RequestedFamily; // We look for cards of the requested families foreach (BeloteCard card in Hand.Cards) { if (card.Family == requestedFamily) { playables.AddCard(card); } if (card.Family == trumpFamily) { m_trumpCards.Add(card); if (bestCard.Family == trumpFamily) { if (BeloteCard.GetBestCard(card, bestCard, trumpFamily) == card) { m_trumpBetterCards.Add(card); } } } } // Remove all trump cards that are too low if (!playables.Empty && trumpFamily == requestedFamily) { if (m_trumpBetterCards.Count > 0) { playables.Clear(); playables.AddCards(m_trumpBetterCards); } } // No card of the requested family if (playables.Empty) { // Best card is partner we can play what we want if (bestPlayer.Team == this.Team) { playables.CopyFrom(Hand); } else { if (bestCard.Family == trumpFamily) { if (m_trumpBetterCards.Count > 0) { playables.AddCards(m_trumpBetterCards); } else // TODO : Add "pisser" rules { playables.AddCards(m_trumpCards); } } else { playables.AddCards(m_trumpCards); } if (playables.Empty) { playables.CopyFrom(Hand); } } } } } return(playables); }
//---------------------------------------------- public Player() { m_hand = new BeloteDeck(this); }
public Fold() { Deck = new BeloteDeck(); }