public bool CanBuy(CardPile pile) { if (GetCurrentEffect() != null) { return(false); } if (!InBuyStep) { return(false); } //throw new InvalidOperationException("Cannot buy cards until you are in buy step"); if (Buys < 1) { return(false); } //throw new ArgumentException(string.Format("Cannot buy the card '{0}' - no more buys.", cardToBuy)); if (pile.IsEmpty) { return(false); } return(AvailableSpend.IsEnoughFor(pile.TopCard)); }
public void Buy(CardPile pile) { if (!CanBuy(pile)) { throw new InvalidOperationException("Cannot buy card."); } var cardToBuy = pile.TopCard; Buys--; AvailableSpend -= cardToBuy.Cost; this.Game.Log.LogBuy(this.ActivePlayer, pile); cardToBuy.MoveTo(this.ActivePlayer.Discards); }
public void LogBuy(Player player, CardPile pile) { _builder.AppendFormat("{0} bought a {1}.", player.Name, pile.Name); _builder.AppendLine(); }
public void AddCardPileWhichEndsTheGameWhenEmpty(CardPile pile) { AddCardPile(pile); _gameEndPiles.Add(pile); }
public void AddCardPile(CardPile pile) { _piles.Add(pile); }
public bool CanBuy(CardPile pile) { if (GetCurrentEffect() != null) return false; if (!InBuyStep) return false; //throw new InvalidOperationException("Cannot buy cards until you are in buy step"); if (Buys < 1) return false; //throw new ArgumentException(string.Format("Cannot buy the card '{0}' - no more buys.", cardToBuy)); if (pile.IsEmpty) return false; return AvailableSpend.IsEnoughFor(pile.TopCard); }
public void Buy(CardPile pile) { if (!CanBuy(pile)) throw new InvalidOperationException("Cannot buy card."); var cardToBuy = pile.TopCard; Buys--; AvailableSpend -= cardToBuy.Cost; this.Game.Log.LogBuy(this.ActivePlayer, pile); cardToBuy.MoveTo(this.ActivePlayer.Discards); }
public bool CanBuy(CardPile pile, Player player) { return this.ActivePlayer == player && CanBuy(pile); }
public CardPileViewModel(CardPile pile, TurnContext context, Player player) { Id = pile.Id; IsLimited = pile.IsLimited; Count = pile.IsLimited ? pile.CardCount : 0; Name = pile.Name; if (pile.IsEmpty) { Cost = 0; Types = new string[] { }; } else { Cost = pile.TopCard.Cost.Money; Types = pile.TopCard.GetTypes(); } CanBuy = context.CanBuy(pile, player); }
public bool CanBuy(CardPile pile, Player player) { return(this.ActivePlayer == player && CanBuy(pile)); }
public AmbassadorAttack(CardPile pile) { _pile = pile; }
public CardPileViewModel(CardPile pile, TurnContext context, Player player) { Id = pile.Id; IsLimited = pile.IsLimited; Count = pile.IsLimited ? pile.CardCount : 0; Name = pile.Name; if (!pile.IsEmpty) Cost = pile.TopCard.Cost.Money; CanBuy = context.CanBuy(pile, player); }