AnnounceCombination() public abstract method

The player has a combination in his cards.
public abstract AnnounceCombination ( CardCombination combination ) : bool
combination CardCombination The combination of cards tha player has
return bool
示例#1
0
        private void PlayerHasTurn(Player player)
        {
            #region Announce combinations on first hand

            if (_playingManager.IsFirstHand && _currentAnnouncement.Type != AnnouncementTypeEnum.NoTrumps)
            {
                CombinationFinder finder = new CombinationFinder(player.Cards);
                foreach (CardCombination combination in finder.Combinations)
                {
                    bool isValidCombination = false;

                    if (combination is SequentialCombination)
                    {
                        Player          biggest            = FindBiggestSequentialCombinationHolder();
                        CardCombination biggestCombination = null;

                        foreach (DictionaryEntry de in _mapSequentialCombinationToPlayer)
                        {
                            if (biggest == de.Value as Player)
                            {
                                biggestCombination = de.Key as CardCombination;
                                break;
                            }
                        }

                        if ((biggest == null) ||
                            (combination.Points >= biggestCombination.Points) ||
                            (player.Position == biggest.Position || player.Position == _game.GetTeamPlayer(biggest).Position))
                        {
                            isValidCombination = true;
                        }
                    }
                    else
                    {
                        isValidCombination = true;
                    }

                    if (isValidCombination && player.AnnounceCombination(combination))
                    {
                        if (combination is SequentialCombination)
                        {
                            _mapSequentialCombinationToPlayer.Add(combination, player);
                        }
                        if (combination is FourEqualsCombination)
                        {
                            _mapEqualCombinationToPlayer.Add(combination, player);
                        }
                    }
                }
            }

            #endregion

            foreach (Card card in player.Cards)
            {
                card.IsSelectable = _playingManager.IsValid(player, card);
            }

            player.PlayCard(_playingManager);
        }
示例#2
0
 private void AddBelotCombination(Player player, BelotCombination combination)
 {
     if (player.AnnounceCombination(combination))
     {
         _mapBelotCombinationToPlayer.Add(combination, player);
     }
 }
示例#3
0
        private void PlayerHasTurn( Player player )
        {
            #region Announce combinations on first hand

            if( _playingManager.IsFirstHand && _currentAnnouncement.Type != AnnouncementTypeEnum.NoTrumps )
            {
                CombinationFinder finder = new CombinationFinder( player.Cards );
                foreach( CardCombination combination in finder.Combinations )
                {
                    bool isValidCombination = false;

                    if( combination is SequentialCombination )
                    {
                        Player biggest = FindBiggestSequentialCombinationHolder();
                        CardCombination biggestCombination = null;

                        foreach( DictionaryEntry de in _mapSequentialCombinationToPlayer )
                        {
                            if( biggest == de.Value as Player )
                            {
                                biggestCombination = de.Key as CardCombination;
                                break;
                            }
                        }

                        if( (biggest == null) ||
                            (combination.Points >= biggestCombination.Points) ||
                            (player.Position == biggest.Position || player.Position == _game.GetTeamPlayer( biggest ).Position) )
                        {
                            isValidCombination = true;
                        }
                    }
                    else
                    {
                        isValidCombination = true;
                    }

                    if( isValidCombination && player.AnnounceCombination( combination ) )
                    {
                        if( combination is SequentialCombination )
                        {
                            _mapSequentialCombinationToPlayer.Add( combination, player );
                        }
                        if( combination is FourEqualsCombination )
                        {
                            _mapEqualCombinationToPlayer.Add( combination, player );
                        }
                    }
                }
            }

            #endregion

            foreach( Card card in player.Cards )
            {
                card.IsSelectable = _playingManager.IsValid( player, card );
            }

            player.PlayCard( _playingManager );
        }
示例#4
0
 private void AddBelotCombination( Player player, BelotCombination combination )
 {
     if( player.AnnounceCombination( combination ) )
     {
         _mapBelotCombinationToPlayer.Add( combination, player );
     }
 }