コード例 #1
0
ファイル: Game.cs プロジェクト: Rafa652/GameChannel
        private void PlayerPlayCommand(Player p, Card c)
        {
            if (!p.Hand.Contains(c)) {
                SendOut(p + ": " + Messages.PlayFailHand);
                return;
            }

            if (!c.Matches(_top)) {
                SendOut(p + ": " + Messages.PlayFailMatch);
                return;
            }

            // Card in parameter is a placeholder - get the actual object
            c = p.Hand.FirstOrDefault(hc => hc == c);

            p.Score += c.Score;
            p.Hand.Remove(c);

            // With some exceptions, make the card available again
            if (!(c.Face == CardFace._E || c.Face == CardFace._D || c.Face == CardFace.DH))
                _state.DiscardPile.Add(c);

            // Check if player won
            if (HasPlayerWon(p)) return;

            // Move on to card processing
            PlayerPlayCardProcess(p, c, false);
            ResetTick();
        }