Esempio n. 1
0
        public override void Play(Player player)
        {
            base.Play(player);

            Choice choice = new Choice("Choose 1:", this, new CardCollection()
            {
                this
            }, new List <string>()
            {
                "+3<nbsp/>Cards", "+2<nbsp/>Actions"
            }, player);
            ChoiceResult result = player.MakeChoice(choice);

            CardBenefit benefit = new CardBenefit();

            if (result.Options.Contains("+3<nbsp/>Cards"))
            {
                benefit.Cards = 3;
            }
            if (result.Options.Contains("+2<nbsp/>Actions"))
            {
                benefit.Actions = 2;
            }
            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 2
0
        public override void Play(Player player)
        {
            base.Play(player);
            SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= new Coin(4));
            Choice           choice           = new Choice("Gain a card costing up to <coin>4</coin>", this, gainableSupplies, player, false);
            ChoiceResult     result           = player.MakeChoice(choice);

            if (result.Supply != null)
            {
                CardBenefit benefit = new CardBenefit();

                if (player.Gain(result.Supply))
                {
                    if ((result.Supply.Category & Cards.Category.Action) == Cards.Category.Action)
                    {
                        benefit.Actions = 1;
                    }
                    if ((result.Supply.Category & Cards.Category.Treasure) == Cards.Category.Treasure)
                    {
                        benefit.Currency += new Coin(1);
                    }
                    if ((result.Supply.Category & Cards.Category.Victory) == Cards.Category.Victory)
                    {
                        benefit.Cards = 1;
                    }

                    player.ReceiveBenefit(this, benefit);
                }
            }
        }
Esempio n. 3
0
        public override void Play(Player player)
        {
            base.Play(player);

            CardBenefit benefit = new CardBenefit();

            Choice choice = new Choice("Choose one:", this, new CardCollection()
            {
                this
            }, new List <string>()
            {
                "+2<nbsp/>Cards", "+<coin>2</coin>", "Trash 2 cards from your hand"
            }, player);
            ChoiceResult result = player.MakeChoice(choice);

            if (result.Options.Contains("+2<nbsp/>Cards"))
            {
                benefit.Cards = 2;
            }
            else if (result.Options.Contains("+<coin>2</coin>"))
            {
                benefit.Currency += new Coin(2);
            }
            else
            {
                Choice       choiceTrash = new Choice("Choose 2 cards to trash", this, player.Hand, player, false, 2, 2);
                ChoiceResult resultTrash = player.MakeChoice(choiceTrash);
                player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards));
            }

            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 4
0
        public override void Play(Player player)
        {
            base.Play(player);

            Choice choice = new Choice("Choose 2:", this, new CardCollection()
            {
                this
            }, new List <string>()
            {
                "+1<nbsp/>Card", "+1<nbsp/>Action", "+1<nbsp/>Buy", "+<coin>1</coin>"
            }, player, null, true, 2, 2);
            ChoiceResult result = player.MakeChoice(choice);

            foreach (String option in result.Options)
            {
                CardBenefit benefit = new CardBenefit();
                if (option == "+1<nbsp/>Card")
                {
                    benefit.Cards = 1;
                }
                if (option == "+1<nbsp/>Action")
                {
                    benefit.Actions = 1;
                }
                if (option == "+1<nbsp/>Buy")
                {
                    benefit.Buys = 1;
                }
                if (option == "+<coin>1</coin>")
                {
                    benefit.Currency += new Coin(1);
                }
                player.ReceiveBenefit(this, benefit);
            }
        }
