internal Card RequestPlayerTrashCardFromHandButDontTrash(GameState gameState, CardPredicate acceptableCardsToTrash, bool isOptional, CollectionCards cardsTrashedSoFar = null)
{
if (!this.hand.HasCard(acceptableCardsToTrash))
{
return null;
}
if (cardsTrashedSoFar == null)
cardsTrashedSoFar = gameState.emptyCardCollection;
Card cardTypeToTrash = this.actions.GetCardFromHandToTrash(gameState, acceptableCardsToTrash, isOptional, cardsTrashedSoFar);
if (cardTypeToTrash == null)
{
if (isOptional)
{
return null;
}
else
{
throw new Exception("Player must choose a card to trash");
}
}
if (!acceptableCardsToTrash(cardTypeToTrash))
{
throw new Exception("Tried to trash a card that didn't match the constraint");
}
return cardTypeToTrash;
}