Пример #1
0
 public void SendMessage(Player player, Cards.Card sourceCard, Currency currency)
 {
     if (GameMessage != null)
     {
         GameMessageEventArgs gmea = new GameMessageEventArgs(player, sourceCard, currency);
         GameMessage(this, gmea);
     }
 }
Пример #2
0
 public void SendMessage(Player player, Cards.Card sourceCard, ICard card, int count)
 {
     if (GameMessage != null)
     {
         GameMessageEventArgs gmea = new GameMessageEventArgs(player, sourceCard, card, count);
         GameMessage(this, gmea);
     }
 }
Пример #3
0
 public void SendMessage(Player player, Player playerAffected, Cards.Card sourceCard, ICard card)
 {
     if (GameMessage != null)
     {
         GameMessageEventArgs gmea = new GameMessageEventArgs(player, playerAffected, sourceCard, card);
         GameMessage(this, gmea);
     }
 }
Пример #4
0
        /// <summary>
        /// Returns True if the card is allowed to be in the game
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        private bool IsCardAllowed(Cards.Card card)
        {
            if (card.Location == Cards.Location.Kingdom)
            {
                return(true);
            }

            return(false);
        }
Пример #5
0
        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);
        }
Пример #6
0
        internal Cards.Card GetNewCardPile(Func <Cards.Card, Boolean> predicate)
        {
            IEnumerable <Cards.Card> matchingCards = this.CardsAvailable.Where(predicate);

            if (matchingCards.Count() == 0)
            {
                throw new GameCreationException("Cannot satisfy specified constraints!  Please double-check and make sure it's possible to construct a Kingdom card setup with the constraints specified");
            }
            int index;

            // For some reason, Random.Next() actually sometimes returns the end point as an option -- Why?  That seems really wrong.
            do
            {
                index = _RNG.Next(matchingCards.Count());
            }while (index == matchingCards.Count());
            Cards.Card toReturn = matchingCards.ElementAt(index);
            this.CardsAvailable.Remove(toReturn);
            return(toReturn);
        }
Пример #7
0
 public Supply this[Cards.Card card] {
     get { return(_SupplyPiles[card]); }
 }
Пример #8
0
 public GamePlayMessage(Player player, Cards.Card card)
     : this(null, player, card)
 {
 }
Пример #9
0
 public GameMessageEventArgs(Player player, Player playerAffected, Cards.Card sourceCard, ICard card)
     : this(player, sourceCard, card)
 {
     this.AffectedPlayer = playerAffected;
 }
Пример #10
0
 public GameMessageEventArgs(Player player, Cards.Card sourceCard, Currency currency)
     : this(player, sourceCard)
 {
     this.Currency = currency;
 }
Пример #11
0
 public GameMessageEventArgs(Player player, Cards.Card sourceCard, ICard card, int count)
     : this(player, sourceCard, card)
 {
     this.Count = count;
 }
Пример #12
0
 public GameMessageEventArgs(Player player, Cards.Card sourceCard, ICard card1, ICard card2)
     : this(player, sourceCard)
 {
     this.Card1 = card1;
     this.Card2 = card2;
 }
Пример #13
0
 public GameMessageEventArgs(Player player, Cards.Card sourceCard)
 {
     this.Player     = player;
     this.SourceCard = sourceCard;
 }
Пример #14
0
 public GameUndoPlayMessage(WaitCallback waitCallback, Player player, Cards.Card card)
     : base(waitCallback)
 {
     this.Player = player;
     this.Card   = card;
 }
Пример #15
0
 public GamePlayMessage(WaitCallback waitCallback, Player player, Cards.Card card)
     : base(waitCallback)
 {
     Player = player;
     Card   = card;
 }