Esempio n. 5
0
        public override void Play(Player player)
        {
            base.Play(player);

            // Get the player to my left
            Player playerToLeft = player._Game.GetPlayerFromIndex(player, 1);

            playerToLeft.Draw(2, DeckLocation.Revealed);
            String previousCardName = String.Empty;

            CardBenefit benefit = new CardBenefit();

            foreach (Card card in playerToLeft.Revealed)
            {
                if (card.Name != previousCardName)
                {
                    if ((card.Category & Category.Action) == Category.Action)
                    {
                        benefit.Actions += 2;
                    }
                    if ((card.Category & Category.Treasure) == Category.Treasure)
                    {
                        benefit.Currency += new Coin(2);
                    }
                    if ((card.Category & Category.Victory) == Category.Victory)
                    {
                        benefit.Cards += 2;
                    }
                }
                previousCardName = card.Name;
            }
            playerToLeft.DiscardRevealed();
            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 6
0
        public override void Play(Player player)
        {
            base.Play(player);

            player.ReturnHand(player.RevealHand());

            List <Type> cardTypes = new List <Type>();

            foreach (Card card in player.Hand)
            {
                Type t = card.CardType;
                if (!cardTypes.Contains(t))
                {
                    cardTypes.Add(t);
                }
            }

            CardBenefit benefit = new CardBenefit();

            if (player.Hand.Count == cardTypes.Count)
            {
                benefit.Cards = 3;
            }
            else
            {
                benefit.Cards = 1;
            }
            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 7
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin(player.InPlay[Category.Treasure].Count);
			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 8
0
        public override void Play(Player player)
        {
            base.Play(player);

            CardBenefit benefit = new CardBenefit();

            benefit.Currency += new Coin(player.Actions);
            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 9
0
        public override void Play(Player player)
        {
            base.Play(player);

            CardBenefit benefit = new CardBenefit();

            benefit.Currency  += new Coin((player.DiscardPile.Count + player.DrawPile.Count) / 5);
            benefit.FlavorText = String.Format(" (Deck: {0}, Discard: {1})", Utilities.StringUtility.Plural("card", player.DrawPile.Count), Utilities.StringUtility.Plural("card", player.DiscardPile.Count));
            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 10
0
        public override void Play(Player player)
        {
            base.Play(player);
            CardCollection singleCopper = player.RetrieveCardsFrom(DeckLocation.Hand, Cards.Universal.TypeClass.Copper, 1);

            if (singleCopper.Count > 0)
            {
                player.Trash(singleCopper[0]);
                CardBenefit benefit = new CardBenefit();
                benefit.Currency += new Coin(3);
                player.ReceiveBenefit(this, benefit);
            }
        }
Esempio n. 11
0
        public override void Play(Player player)
        {
            base.Play(player);

            CardCollection newCards = player.Draw(4, DeckLocation.Revealed);

            player.DiscardRevealed();

            CardBenefit benefit = new CardBenefit();

            benefit.Currency += new Coin(newCards.GroupBy(card => card.CardType).Count());
            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 12
0
        void ActivePlayer_CardPlayed(object sender, CardPlayedEventArgs e)
        {
            CardBenefit benefit = new CardBenefit();

            foreach (Card card in e.Cards)
            {
                if (card.CardType == Universal.TypeClass.Copper)
                {
                    benefit.Currency += new Coin(1);
                }
            }
            e.Player.ReceiveBenefit(this, benefit);
        }
Esempio n. 13
0
        public override void Play(Player player)
        {
            base.Play(player);
            Choice       choice = new Choice("Discard any number of cards.  +<coin>1</coin> per card discarded.", this, player.Hand, player, false, 0, player.Hand.Count);
            ChoiceResult result = player.MakeChoice(choice);

            player.Discard(DeckLocation.Hand, result.Cards);

            CardBenefit benefit = new CardBenefit();

            benefit.Currency += new Coin(result.Cards.Count);
            player.ReceiveBenefit(this, benefit);
        }
Esempio n. 14
0
 public override void Play(Player player)
 {
     base.Play(player);
     if (player.InPlay.Contains(this.PhysicalCard))
     {
         Choice       choice = Choice.CreateYesNoChoice("Do you want to trash this card for +<coin>2</coin>?", this, player);
         ChoiceResult result = player.MakeChoice(choice);
         if (result.Options[0] == "Yes")
         {
             player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard));
             CardBenefit benefit = new CardBenefit();
             benefit.Currency += new Coin(2);
             player.ReceiveBenefit(this, benefit);
         }
     }
 }
Esempio n. 15
0
        public override void Play(Player player)
        {
            base.Play(player);

            Choice choice = new Choice("Choose one:", this, new CardCollection()
            {
                this
            }, new List <string>()
            {
                "+<coin>2</coin>", "Discard your hand, +4<nbsp/>Cards, and each other player with at least 5 cards in hand discards his hand and draws 4 cards"
            }, player);
            ChoiceResult result = player.MakeChoice(choice);

            if (result.Options.Contains("+<coin>2</coin>"))
            {
                CardBenefit benefit = new CardBenefit();
                benefit.Currency += new Coin(2);
                player.ReceiveBenefit(this, benefit);
            }
            else
            {
                player.DiscardHand(true);
                CardBenefit benefit = new CardBenefit()
                {
                    Cards = 4
                };
                player.ReceiveBenefit(this, benefit);

                // Perform attack on each other player
                IEnumerator <Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
                enumerator.MoveNext();
                while (enumerator.MoveNext())
                {
                    Player attackee = enumerator.Current;
                    if (this.IsAttackBlocked[attackee])
                    {
                        continue;
                    }

                    if (attackee.Hand.Count > 4)
                    {
                        attackee.DiscardHand(true);
                        attackee.ReceiveBenefit(this, benefit);
                    }
                }
            }
        }
Esempio n. 16
0
        public override void Play(Player player)
        {
            base.Play(player);

            CardBenefit benefit = new CardBenefit()
            {
                Cards = 1
            };

            IEnumerator <Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);

            enumerator.MoveNext();
            while (enumerator.MoveNext())
            {
                enumerator.Current.ReceiveBenefit(this, benefit);
            }
        }
Esempio n. 17
0
		public override void Play(Player player)
		{
			base.Play(player);
			if (player.Hand[Cards.Universal.TypeClass.Estate].Count > 0)
			{
				Choice choice = Choice.CreateYesNoChoice("You may discard an Estate card for +<coin>4</coin>.  Do you want to discard?", this, player);
				ChoiceResult result = player.MakeChoice(choice);
				if (result.Options.Contains("Yes"))
				{
					player.Discard(DeckLocation.Hand, Cards.Universal.TypeClass.Estate, 1);

					CardBenefit benefit = new CardBenefit();
					benefit.Currency.Coin += 4;
					player.ReceiveBenefit(this, benefit);

					return;
				}
			}

			player.Gain(player._Game.Table.Estate);
		}
Esempio n. 18
0
        public override void Play(Player player)
        {
            base.Play(player);
            if (player.Hand[Cards.Universal.TypeClass.Estate].Count > 0)
            {
                Choice       choice = Choice.CreateYesNoChoice("You may discard an Estate card for +<coin>4</coin>.  Do you want to discard?", this, player);
                ChoiceResult result = player.MakeChoice(choice);
                if (result.Options.Contains("Yes"))
                {
                    player.Discard(DeckLocation.Hand, Cards.Universal.TypeClass.Estate, 1);

                    CardBenefit benefit = new CardBenefit();
                    benefit.Currency.Coin += 4;
                    player.ReceiveBenefit(this, benefit);

                    return;
                }
            }

            player.Gain(player._Game.Table.Estate);
        }
Esempio n. 19
0
        public override void Play(Player player)
        {
            base.Play(player);

            Choice choice = new Choice("Choose 2:", this, new CardCollection()
            {
                this
            }, new List <string>()
            {
                "+2<nbsp/>Cards", "+2<nbsp/>Actions", "+<coin>2</coin>", "Gain 4 Silvers & discard deck"
            }, player, null, false, 2, 2);
            ChoiceResult result = player.MakeChoice(choice);

            foreach (String option in result.Options)
            {
                CardBenefit benefit = new CardBenefit();
                if (option == "+2<nbsp/>Cards")
                {
                    benefit.Cards = 2;
                }
                if (option == "+2<nbsp/>Actions")
                {
                    benefit.Actions += 2;
                }
                if (option == "+<coin>2</coin>")
                {
                    benefit.Currency += new Coin(2);
                }
                if (option == "Gain 4 Silvers & discard deck")
                {
                    player.Gain(player._Game.Table.Silver, 4);

                    player._Game.SendMessage(player, this);
                    CardCollection cc = player.RetrieveCardsFrom(DeckLocation.Deck);
                    player.AddCardsInto(DeckLocation.Discard, cc);
                }
                player.ReceiveBenefit(this, benefit);
            }
        }
Esempio n. 20
0
		public override void Play(Player player)
		{
			base.Play(player);

			// Get the player to my left
			Player playerToLeft = player._Game.GetPlayerFromIndex(player, 1);
			playerToLeft.Draw(2, DeckLocation.Revealed);
			String previousCardName = String.Empty;

			CardBenefit benefit = new CardBenefit();
			foreach (Card card in playerToLeft.Revealed)
			{
				if (card.Name != previousCardName)
				{
					if ((card.Category & Category.Action) == Category.Action)
						benefit.Actions += 2;
					if ((card.Category & Category.Treasure) == Category.Treasure)
						benefit.Currency += new Coin(2);
					if ((card.Category & Category.Victory) == Category.Victory)
						benefit.Cards += 2;
				}
				previousCardName = card.Name;
			}
			playerToLeft.DiscardRevealed();
			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 21
0
		public override void Play(Player player)
		{
			base.Play(player);
			CardCollection singleCopper = player.RetrieveCardsFrom(DeckLocation.Hand, Cards.Universal.TypeClass.Copper, 1);
			if (singleCopper.Count > 0)
			{
				player.Trash(singleCopper[0]);
				CardBenefit benefit = new CardBenefit();
				benefit.Currency += new Coin(3);
				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 22
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit();

			Choice choice = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "+2<nbsp/>Actions", "+2<nbsp/>Buys", "Gain a Silver" }, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Options.Contains("+2<nbsp/>Actions"))
				benefit.Actions = 2;
			else if (result.Options.Contains("+2<nbsp/>Buys"))
				benefit.Buys = 2;
			else
				player.Gain(player._Game.Table.Silver);

			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 23
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin(1);
			if (player.CurrentTurn.CardsResolved.Count(c => c.CardType == TypeClass.FoolsGold) > 1)
				benefit.Currency += new Coin(3);

			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 24
0
		public override void Play(Player player)
		{
			base.Play(player);
			Choice choice = new Choice("You may choose a Treasure card to trash", this, player.Hand[Cards.Category.Treasure], player, false, 0, 1);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Cards.Count > 0)
			{
				player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0]));

				CardBenefit benefit = new CardBenefit();
				Choice choiceBenefit = new Choice("Choose either +2 Cards and +1 Action; or +<coin>2</coin> and +1 Buy", this, new CardCollection() { this }, new List<string>() { "+2<nbsp/>Cards and +1<nbsp/>Action", "+<coin>2</coin> and +1<nbsp/>Buy" }, player);
				ChoiceResult resultBenefit = player.MakeChoice(choiceBenefit);
				if (resultBenefit.Options[0] == "+2<nbsp/>Cards and +1<nbsp/>Action")
				{
					benefit.Cards = 2;
					benefit.Actions = 1;
				}
				else
				{
					benefit.Currency.Coin.Value = 2;
					benefit.Buys = 1;
				}

				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 25
0
		public override void Play(Player player)
		{
			base.Play(player);
			Choice choice = new Choice("Choose a card to trash", this, player.Hand, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Cards.Count > 0)
			{
				Cost trashedCardCost = player._Game.ComputeCost(result.Cards[0]);
				player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0]));
				CardBenefit benefit = new CardBenefit();
				benefit.Currency += trashedCardCost.Coin;
				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 26
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = new Choice("Choose 1:", this, new CardCollection() { this }, new List<string>() { "+3<nbsp/>Cards", "+2<nbsp/>Actions" }, player);
			ChoiceResult result = player.MakeChoice(choice);

			CardBenefit benefit = new CardBenefit();
			if (result.Options.Contains("+3<nbsp/>Cards"))
				benefit.Cards = 3;
			if (result.Options.Contains("+2<nbsp/>Actions"))
				benefit.Actions = 2;
			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 27
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = new Choice("Choose 2:", this, new CardCollection() { this }, new List<string>() { "+1<nbsp/>Card", "+1<nbsp/>Action", "+1<nbsp/>Buy", "+<coin>1</coin>" }, player, null, true, 2, 2);
			ChoiceResult result = player.MakeChoice(choice);

			foreach (String option in result.Options)
			{
				CardBenefit benefit = new CardBenefit();
				if (option == "+1<nbsp/>Card")
					benefit.Cards = 1;
				if (option == "+1<nbsp/>Action")
					benefit.Actions = 1;
				if (option == "+1<nbsp/>Buy")
					benefit.Buys = 1;
				if (option == "+<coin>1</coin>")
					benefit.Currency += new Coin(1);
				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 28
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = new Choice("Discard any number of cards.  +<coin>1</coin> per card discarded.", this, player.Hand, player, false, 0, player.Hand.Count);
			ChoiceResult result = player.MakeChoice(choice);

			player.Discard(DeckLocation.Hand, result.Cards);

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin(result.Cards.Count);
			player.ReceiveBenefit(this, benefit);

			IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
			enumerator.MoveNext(); // skip active player
			while (enumerator.MoveNext())
			{
				Player otherPlayer = enumerator.Current;
				if (otherPlayer.Hand.Count >= 2)
				{
					Choice choicePlayer = Choice.CreateYesNoChoice("Do you want to discard 2 cards to draw 1 card?", this, otherPlayer);
					ChoiceResult resultPlayer = otherPlayer.MakeChoice(choicePlayer);
					if (resultPlayer.Options[0] == "Yes")
					{
						Choice choiceDiscard = new Choice("Choose 2 cards to discard", this, otherPlayer.Hand, otherPlayer, false, 2, 2);
						ChoiceResult discards = otherPlayer.MakeChoice(choiceDiscard);
						otherPlayer.Discard(DeckLocation.Hand, discards.Cards);

						if (otherPlayer.CanDraw)
							otherPlayer.Draw(DeckLocation.Hand);
					}
				}
			}

			this.Benefit.Currency.Coin.Value = 0;
		}
