예제 #1
0
        public virtual void Advance(Turn playedCard)
        {
            if (!DeckHelper.IsValidMove(this, playedCard.GetPlayer().GetPlayersDeck(), playedCard.GetPlayedCard(), playedCard.GetPlayer()))
            {
                playedCard.GetPlayer().AskForAction(ActionType.PLAY_CARD, this, Common.Infos.InfoDescription.CannotPlayThatCard);
                return;
            }

            playedCard.GetPlayer().GetPlayersDeck().UseCard(playedCard.GetPlayedCard());
            playedCards[playedCardCount] = playedCard;
            PlayedCards.AddPlayedCard(playedCard.GetPlayedCard());
            playedCardCount++;

            if (
                mostValueableCard == null ||
                (playedCard.GetPlayedCard().GetCardType() == currentTrump && playedCard.GetPlayedCard().CalculateRealValue(currentTrump) > mostValueableCard.GetPlayedCard().CalculateRealValue(currentTrump)) ||
                (GetHandType() == playedCard.GetPlayedCard().GetCardType() && playedCard.GetPlayedCard().CalculateRealValue(currentTrump) > mostValueableCard.GetPlayedCard().CalculateRealValue(currentTrump))
                )
            {
                mostValueableCard = playedCard;
            }

            if (playedCard.GetPlayedCard().GetCardType() == currentTrump)
            {
                currentRound.SetTrumpUsable(true);
            }

            if (playedCardCount >= 4)
            {
                endHand();
            }
            else
            {
                playedCard.GetPlayer().GetNextPlayer().AskForAction(ActionType.PLAY_CARD, this);
            }
        }