protected override async Task ProtectedAfterRollingAsync() { var thisList = _model !.Cup !.DiceList.ToCustomBasicList(); if (thisList.Any(x => x.Value == 6 || x.Value == 9)) { SingleInfo !.CurrentScore = 0; if (Test !.NoAnimations == false) { await Delay !.DelayMilli(500); } _model.Cup.RemoveConditionalDice(Items => Items.Value == 6 || Items.Value == 9); if (_model.Cup.DiceList.Count() == 0 || Test.ImmediatelyEndGame) { await EndTurnAsync(); return; } await ContinueTurnAsync(); return; } int totalScore = _model.Cup.DiceList.Sum(Items => Items.Value); SingleInfo !.CurrentScore = totalScore; SingleInfo.TotalScore += totalScore; await ContinueTurnAsync(); }
private bool ContainsSix() { var thisList = _model.Cup !.DiceList.ToCustomBasicList(); thisList.KeepConditionalItems(Items => Items.Value == 6); var temps = thisList.GetAllPossibleCombinations(); return(temps.Any(Items => Items.Sum(News => News.Value) == 6)); }
CustomBasicList <DiceInformation> IYahtzeeStyle.GetDiceList() { var firstList = _model.Cup !.DiceList.ToCustomBasicList(); CustomBasicList <DiceInformation> output = new CustomBasicList <DiceInformation>(); firstList.ForEach(items => { DiceInformation thisDice = new DiceInformation(); thisDice.Value = items.Value; thisDice.Color = items.DotColor.ToSKColor(); //i think output.Add(thisDice); }); return(output); }
CustomBasicList <DiceInformation> IYahtzeeStyle.GetDiceList() { var firstList = _model.Cup !.DiceList.ToCustomBasicList(); CustomBasicList <DiceInformation> output = new CustomBasicList <DiceInformation>(); firstList.ForEach(items => { DiceInformation dice = new DiceInformation(); dice.Value = items.Value; dice.Color = SKColors.Black; output.Add(dice); }); return(output); }
//since its easy enough, no need for interface. public int CalculateScore() { int index = _model.ItemSelected; if (index == -1) { throw new BasicBlankException("Cannot calculate the score because nothing was selected"); } if (_gameContainer.SaveRoot !.CategoryRolled == -1) { throw new BasicBlankException("Cannot calculate the score because the category dice has not been rolled"); } if (_gameContainer.SaveRoot.WhichMulti == 0) { return(0); } bool sameCategory; sameCategory = WasSameCategory(); int newMulti = MultiToUse(sameCategory); CustomBasicList <SimpleDice> tempList; tempList = _model.Cup !.DiceList.ToCustomBasicList(); //i think CustomBasicList <int> mainList = new CustomBasicList <int>(); foreach (var thisDice in tempList) { mainList.Add(thisDice.Value); } int scoress; scoress = FirstScore(mainList, out bool Additionals); if (Additionals == true) { scoress *= 2; } return(scoress * newMulti); }