public Supply FindSupplyPileByCardType(Type cardType, Boolean includeSpecialPiles) { if (this.Supplies.ContainsKey(cardType)) { return(this.Supplies[cardType]); } if (includeSpecialPiles && this.SpecialPiles.ContainsKey(cardType)) { return(this.SpecialPiles[cardType]); } SupplyCollection sc = this.Supplies.FindAll(s => s.TopCard != null && s.TopCard.CardType == cardType); if (sc.Count == 1) { return(sc.ElementAt(0).Value); } if (includeSpecialPiles) { sc = this.SpecialPiles.FindAll(s => s.TopCard != null && s.TopCard.CardType == cardType); if (sc.Count == 1) { return(sc.ElementAt(0).Value); } } return(null); }
public Supply FindSupplyPileByCard(Cards.Card card) { if (this.Supplies.ContainsKey(card)) { return(this.Supplies[card]); } SupplyCollection sc = this.Supplies.FindAll(s => s.TopCard != null && s.TopCard.Name == card.Name); if (sc.Count == 1) { return(sc.ElementAt(0).Value); } return(null); }