Esempio n. 29
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin(player._Game.Table.TokenPiles[TypeClass.TradeRouteToken].Count);
			player.ReceiveBenefit(this, benefit);

			Choice choice = new Choice("Trash a card.", this, player.Hand, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Cards.Count > 0)
				player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0]));
		}
Esempio n. 30
0
		public override void Play(Player player)
		{
			base.Play(player);
			Choice choice = new Choice("Discard any number of cards.  +<coin>1</coin> per card discarded.", this, player.Hand, player, false, 0, player.Hand.Count);
			ChoiceResult result = player.MakeChoice(choice);

			player.Discard(DeckLocation.Hand, result.Cards);

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin(result.Cards.Count);
			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 31
0
		public override void Play(Player player)
		{
			base.Play(player);

			player.ReturnHand(player.RevealHand());

			List<Type> cardTypes = new List<Type>();
			foreach (Card card in player.Hand)
			{
				Type t = card.CardType;
				if (!cardTypes.Contains(t))
					cardTypes.Add(t);
			}

			CardBenefit benefit = new CardBenefit();
			if (player.Hand.Count == cardTypes.Count)
				benefit.Cards = 3;
			else
				benefit.Cards = 1;
			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 32
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = new Choice("Choose 1:", this, new CardCollection() { this }, new List<string>() { "Perform attack", String.Format("+<coin>{0}</coin> (from Pirate Ship tokens)", player.TokenPiles[TypeClass.PirateShipToken].Count) }, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Options.Contains("Perform attack"))
			{
				// Perform attack on every player (including you)
				IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
				enumerator.MoveNext();
				Boolean anyTrashed = false;
				while (enumerator.MoveNext())
				{
					Player attackee = enumerator.Current;
					if (this.IsAttackBlocked[attackee])
						continue;

					attackee.Draw(2, DeckLocation.Revealed);

					CardCollection treasures = attackee.Revealed[Category.Treasure];

					Choice choiceTrash = new Choice(String.Format("Choose a Treasure card of {0} to trash", attackee), this, treasures, attackee);
					ChoiceResult resultTrash = player.MakeChoice(choiceTrash);
					if (resultTrash.Cards.Count > 0)
					{
						attackee.Trash(attackee.RetrieveCardFrom(DeckLocation.Revealed, resultTrash.Cards[0]));
						anyTrashed = true;
					}

					attackee.DiscardRevealed();
				}
				if (anyTrashed)
					player.AddToken(new PirateShipToken());
			}
			else
			{
				CardBenefit benefit = new CardBenefit();
				benefit.Currency += new Coin(player.TokenPiles[TypeClass.PirateShipToken].Count);
				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 33
0
		public override void Play(Player player)
		{
			base.Play(player);

			Boolean playerRevealedProvince = false;
			Boolean anyoneElseRevealedProvince = false;

			// Perform on every player (including you)
			IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
			while (enumerator.MoveNext())
			{
				Player actor = enumerator.Current;

				if (actor.Hand[Universal.TypeClass.Province].Count == 0)
					continue;

				Choice showChoice = Choice.CreateYesNoChoice("Do you want to reveal a Province from your hand?", this, actor);
				ChoiceResult showResult = actor.MakeChoice(showChoice);
				if (showResult.Options[0] == "Yes")
				{
					Card shownProvince = actor.RetrieveCardsFrom(DeckLocation.Hand, Universal.TypeClass.Province, 1)[0];
					actor.AddCardInto(DeckLocation.Revealed, shownProvince);

					if (actor == player)
					{
						playerRevealedProvince = true;
					}
					else
					{
						actor.AddCardInto(DeckLocation.Hand, actor.RetrieveCardFrom(DeckLocation.Revealed, shownProvince));
						anyoneElseRevealedProvince = true;
					}
				}
			}

			if (playerRevealedProvince)
			{
				player.Discard(DeckLocation.Revealed);

				Boolean isOptional = (player._Game.Table[Cards.Universal.TypeClass.Duchy].Count + player._Game.Table.SpecialPiles[TypeClass.PrizeSupply].Count) == 0;
				Choice prizeChoice = new Choice("Select a Prize or a Duchy", this, player._Game.Table.SpecialPiles[TypeClass.PrizeSupply], player, isOptional ? 0 : 1, 1);
				((CardCollection)prizeChoice.Cards).Add(new Universal.Duchy());

				ChoiceResult prizeResult = player.MakeChoice(prizeChoice);
				if (prizeResult.Cards.Count > 0)
				{
					if (prizeResult.Cards[0].CardType == Universal.TypeClass.Duchy)
						player.Gain(player._Game.Table.Duchy, DeckLocation.Deck, DeckPosition.Top);
					else
						player.Gain(player._Game.Table.SpecialPiles[TypeClass.PrizeSupply], prizeResult.Cards[0].CardType, DeckLocation.Deck, DeckPosition.Top);
				}
			}

			if (!anyoneElseRevealedProvince)
			{
				CardBenefit benefit = new CardBenefit() { Cards = 1 };
				benefit.Currency += new Coin(1);
				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 34
0
 public BenefitReceivingEventArgs(Player player, CardBenefit cardBenefit)
 {
     this.Player  = new Visual.VisualPlayer(player);
     this.Benefit = cardBenefit;
     this.Phase   = player.Phase;
 }
Esempio n. 35
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = new Choice("Choose 2:", this, new CardCollection() { this }, new List<string>() { "+2<nbsp/>Cards", "+2<nbsp/>Actions", "+<coin>2</coin>", "Gain 4 Silvers & discard deck" }, player, null, false, 2, 2);
			ChoiceResult result = player.MakeChoice(choice);

			foreach (String option in result.Options)
			{
				CardBenefit benefit = new CardBenefit();
				if (option == "+2<nbsp/>Cards")
					benefit.Cards = 2;
				if (option == "+2<nbsp/>Actions")
					benefit.Actions += 2;
				if (option == "+<coin>2</coin>")
					benefit.Currency += new Coin(2);
				if (option == "Gain 4 Silvers & discard deck")
				{
					player.Gain(player._Game.Table.Silver, 4);

					player._Game.SendMessage(player, this);
					CardCollection cc = player.RetrieveCardsFrom(DeckLocation.Deck);
					player.AddCardsInto(DeckLocation.Discard, cc);
				}
				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 36
0
        public override void Play(Player player)
        {
            base.Play(player);

            Boolean playerRevealedProvince     = false;
            Boolean anyoneElseRevealedProvince = false;

            // Perform on every player (including you)
            IEnumerator <Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);

            while (enumerator.MoveNext())
            {
                Player actor = enumerator.Current;

                if (actor.Hand[Universal.TypeClass.Province].Count == 0)
                {
                    continue;
                }

                Choice       showChoice = Choice.CreateYesNoChoice("Do you want to reveal a Province from your hand?", this, actor);
                ChoiceResult showResult = actor.MakeChoice(showChoice);
                if (showResult.Options[0] == "Yes")
                {
                    Card shownProvince = actor.RetrieveCardsFrom(DeckLocation.Hand, Universal.TypeClass.Province, 1)[0];
                    actor.AddCardInto(DeckLocation.Revealed, shownProvince);

                    if (actor == player)
                    {
                        playerRevealedProvince = true;
                    }
                    else
                    {
                        actor.AddCardInto(DeckLocation.Hand, actor.RetrieveCardFrom(DeckLocation.Revealed, shownProvince));
                        anyoneElseRevealedProvince = true;
                    }
                }
            }

            if (playerRevealedProvince)
            {
                player.Discard(DeckLocation.Revealed);

                Boolean isOptional  = (player._Game.Table[Cards.Universal.TypeClass.Duchy].Count + player._Game.Table.SpecialPiles[TypeClass.PrizeSupply].Count) == 0;
                Choice  prizeChoice = new Choice("Select a Prize or a Duchy", this, player._Game.Table.SpecialPiles[TypeClass.PrizeSupply], player, isOptional ? 0 : 1, 1);
                ((CardCollection)prizeChoice.Cards).Add(new Universal.Duchy());

                ChoiceResult prizeResult = player.MakeChoice(prizeChoice);
                if (prizeResult.Cards.Count > 0)
                {
                    if (prizeResult.Cards[0].CardType == Universal.TypeClass.Duchy)
                    {
                        player.Gain(player._Game.Table.Duchy, DeckLocation.Deck, DeckPosition.Top);
                    }
                    else
                    {
                        player.Gain(player._Game.Table.SpecialPiles[TypeClass.PrizeSupply], prizeResult.Cards[0].CardType, DeckLocation.Deck, DeckPosition.Top);
                    }
                }
            }

            if (!anyoneElseRevealedProvince)
            {
                CardBenefit benefit = new CardBenefit()
                {
                    Cards = 1
                };
                benefit.Currency += new Coin(1);
                player.ReceiveBenefit(this, benefit);
            }
        }
Esempio n. 37
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "+<coin>2</coin>", "Discard your hand, +4<nbsp/>Cards, and each other player with at least 5 cards in hand discards his hand and draws 4 cards" }, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Options.Contains("+<coin>2</coin>"))
			{
				CardBenefit benefit = new CardBenefit();
				benefit.Currency += new Coin(2);
				player.ReceiveBenefit(this, benefit);
			}
			else
			{
				player.DiscardHand(true);
				CardBenefit benefit = new CardBenefit() { Cards = 4 };
				player.ReceiveBenefit(this, benefit);

				// Perform attack on each other player
				IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
				enumerator.MoveNext();
				while (enumerator.MoveNext())
				{
					Player attackee = enumerator.Current;
					if (this.IsAttackBlocked[attackee])
						continue;

					if (attackee.Hand.Count > 4)
					{
						attackee.DiscardHand(true);
						attackee.ReceiveBenefit(this, benefit);
					}
				}
			}
		}
Esempio n. 38
0
		public override void Play(Player player)
		{
			base.Play(player);
			Choice choice = new Choice("You may choose a Treasure card to discard", this, player.Hand[Cards.Category.Treasure], player, false, 0, 1);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Cards.Count > 0)
			{
				player.Discard(DeckLocation.Hand, result.Cards[0]);

				CardBenefit benefit = new CardBenefit() { Cards = 3, Actions = 1 };
				player.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 39
0
		public override void Play(Player player)
		{
			base.Play(player);
			if (player.InPlay.Contains(this.PhysicalCard))
			{
				Choice choice = Choice.CreateYesNoChoice("Do you want to trash this card for +<coin>2</coin>?", this, player);
				ChoiceResult result = player.MakeChoice(choice);
				if (result.Options[0] == "Yes")
				{
					player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard));
					CardBenefit benefit = new CardBenefit();
					benefit.Currency += new Coin(2);
					player.ReceiveBenefit(this, benefit);
				}
			}
		}
Esempio n. 40
0
		public override void Play(Player player)
		{
			base.Play(player);

			if (player.CanDraw)
			{
				Card revealedCard = player.Draw(DeckLocation.Revealed);

				if (revealedCard != null)
				{
					Choice choice = new Choice(
						String.Format("Do you want to discard {0} or put it back on your deck?", revealedCard),
						this,
						new CardCollection() { this },
						new List<string>() { "Discard", "Put it back" },
						player);
					ChoiceResult result = player.MakeChoice(choice);
					if (result.Options.Contains("Discard"))
						player.DiscardRevealed();
					else
						player.AddCardsToDeck(player.RetrieveCardsFrom(DeckLocation.Revealed), DeckPosition.Top);

					CardBenefit benefit = new CardBenefit();

					if ((revealedCard.Category & Cards.Category.Action) == Cards.Category.Action)
						benefit.Actions = 1;
					if ((revealedCard.Category & Cards.Category.Treasure) == Cards.Category.Treasure)
						benefit.Currency += new Coin(1);
					if ((revealedCard.Category & Cards.Category.Victory) == Cards.Category.Victory)
						benefit.Cards = 1;

					player.ReceiveBenefit(this, benefit);
				}
			}
		}
Esempio n. 41
0
		public override void Play(Player player)
		{
			base.Play(player);
			SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= new Coin(4));
			Choice choice = new Choice("Gain a card costing up to <coin>4</coin>", this, gainableSupplies, player, false);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Supply != null)
			{
				CardBenefit benefit = new CardBenefit();

				if (player.Gain(result.Supply))
				{
					if ((result.Supply.Category & Cards.Category.Action) == Cards.Category.Action)
						benefit.Actions = 1;
					if ((result.Supply.Category & Cards.Category.Treasure) == Cards.Category.Treasure)
						benefit.Currency += new Coin(1);
					if ((result.Supply.Category & Cards.Category.Victory) == Cards.Category.Victory)
						benefit.Cards = 1;

					player.ReceiveBenefit(this, benefit);
				}
			}
		}
