void ILoadActionProcesses.LoadEverybodyGetsOne() { _actionContainer.ActionCategory = EnumActionCategory.Everybody1; _basicActionLogic.LoadTempCards(); if (_gameContainer.EverybodyGetsOneList.Count == 0) { _basicActionLogic.LoadPlayers(true); return; } var tempLists = _gameContainer.PlayersLeftForEverybodyGetsOne(); if (tempLists.Count < 2) { throw new BasicBlankException("Cannot load everybody gets one because less than 2 players"); } _actionContainer.PlayerIndexList.Clear(); if (_gameContainer.IncreaseAmount() == 1) { _actionContainer.TempHand !.AutoSelect = HandObservable <FluxxCardInformation> .EnumAutoType.SelectAsMany; } _actionContainer.IndexPlayer = -1; CustomBasicList <string> firstList = new CustomBasicList <string>(); tempLists.ForEach(thisPlayer => { _actionContainer.PlayerIndexList.Add(thisPlayer.Id); firstList.Add($"{thisPlayer.NickName}, {thisPlayer.MainHandList.Count} cards in hand, {thisPlayer.Id}"); }); _actionContainer.Player1 !.LoadTextList(firstList); }
public static DeckRegularDict <FluxxCardInformation> CardsForTaxation(FluxxGameContainer gameContainer) { int extras = gameContainer.IncreaseAmount(); int howMany = extras + 1; return(gameContainer.SingleInfo !.MainHandList.GetRandomList(true, howMany).ToRegularDeckDict()); //i think you do need to remove previous. }
public override async Task SubmitAsync() { if (_model.Keeper1 !.HowManySelectedObjects > 0) { await UIPlatform.ShowMessageAsync("Cannot select any keeper cards because you have to give the cards from your hand"); _model.UnselectAllCards(); return; } if (_model.Goal1 !.ObjectSelected() > 0) { await UIPlatform.ShowMessageAsync("Cannot select any goal cards because you have to give the cards from your hand"); _model.UnselectAllCards(); return; } int howMany = _gameContainer.IncreaseAmount() + 1; if (_model.PlayerHand1 !.HowManySelectedObjects == howMany || _model.PlayerHand1.HowManySelectedObjects == _model.PlayerHand1.HandList.Count) { var thisList = _model.PlayerHand1.ListSelectedObjects(true); await _processes.GiveCardsForTaxationAsync(thisList); return; } if (howMany > _model.PlayerHand1.HandList.Count) { howMany = _model.PlayerHand1.HandList.Count; } await UIPlatform.ShowMessageAsync($"Must give {howMany} not {_model.PlayerHand1.HowManySelectedObjects} cards"); _model.UnselectAllCards(); }
private async Task PlayActionAsync(ActionCard thisCard) { await _gameContainer.AnimatePlayAsync !(thisCard); if (thisCard.Deck == EnumActionMain.LetsSimplify || thisCard.Deck == EnumActionMain.TrashANewRule) { if (_gameContainer.SaveRoot !.RuleList.Count == 1) { await _analyzeProcesses.AnalyzeQueAsync(); return; } } else if (thisCard.Deck == EnumActionMain.UseWhatYouTake || thisCard.Deck == EnumActionMain.Taxation) { var tempList = _gameContainer.PlayerList !.AllPlayersExceptForCurrent(); if (!tempList.Any(items => items.MainHandList.Count > 0)) { await _analyzeProcesses.AnalyzeQueAsync(); return; } } else if (thisCard.Deck == EnumActionMain.LetsDoThatAgain) { var tempList = _model !.Pile1 !.DiscardList(); if (!tempList.Any(items => items.CanDoCardAgain() == true)) { await _analyzeProcesses.AnalyzeQueAsync(); return; } } else if (thisCard.Deck == EnumActionMain.TrashAKeeper) { if (!_gameContainer.PlayerList.Any(items => items.KeeperList.Count > 0)) { await _analyzeProcesses.AnalyzeQueAsync(); return; } } else if (thisCard.Deck == EnumActionMain.ExchangeKeepers) { if (_gameContainer.SingleInfo !.KeeperList.Count == 0) { await _analyzeProcesses.AnalyzeQueAsync(); return; } } if (thisCard.Deck == EnumActionMain.ExchangeKeepers || thisCard.Deck == EnumActionMain.StealAKeeper) { var tempList = _gameContainer.PlayerList !.AllPlayersExceptForCurrent(); if (!tempList.Any(items => items.KeeperList.Count > 0)) { await _analyzeProcesses.AnalyzeQueAsync(); return; } } _gameContainer !.CurrentAction = thisCard; if (_gameContainer.CurrentAction.Category != EnumActionScreen.None) { if (_gameContainer.CurrentAction.Category == EnumActionScreen.OtherPlayer) { var tempList = _gameContainer.PlayerList !.AllPlayersExceptForCurrent(); if (tempList.Any(items => items.MainHandList.Count > 0)) { do { _gameContainer.OtherTurn = await _gameContainer.PlayerList.CalculateOtherTurnAsync(); var tempPlayer = _gameContainer.PlayerList.GetOtherPlayer(); //i think. if (tempPlayer.MainHandList.Count > 0) { break; } if (_gameContainer.OtherTurn == 0) { throw new BasicBlankException("There should have been at least one player with cards for taxation"); } } while (true); await _gameContainer.ContinueTurnAsync !(); //because of taxation return; } } if (_gameContainer.CurrentAction.Deck == EnumActionMain.EverybodyGets1 || _gameContainer.CurrentAction.Deck == EnumActionMain.Draw2AndUseEm || _gameContainer.CurrentAction.Deck == EnumActionMain.Draw3Play2OfThem) { await DrawTemporaryCardsAsync(); return; } await _analyzeProcesses.AnalyzeQueAsync(); return; } _gameContainer.CurrentAction = null; switch (thisCard.Deck) { case EnumActionMain.TakeAnotherTurn: _gameContainer.SaveRoot !.AnotherTurn = true; break; case EnumActionMain.ScrambleKeepers: await ScrambleKeepersAsync(); break; case EnumActionMain.RulesReset: await ResetRulesAsync(); break; case EnumActionMain.EmptyTheTrash: await _emptyTrashProcesses.EmptyTrashAsync(); break; case EnumActionMain.DiscardDraw: await DrawDiscardAsync(); break; case EnumActionMain.NoLimits: await NoLimitsAsync(); break; case EnumActionMain.Jackpot: _gameContainer.LeftToDraw = _gameContainer.IncreaseAmount() + 3; await _gameContainer.DrawAsync !(); break; default: break; } if (thisCard.Deck != EnumActionMain.EmptyTheTrash && thisCard.Deck != EnumActionMain.DiscardDraw && thisCard.Deck != EnumActionMain.Jackpot && thisCard.Deck != EnumActionMain.ScrambleKeepers) { await _analyzeProcesses.AnalyzeQueAsync(); } }