void ILoadActionProcesses.LoadDoAgainCards()
        {
            _actionContainer.ActionCategory = EnumActionCategory.DoAgain;
            var firstList = _model.Pile1 !.DiscardList();
            DeckRegularDict <FluxxCardInformation> secondList = new DeckRegularDict <FluxxCardInformation>();

            firstList.ForEach(x =>
            {
                if (x.Deck == 0)
                {
                    throw new BasicBlankException("Deck cannot be 0 for load action again.  Rethink");
                }
                var card = FluxxDetailClass.GetNewCard(x.Deck);
                card.Populate(x.Deck); //maybe this is needed too.
                secondList.Add(card);
            });
            var tempList = secondList.Where(items => items.CanDoCardAgain()).Select(items => items.Text()).ToCustomBasicList();

            if (tempList.Count == 0)
            {
                throw new BasicBlankException("Must have at least one card to do again.  Otherwise; can't do again");
            }
            _actionContainer.IndexCard = -1;
            _actionContainer.CardList1 !.LoadTextList(tempList);
        }
Esempio n. 2
0
 public void ShowCard <F>(F thisCard)
     where F : FluxxCardInformation, new()
 {
     if (thisCard.Deck == CurrentCard.Deck)
     {
         return;
     }
     CurrentCard = FluxxDetailClass.GetNewCard(thisCard.Deck); //try this way.
     CurrentCard.Populate(thisCard.Deck);                      //needs to be specific so it can run the proper routines.
     NotifyCard();
 }
Esempio n. 3
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;
        }
        public async Task PlayCardAsync(FluxxCardInformation card)
        {
            await _model !.ShowPlayCardAsync(card);

            card.IsSelected = false;
            card.Drew       = false;
            bool doAgain = false;

            _gameContainer.SaveRoot !.DoAnalyze = false;
            if (_gameContainer !.EverybodyGetsOneList.Count > 0)
            {
                throw new BasicBlankException("Everybody gets one was not finished.  That must be finished before playing another card");
            }
            if (_gameContainer.TempActionHandList.Count > 0)
            {
                throw new BasicBlankException("There are cards left from the temporary action list.  Must finish choosing the order to play the cards.  Then they will play in the order");
            }
            if (_gameContainer.CurrentAction != null)
            {
                if (_gameContainer.CurrentAction.Deck == EnumActionMain.LetsDoThatAgain)
                {
                    doAgain = true;
                    _model.Pile1 !.RemoveCardFromPile(card);
                }
            }
            _gameContainer.CurrentAction = null;
            if (_gameContainer.QuePlayList.Count == 0 && doAgain == false)
            {
                _gameContainer.SaveRoot.CardsPlayed++;
                _gameContainer.SingleInfo = _gameContainer.PlayerList !.GetWhoPlayer();
                _gameContainer.RemoveFromHandOnly(card);
            }
            else if (doAgain == false)
            {
                _gameContainer.QuePlayList.RemoveFirstItem();
            }
            _gameContainer.SingleInfo = _gameContainer.PlayerList !.GetWhoPlayer();
            FluxxCardInformation final = FluxxDetailClass.GetNewCard(card.Deck);

            final.Populate(card.Deck);
            switch (card.CardType)
            {
            case EnumCardType.Rule:
                await PlayRuleAsync((RuleCard)final);

                break;

            case EnumCardType.Keeper:
                await PlayKeeperAsync((KeeperCard)final);

                break;

            case EnumCardType.Goal:
                await PlayGoalAsync((GoalCard)final);

                break;

            case EnumCardType.Action:
                await PlayActionAsync((ActionCard)final);

                break;

            default:
                throw new BasicBlankException("Can't figure out which one to play for card type");
            }
        }