public bool CanGainCardFromSupply(Card cardType) { PileOfCards pile = this.GetPile(cardType); if (pile == null) { return(false); } return(pile.TopCard() == cardType); }
public bool CanGainCardFromSupply(Card cardType) { PileOfCards pile = this.GetPile(cardType); if (pile == null) { return(false); } return(IsCardEqualOrOfType(pile.TopCard(), cardType)); }
public Card PlayerGainCardFromSupply(Card cardType, PlayerState playerState, DeckPlacement defaultLocation = DeckPlacement.Discard, GainReason gainReason = GainReason.Gain) { bool canGainCardFromSupply = CanGainCardFromSupply(cardType); PileOfCards pile = this.GetPile(cardType); if (pile == null) { System.Diagnostics.Debug.Assert(!canGainCardFromSupply); return(null); } if (GetPile(this.supplyPiles, cardType) != null) { this.hasPileEverBeenGained[pile] = true; } if (pile.TopCard() != cardType) { System.Diagnostics.Debug.Assert(!canGainCardFromSupply); return(null); } Card card = pile.DrawCardFromTop(); if (card == null) { System.Diagnostics.Debug.Assert(!canGainCardFromSupply); return(null); } System.Diagnostics.Debug.Assert(canGainCardFromSupply); playerState.GainCard(this, card, DeckPlacement.Supply, defaultLocation, gainReason); return(card); }