コード例 #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
ファイル: TextGameLog.cs プロジェクト: razzielx/Dominion
 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
ファイル: TurnContext.cs プロジェクト: trentkerin/Dominion
        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
ファイル: TurnContext.cs プロジェクト: trentkerin/Dominion
        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
ファイル: TurnContext.cs プロジェクト: trentkerin/Dominion
 public bool CanBuy(CardPile pile, Player player)
 {
     return this.ActivePlayer == player && CanBuy(pile);
 }
コード例 #9
0
ファイル: TextGameLog.cs プロジェクト: vladdou/Dominion
 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
ファイル: SecretChamber.cs プロジェクト: razzielx/Dominion
 public AmbassadorAttack(CardPile pile)
 {
     _pile = pile;
 }
コード例 #13
0
ファイル: GameViewModel.cs プロジェクト: trentkerin/Dominion
        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);
        }