private void PlayCard(int index) { var card = Hand.GetAt(index); if (card == null) { return; } var lastPlayedCard = LocationPile.Cards.LastOrDefault(); if (lastPlayedCard != null && card.Suit == lastPlayedCard.Suit) { return; } Hand.RemoveAt(index); LocationPile.Add(card); if (LocationPile.CheckDoorUnlocked()) { var door = Deck.FindDoor(lastPlayedCard.Color); if (door != null) { DoorPile.Add(door); } bool win; if (CheckGameOver(out win)) { return; } } DrawUp(); }
private void ResolveDoorCard(DoorCard doorCard) { var matchingKey = Hand.Cards.FirstOrDefault(p => p.Suit == LocationSuit.Key && p.Color == doorCard.Color); if (matchingKey != null) { PrintUserOption("Do you want to use a key to open the door? (Y/N)"); var key = Console.ReadKey(true); if (key.Key == ConsoleKey.Y) { Hand.Remove(matchingKey); DiscardPile.Add(matchingKey); DoorPile.Add(doorCard); return; } } LimboPile.Add(doorCard); }