internal void MoveCardToTrash(Card card, GameState gameState)
{
this.gameLog.PlayerTrashedCard(this, card);
this.gameLog.PushScope();
gameState.cardContextStack.PushCardContext(this, card, CardContextReason.CardBeingTrashed);
if (card.DoSpecializedTrash(this, gameState))
{
gameState.trash.AddCard(card);
}
// cards in hand react to trashing.
if (this.ownsCardWithSpecializedActionOnTrashWhileInHand)
{
bool stateHasChanged = true;
while (stateHasChanged)
{
stateHasChanged = false;
foreach (Card cardInHand in this.hand)
{
gameState.cardContextStack.PushCardContext(this, cardInHand, CardContextReason.CardReacting);
stateHasChanged = cardInHand.DoSpecializedActionOnTrashWhileInHand(this, gameState, cardInHand);
gameState.cardContextStack.Pop();
if (stateHasChanged)
break;
}
}
}
gameState.cardContextStack.Pop();
this.gameLog.PopScope();
}