Esempio n. 42
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit() { Cards = 1 };

			IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
			enumerator.MoveNext();
			while (enumerator.MoveNext())
			{
				enumerator.Current.ReceiveBenefit(this, benefit);
			}
		}
Esempio n. 43
0
		void ActivePlayer_CardPlayed(object sender, CardPlayedEventArgs e)
		{
			CardBenefit benefit = new CardBenefit();
			foreach (Card card in e.Cards)
			{
				if (card.CardType == Universal.TypeClass.Copper)
					benefit.Currency += new Coin(1);
			}
			e.Player.ReceiveBenefit(this, benefit);
		}
Esempio n. 44
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin(player.Actions);
			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 45
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit();

			Choice choice = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "+2<nbsp/>Cards", "+<coin>2</coin>", "Trash 2 cards from your hand" }, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Options.Contains("+2<nbsp/>Cards"))
				benefit.Cards = 2;
			else if (result.Options.Contains("+<coin>2</coin>"))
				benefit.Currency += new Coin(2);
			else
			{
				Choice choiceTrash = new Choice("Choose 2 cards to trash", this, player.Hand, player, false, 2, 2);
				ChoiceResult resultTrash = player.MakeChoice(choiceTrash);
				player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards));
			}

			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 46
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin((player.DiscardPile.Count + player.DrawPile.Count) / 5);
			benefit.FlavorText = String.Format(" (Deck: {0}, Discard: {1})", Utilities.StringUtility.Plural("card", player.DrawPile.Count), Utilities.StringUtility.Plural("card", player.DiscardPile.Count));
			player.ReceiveBenefit(this, benefit);
		}
Esempio n. 47
0
		public override void Play(Player player)
		{
			base.Play(player);

			CardCollection newCards = player.Draw(4, DeckLocation.Revealed);

			player.DiscardRevealed();

			CardBenefit benefit = new CardBenefit();
			benefit.Currency += new Coin(newCards.GroupBy(card => card.CardType).Count());
			player.ReceiveBenefit(this, benefit);
		}