public static void ScrambleKeepers(this PlayerCollection <FluxxPlayerItem> playerList)
        {
            var thisList = playerList.Where(items => items.KeeperList.Count > 0).Select(items => items.KeeperList.Count).ToCustomBasicList();

            if (thisList.Count < 2)
            {
                throw new BasicBlankException("Cannot scramble the keepers");
            }
            var firstKeeperTempList             = playerList.Select(items => items.KeeperList).ToCustomBasicList();
            DeckRegularDict <KeeperCard> output = new DeckRegularDict <KeeperCard>();

            firstKeeperTempList.ForEach(thisItem => output.AddRange(thisItem));
            output.ShuffleList();
            if (output.Count != thisList.Sum(items => items))
            {
                throw new BasicBlankException("Numbers don't match");
            }
            playerList.ForEach(thisPlayer =>
            {
                int nums = thisList[thisPlayer.Id - 1]; //because 0 based
                thisPlayer.KeeperList.ReplaceRange(output.Take(nums));
                if (thisPlayer.KeeperList.Count != thisList[thisPlayer.Id - 1])
                {
                    throw new BasicBlankException("Numbers don't match");
                }
                output = output.Skip(nums).ToRegularDeckDict();
            });
        }
        public void Redeal()
        {
            TempList = new DeckRegularDict <SolitaireCard>();
            if (DealNumber == 3)
            {
                throw new BasicBlankException("There are only 3 deals allowed.  Therefore, there is a problem");
            }
            var thisCol = new DeckRegularDict <SolitaireCard>();

            DealNumber++;
            Piles.PileList.ForEach(thisPile =>
            {
                thisPile.CardList.ForEach(thisCard => thisCol.Add(thisCard));
            });
            Piles.ClearBoard();
            thisCol.ShuffleList();
            int y = 0;

            8.Times(x =>
            {
                foreach (var thisPile in Piles.PileList)
                {
                    if (y == thisCol.Count)
                    {
                        break;
                    }
                    var tempCard = thisCol[y];
                    thisPile.CardList.Add(tempCard);
                    y++;
                }
            });
            PreviousSelected = -1;
        }
        protected override Task StartSetUpAsync(bool isBeginning)
        {
            LoadControls();
            PlayerList !.ForEach(thisPlayer =>
            {
                thisPlayer.WonLastRound = "";
                thisPlayer.ScoreRound   = 0;
                thisPlayer.TotalScore   = 0;
            });
            DeckRegularDict <ComboCardInfo> tempList = new DeckRegularDict <ComboCardInfo>();

            6.Times(x =>
            {
                ComboCardInfo thisCard = new ComboCardInfo();
                thisCard.Populate(x);
                if (Test !.DoubleCheck == false || x == 6)
                {
                    tempList.Add(thisCard);
                }
            });

            _model !.ComboHandList !.HandList.ReplaceRange(tempList);
            _gameContainer.AlreadyDrew  = false;
            SaveRoot !.ExtraTurns       = 0;
            SaveRoot.FirstPlayerWentOut = 0;
            _chanceList.Clear();
            12.Times(x =>
            {
                ChanceCardInfo thisCard = new ChanceCardInfo();
                thisCard.Populate(x);
                _chanceList.Add(thisCard);
            });
            _chanceList.ShuffleList();
            return(base.StartSetUpAsync(isBeginning));
        }
        public void SortOtherCards()
        {
            DeckRegularDict <RegularSimpleCard> output = new DeckRegularDict <RegularSimpleCard>();

            _gameContainer !.OtherPlayer !.MainHandList.ForEach(thisCard =>
            {
                RegularSimpleCard newCard = new RegularSimpleCard();
                newCard.Populate(thisCard.Deck);
                newCard.IsUnknown = true;
                output.Add(newCard);
            });
            output.ShuffleList();
            _model.OpponentCards1 !.HandList.ReplaceRange(output);
        }
Exemplo n.º 5
0
        public void LoadOtherCards(FluxxPlayerItem thisPlayer)
        {
            var thisList = thisPlayer.MainHandList.Select(items => items.Deck).ToCustomBasicList();
            DeckRegularDict <FluxxCardInformation> newList = new DeckRegularDict <FluxxCardInformation>();

            thisList.ForEach(thisItem =>
            {
                var thisCard = FluxxDetailClass.GetNewCard(thisItem);
                thisCard.Populate(thisItem); //i think this too.
                thisCard.IsUnknown = true;
                newList.Add(thisCard);
            });
            newList.ShuffleList();
            _actionContainer.OtherHand !.HandList.ReplaceRange(newList);
            _actionContainer.ButtonChooseCardVisible = true;
            _actionContainer.OtherHand.Visible       = true;
        }