public DeckMatch ValidateDeck(DeckName targetDeck) { DeckMatch matchState = DeckMatch.NotFound; if (_closedDecks.ContainsKey(targetDeck)) { var targetCard = _closedDecks[targetDeck].LastOrDefault(); if (targetDeck == DeckName.OpenDeckCard) { return(matchState = DeckMatch.Found); } matchState = targetCard.CardShape == _moveableCard.CardShape ? DeckMatch.Found : DeckMatch.NotFound; if (matchState == DeckMatch.NotFound) { return(matchState); } matchState = targetCard.CardValue == _moveableCard.CardValue - 1 ? DeckMatch.Found : DeckMatch.NotFound; } else { throw new KeyNotFoundException(); } return(matchState); }
private DeckMatch ValidateCard(DeckName targetDeck, CardShape moveableItemCardShape, int moveableItemCardValue, CardName?cardName, CardShape?cardShape, int cardValue) { DeckMatch matchState = DeckMatch.NotFound; if (cardName == null && cardShape == null) { return(matchState = DeckMatch.Found); } var targetCard = _openDecks[targetDeck].Find(c => (c.CardName == cardName && c.CardShape == cardShape)); if (targetCard == null && moveableItemCardValue == 13) { return(matchState = DeckMatch.Found); } if (targetCard == null) { return(matchState = DeckMatch.NotFound); } if (targetCard.CardPath == Properties.Resources.BackCardPath) { return(matchState = DeckMatch.Found); } //if (targetCard.CardPath == Properties.Resources.EmptyCardPath && moveableItemCardValue == 14) return matchState = DeckMatch.Found; if ((moveableItemCardShape == CardShape.Hearts || moveableItemCardShape == CardShape.Diamonds) && (targetCard.CardShape == CardShape.Clubs || targetCard.CardShape == CardShape.Spades)) { matchState = DeckMatch.Found; } else if ((moveableItemCardShape == CardShape.Clubs || moveableItemCardShape == CardShape.Spades) && (targetCard.CardShape == CardShape.Hearts || targetCard.CardShape == CardShape.Diamonds)) { matchState = DeckMatch.Found; } else { return(DeckMatch.NotFound); } if (targetCard.CardValue - moveableItemCardValue == 1) { matchState = DeckMatch.Found; } else { matchState = DeckMatch.NotFound; } return(matchState); }