internal bool RequestPlayerDiscardCardFromHand(GameState gameState, CardPredicate acceptableCardsToDiscard, bool isOptional)
{
if (!this.hand.HasCard(acceptableCardsToDiscard))
{
return false;
}
Card cardTypeToDiscard = this.actions.GetCardFromHandToDiscard(gameState, acceptableCardsToDiscard, isOptional);
if (cardTypeToDiscard == null)
{
if (isOptional)
{
return false;
}
else
{
throw new Exception("Player must choose a card to discard");
}
}
else
{
if (gameState.GetPile(cardTypeToDiscard) != null && // TODO: this currently can not find ruins ... rework this method so a card is returned instead of a type.
!acceptableCardsToDiscard( cardTypeToDiscard))
throw new Exception("Card does not meet constraint: ");
}
this.MoveCardFromHandToDiscard(cardTypeToDiscard, gameState);
return true;
}