public bool IsValidRummy(IDeckDict <RegularRummyCard> thisCol, out EnumWhatSets whatType, out bool useSecond) { whatType = EnumWhatSets.kinds; useSecond = false; if (thisCol.Count < 3) { return(false); //you have to have at least 3 cards for a rummy. } bool rets; var newList = thisCol.ToRegularDeckDict(); rets = _rummys !.IsNewRummy(newList, thisCol.Count, RummyProcesses <EnumSuitList, EnumColorList, RegularRummyCard> .EnumRummyType.Sets); if (rets == true) { return(true); } rets = _rummys.IsNewRummy(newList, thisCol.Count, RummyProcesses <EnumSuitList, EnumColorList, RegularRummyCard> .EnumRummyType.Runs); if (rets == true) { whatType = EnumWhatSets.runs; useSecond = _rummys.UseSecond; return(true); } return(false); }
public async Task CreateNewSetAsync(IDeckDict <RegularRummyCard> thisCol, EnumWhatSets setType, bool useSecond) { DeckRegularDict <RegularRummyCard> newCol = new DeckRegularDict <RegularRummyCard>(); thisCol.ForEach(ThisCard => newCol.Add(SingleInfo !.MainHandList.GetSpecificItem(ThisCard.Deck))); SingleInfo !.MainHandList.RemoveGivenList(newCol, System.Collections.Specialized.NotifyCollectionChangedAction.Remove); RummySet thisSet = new RummySet(_gameContainer !); thisSet.CreateNewSet(thisCol, setType, useSecond); _model !.MainSets1 !.CreateNewSet(thisSet); UpdatePoints(); await ContinueTurnAsync(); }
public void CreateSet(IDeckDict <MonasteryCardInfo> thisCol, EnumWhatSets whatSet) { _setType = whatSet; DeckRegularDict <MonasteryCardInfo> tempList = new DeckRegularDict <MonasteryCardInfo>(); thisCol.ForEach(thisCard => { var newCard = new MonasteryCardInfo(); newCard.Populate(thisCard.Temp); //hopefully this works. newCard.Deck = thisCard.Deck; tempList.Add(newCard); }); HandList.ReplaceRange(tempList); }
public void CreateNewMoon(IDeckDict <GalaxyCardGameCardInformation> thisCol, EnumWhatSets whatSet) { WhatSet = whatSet; if (WhatSet == 0) { throw new BasicBlankException("WhatSet cannot be 0 when creating a set"); } thisCol = thisCol.OrderBy(items => items.Value).ToRegularDeckDict(); thisCol.ForEach(thisCard => { thisCard.Drew = false; thisCard.IsSelected = false; }); HandList.ReplaceRange(thisCol); }
public void CreateNewSet(IDeckDict <RegularRummyCard> thisCol, EnumWhatSets whatSet, bool useSecond) { _useSecond = useSecond; _setType = whatSet; DeckRegularDict <RegularRummyCard> output; if (useSecond == true) { output = thisCol.OrderBy(items => items.SecondNumber).ToRegularDeckDict(); } else { output = thisCol.OrderBy(items => items.Value).ToRegularDeckDict(); } thisCol.ForEach(thisCard => { thisCard.Player = _gameContainer.WhoTurn; thisCard.Drew = false; thisCard.IsSelected = false; }); HandList.ReplaceRange(output); }
public override void LoadSet(SavedSet payLoad) { HandList.ReplaceRange(payLoad.TileList); _isNew = payLoad.IsNew; _setType = payLoad.SetType; }
public void CreateSet(IDeckDict <TileInfo> thisCol, EnumWhatSets whatType) { _setType = whatType; _isNew = true; TileRummySaveInfo saveRoot = cons !.Resolve <TileRummySaveInfo>(); if (thisCol.Count == 0) { throw new BasicBlankException("There must be at least one item to create a new set"); } foreach (var tempTile in thisCol) { saveRoot.TilesFromField.RemoveSpecificItem(tempTile.Deck);// if not there, ignore } if (_setType == EnumWhatSets.Kinds) { HandList.ReplaceRange(thisCol); return; } var wildCol = GetWildList(thisCol); int VeryFirst; VeryFirst = thisCol.First().Number; int veryLast; veryLast = thisCol.Last().Number; int firstNum; int lastNum; firstNum = VeryFirst; lastNum = veryLast; int x; int y; int WildNum = default; y = 1; var loopTo = thisCol.Count; for (x = 2; x <= loopTo; x++) { y += 1; firstNum += 1; var thisTile = thisCol[y - 1]; if (thisTile.Number != firstNum) { WildNum += 1; thisTile = wildCol[WildNum - 1]; thisTile.Number = firstNum; if (thisTile.Number == 14) { thisTile.Number = VeryFirst - 1; } y -= 1; } } var Temps = (from items in thisCol orderby items.Number select items).ToList(); HandList.ReplaceRange(Temps); }
public override void LoadSet(SavedSet currentItem) { HandList = currentItem.CardList.ToObservableDeckDict(); _whatSet = currentItem.WhatSet; }
//private readonly BasicData _thisData; public void CreateSet(IDeckDict <Phase10CardInformation> thisCol, EnumWhatSets whatType) { _whatSet = whatType; thisCol.ForEach(items => { items.Drew = false; items.IsSelected = false; }); if (_whatSet != EnumWhatSets.Runs) { HandList.ReplaceRange(thisCol); return; } DeckRegularDict <Phase10CardInformation> tempList = thisCol.ToRegularDeckDict(); DeckRegularDict <Phase10CardInformation> wildCol = thisCol.Where(items => items.CardCategory == EnumCardCategory.Wild).ToRegularDeckDict(); thisCol.KeepConditionalItems(items => items.CardCategory == EnumCardCategory.None); int firstNum = thisCol.First().Number; int whatFirst = firstNum; int lastNum = thisCol.Last().Number; int x; var loopTo = thisCol.Count; Phase10CardInformation thisCard; for (x = 2; x <= loopTo; x++) { firstNum += 1; thisCard = thisCol[x - 1]; if (thisCard.Number != firstNum) { thisCard = wildCol.First(); thisCard.Number = firstNum; // will put back when new round (?) wildCol.RemoveSpecificItem(thisCard); x -= 1; } } if (wildCol.Count > 0) { lastNum += 1; for (x = lastNum; x <= 11; x++) { if (wildCol.Count == 0) { break; } thisCard = wildCol.First(); thisCard.Number = x; wildCol.RemoveSpecificItem(thisCard); } whatFirst -= 1; for (x = whatFirst; x >= 2; x += -1) { if (wildCol.Count == 0) { break; } thisCard = wildCol.First(); thisCard.Number = x; wildCol.RemoveSpecificItem(thisCard); } } var Fins = tempList.OrderBy(Items => Items.Number); HandList.ReplaceRange(Fins); }
public override void LoadSet(SavedSet payLoad) { HandList.ReplaceRange(payLoad.CardList); _setType = payLoad.SetType; _useSecond = payLoad.UseSecond; }
public override void LoadSet(SavedSet payLoad) { _setType = payLoad.WhatType; HandList.ReplaceRange(payLoad.CardList); }
public override void LoadSet(SavedSet Object) { WhatSet = Object.WhatSet; HandList.ReplaceRange(Object.CardList); }