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); }
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 ); }