public void GiveCard(PokerCard card) { Cards.Add(card); }
public void ScriptedDeal(PokerCard referCard) { }
public PokerCard[] DealCardWithScript(int point) { Random rd = new Random(); PokerCard firstCard = null; PokerCard secCard = null; if (point == 0) { int a = 0; while (true) { firstCard = Cards[a]; if (Cards.Any(d => d.Point == 10 - point)) { secCard = Cards.FirstOrDefault(d => d.Point == 10 - firstCard.Point); Cards.Remove(firstCard); Cards.Remove(secCard); break; } else { a++; } if (a > Cards.Count) { firstCard = DealCardRandom(); secCard = DealCardRandom(); } } } else if (point < 10) { int a = 0; while (true) { firstCard = Cards[a]; int secPoint = point < firstCard.Point ? point + 10 - firstCard.Point : point - firstCard.Point; if (Cards.Any(d => d.Point == secPoint) && (point % 2 != 0 || firstCard.Point != point / 2)) { secCard = Cards.FirstOrDefault(d => d.Point == secPoint); Cards.Remove(firstCard); Cards.Remove(secCard); break; } else { a++; } if (a > Cards.Count) { firstCard = DealCardRandom(); secCard = DealCardRandom(); } } } else { int cardPoint = point - 10; if (Cards.Count(d => d.Point == cardPoint) >= 2) { var currentCards = Cards.Where(d => d.Point == cardPoint).ToList(); firstCard = currentCards[0]; secCard = currentCards[1]; Cards.RemoveAll(d => d.ToFileName().Equals(firstCard.ToFileName()) || d.ToFileName().Equals(secCard.ToFileName())); } else { firstCard = DealCardRandom(); secCard = DealCardRandom(); } } //cards.Remove(cards.FirstOrDefault(d => d.SuitKind.Equals(firstCard.SuitKind) && d.Point.Equals(firstCard.Point))); //cards.Remove(cards.FirstOrDefault(d => d.SuitKind.Equals(secCard.SuitKind) && d.Point.Equals(secCard.Point))); return(new PokerCard[2] { firstCard, secCard }); }