private async Task FinishPartRoundAsync() { if (_model !.ComboHandList !.HandList.Count == 0) { SingleInfo = PlayerList.OrderByDescending(items => items.TotalScore).First(); await ShowWinAsync(); return; } PlayerList !.ForEach(thisPlayer => { thisPlayer.InGame = true; thisPlayer.Results = new YahtzeeResults(); }); SaveRoot !.ExtraTurns = 0; SaveRoot.FirstPlayerWentOut = 0; int tempGoes = WhoStarts; WhoTurn = WhoStarts; WhoTurn = await PlayerList.CalculateWhoTurnAsync(); if (WhoTurn == tempGoes) { throw new BasicBlankException("The same player is going first. Find out what happened"); } if (WhoTurn == 0) { throw new BasicBlankException("WhoTurn cannot be 0 at the end of yahtzee hands down. Rethink"); } await StartNewTurnAsync(); }
private async Task <bool> CanEndRoundAsync(bool didPlay) { if (Test !.EndRoundEarly && (SingleInfo !.PlayerCategory == EnumPlayerCategory.Self || Test.ComputerEndsTurn == false)) { return(true); //double check should mean something else. } SingleInfo = PlayerList !.GetWhoPlayer(); if (SingleInfo.ObjectCount == 0) { return(true); } if (didPlay) { SaveRoot !.FirstPlayerPlayed = 0; return(false); } if (SaveRoot !.FirstPlayerPlayed == 0) { if (_model.TrainStation1 !.CanFillPrevious(PlayerList, WhoTurn)) { SaveRoot.FirstPlayerPlayed = WhoTurn; } return(false); } if (_model.TrainStation1 !.CanEndEarly() == false) { SaveRoot.FirstPlayerPlayed = 0; return(false); } int newTurn = await PlayerList.CalculateWhoTurnAsync(); return(newTurn == SaveRoot.FirstPlayerPlayed); }
public override async Task SetUpGameAsync(bool isBeginning) { LoadControls(); if (FinishUpAsync == null) { throw new BasicBlankException("The loader never set the finish up code. Rethink"); } SaveRoot !.Beginnings = true; ClearBoneYard(); PassDominos(); _model.GameBoard1 !.ClearBoard(SaveRoot); PlayerList !.ForEach(thisPlayer => { thisPlayer.TotalScore = 0; thisPlayer.NoPlay = false; }); var(turn, dominoused) = PrivateWhoStartsFirst(); WhoTurn = turn; SingleInfo = PlayerList.GetWhoPlayer(); SingleInfo.MainHandList.RemoveObjectByDeck(dominoused.Deck); WhoTurn = await PlayerList.CalculateWhoTurnAsync(); _model.GameBoard1.PopulateCenter(dominoused); await FinishUpAsync(isBeginning); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); await StartNewTurnAsync(); //try this too. }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); UnselectCards(); _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. if ((SingleInfo.MainHandList.Count == 0 && PlayerCanWin() == true) || Test !.ImmediatelyEndGame) { await ShowWinAsync(); return; //because game is over now } _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. _command.ManuelFinish = true; //because it could be somebody else's turn. _model.Instructions = "None"; if (Test !.NoAnimations == false) { await Delay !.DelaySeconds(.5); } UnselectCards(); WhoTurn = await PlayerList.CalculateWhoTurnAsync(); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. if (CanReshuffle == false) { await EndRoundAsync(); return; } _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. SingleInfo.StockList = _model.StockPile !.GetStockList(); SingleInfo.DiscardList = _model.DiscardPiles !.PileList !.ToCustomBasicList(); _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); this.ShowTurn(); await SaveStateAsync(); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. _command.ManuelFinish = true; //because it could be somebody else's turn. if (SaveRoot !.ExtraTurns == 4) { await SecondPlayerDidNotGoOutAsync(); return; } WhoTurn = await PlayerList.CalculateWhoTurnAsync(true); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. //anything else is here. varies by game. _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); this.ShowTurn(); await SaveStateAsync(); await StartNewTurnAsync(); //i think. }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. _model !.MainSets1 !.EndTurn(); _command.ManuelFinish = true; //because it could be somebody else's turn. if (SingleInfo.PlayerCategory != EnumPlayerCategory.Computer) { if (SingleInfo.MainHandList.Count == 0 || _model !.Deck1 !.IsEndOfDeck() == true) { await EndRoundAsync(); return; } } WhoTurn = await PlayerList.CalculateWhoTurnAsync(); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. int wins = WhoWins(); if (wins > 0) { SingleInfo = PlayerList[wins]; await ShowWinAsync(); return; } _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); await StartNewTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. if (_model.TrickArea1 !.DidPlay2Cards == true) { SaveRoot !.FirstCardPlayed = true; await ContinueTurnAsync(); return; } _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); this.ShowTurn(); await SaveStateAsync(); await ContinueTurnAsync(); }
public override async Task EndTurnAsync() { SingleInfo = PlayerList !.GetWhoPlayer(); SingleInfo.MainHandList.UnhighlightObjects(); //i think this is best. _command.ManuelFinish = true; //because it could be somebody else's turn. WhoTurn = await PlayerList.CalculateWhoTurnAsync(); if (IsBeginning()) { if (SaveRoot !.LastWin > 0) { WhoTurn = SaveRoot.LastWin; //try this way. } SingleInfo = PlayerList.GetWhoPlayer(); this.ShowTurn(); SaveRoot.GameStatus = EnumGameStatus.WinTrick; PlayerGetCards = false; await DrawAsync(); return; } await StartNewTurnAsync(); }
private async Task <bool> CanEndGameAsync(bool didPlay) { SingleInfo = PlayerList !.GetWhoPlayer(); var thisList = PlayerHand(); if (thisList.Count == 0) { return(true); } if (didPlay == true || _model !.Pool1 !.HasDrawn()) { SaveRoot !.FirstPlayedLast = 0; return(false); } if (SaveRoot !.FirstPlayedLast == 0) { SaveRoot.FirstPlayedLast = WhoTurn; return(false); } int newTurn = await PlayerList.CalculateWhoTurnAsync(true); return(newTurn == SaveRoot.FirstPlayedLast); }