示例#1
0
        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));
        }
示例#2
0
        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);
        }
示例#3
0
 public void LogBuy(Player player, CardPile pile)
 {
     _builder.AppendFormat("{0} bought a {1}.", player.Name, pile.Name);
     _builder.AppendLine();
 }
示例#4
0
 public void AddCardPileWhichEndsTheGameWhenEmpty(CardPile pile)
 {
     AddCardPile(pile);
     _gameEndPiles.Add(pile);
 }
示例#5
0
 public void AddCardPile(CardPile pile)
 {
     _piles.Add(pile);
 }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
 public bool CanBuy(CardPile pile, Player player)
 {
     return this.ActivePlayer == player && CanBuy(pile);
 }
示例#9
0
 public void LogBuy(Player player, CardPile pile)
 {
     _builder.AppendFormat("{0} bought a {1}.", player.Name, pile.Name);
     _builder.AppendLine();
 }
示例#10
0
        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);
        }
示例#11
0
 public bool CanBuy(CardPile pile, Player player)
 {
     return(this.ActivePlayer == player && CanBuy(pile));
 }
示例#12
0
 public AmbassadorAttack(CardPile pile)
 {
     _pile = pile;
 }
示例#13
0
        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);
        }