Esempio n. 1
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. 2
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. 3
0
		/// <summary>
		/// Used internally by the base Card class -- Don't use this.
		/// </summary>
		internal override void Play(Player player, int count)
		{
			if (count <= 0)
				throw new ArgumentOutOfRangeException("'count' must be positive!");
			player.ReceiveBenefit(this, new CardBenefit() { Currency = new Currency(count) });
		}
Esempio n. 4
0
		public override void Play(Player player)
		{
			base.Play(player);
			Choice choice = new Choice("Choose a card to trash", this, player.Hand, player, false, 1, 1);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Cards.Count > 0)
			{
				player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0]));

				Cost cardCost = player._Game.ComputeCost(result.Cards[0]);
				int toDraw = cardCost.Coin.Value;
				if (cardCost.Potion.Value > 0)
					toDraw += 2;
				player.ReceiveBenefit(this, new CardBenefit() { Cards = toDraw });
			}
		}
Esempio n. 5
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choiceDiscard = new Choice("Choose cards to discard", this, player.Hand, player, false, 0, player.Hand.Count);
			ChoiceResult resultDiscard = player.MakeChoice(choiceDiscard);
			player.Discard(DeckLocation.Hand, resultDiscard.Cards);

			player.ReceiveBenefit(this, new CardBenefit() { Cards = resultDiscard.Cards.Count });
		}
Esempio n. 6
0
		internal void player_PlusCard(Player player, ref TrashEventArgs e)
		{
			player.ReceiveBenefit(this, new CardBenefit() { Cards = 3 });

			e.HandledBy.Add(this);
		}
Esempio n. 7
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choiceDiscardTheFirst = new Choice("Discard any number of cards.  +1 Card per card discarded", this, player.Hand, player, false, 0, player.Hand.Count);
			ChoiceResult resultDiscardTheFirst = player.MakeChoice(choiceDiscardTheFirst);
			player.Discard(DeckLocation.Hand, resultDiscardTheFirst.Cards);

			player.ReceiveBenefit(this, new CardBenefit() { Cards = resultDiscardTheFirst.Cards.Count });


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

			player.ReceiveBenefit(this, new CardBenefit() { Currency = new Currency(resultDiscardTheSecond.Cards.Count) });

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

			player.ReturnHand(player.RevealHand());

			Currency negativeCurrency = new Currency(-Math.Min(player.Currency.Coin.Value, player.Hand[Cards.Category.Treasure].Count));
			player.ReceiveBenefit(this, new CardBenefit() { Currency = negativeCurrency });
		}
Esempio n. 9
0
		public override void Play(Player player)
		{
			base.Play(player);

			if (player.InPlay.Contains(this.PhysicalCard))
			{
				Supply supply = player._Game.Table.SpecialPiles[TypeClass.Madman];
				Card cardToReturn = player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard);
				player.Lose(this);
				supply.AddTo(this);
				player._Game.SendMessage(player, this, supply, 1);

				player.ReceiveBenefit(this, new CardBenefit() { Cards = player.Hand.Count });
			}
		}
Esempio n. 10
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. 11
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choiceAction = new Choice("You may discard a card for +1 Action.", this, player.Hand, player, false, 0, 1);
			ChoiceResult resultAction = player.MakeChoice(choiceAction);
			if (resultAction.Cards.Count > 0)
			{
				player.Discard(DeckLocation.Hand, resultAction.Cards);
				player.ReceiveBenefit(this, new CardBenefit() { Actions = 1 });
			}

			Choice choiceBuy = new Choice("You may discard a card for +1 Buy.", this, player.Hand, player, false, 0, 1);
			ChoiceResult resultBuy = player.MakeChoice(choiceBuy);
			if (resultBuy.Cards.Count > 0)
			{
				player.Discard(DeckLocation.Hand, resultBuy.Cards);
				player.ReceiveBenefit(this, new CardBenefit() { Buys = 1 });
			}
		}
Esempio n. 12
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. 13
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = new Choice("Trash a card. +<vp/> equal to half its cost in coins, rounded down.", this, player.Hand, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Cards.Count > 0)
			{
				Card trash = player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0]);
				Cost trashedCardCost = player._Game.ComputeCost(trash);
				player.Trash(trash);

				player.ReceiveBenefit(this, new CardBenefit() { VictoryPoints = trashedCardCost.Coin.Value / 2 });
			}

			IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
			enumerator.MoveNext(); // skip active player
			while (enumerator.MoveNext())
			{
				Player otherPlayer = enumerator.Current;
				Choice choicePlayer = new Choice("Trash a card if you wish", this, otherPlayer.Hand, otherPlayer, false, 0, 1);
				ChoiceResult resultPlayer = otherPlayer.MakeChoice(choicePlayer);
				if (resultPlayer.Cards.Count > 0)
				{
					otherPlayer.Trash(otherPlayer.RetrieveCardFrom(DeckLocation.Hand, resultPlayer.Cards[0]));
				}
			}
		}
Esempio n. 14
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. 15
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. 16
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. 17
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. 18
0
		public override void PlayDuration(Player player)
		{
			base.PlayDuration(player);

			player.ReceiveBenefit(this, new CardBenefit() { Cards = 1 });
			player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.SetAside, this));
		}
Esempio n. 19
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choice = Choice.CreateYesNoChoice("Do you want to trash 2 cards?", this, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Options[0] == "Yes")
			{
				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));

				if (resultTrash.Cards.Count == 2)
				{
					player.ReceiveBenefit(this, new CardBenefit() { Cards = 2, Currency = new Currency(2) });

					IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
					enumerator.MoveNext();
					while (enumerator.MoveNext())
					{
						Player attackee = enumerator.Current;
						// Skip if the attack is blocked (Moat, Lighthouse, etc.)
						if (this.IsAttackBlocked[attackee])
							continue;

						Choice choiceDiscard = new Choice("Choose cards to discard.  You must discard down to 3 cards in hand", this, attackee.Hand, attackee, false, attackee.Hand.Count - 3, attackee.Hand.Count - 3);
						ChoiceResult resultDiscard = attackee.MakeChoice(choiceDiscard);
						attackee.Discard(DeckLocation.Hand, resultDiscard.Cards);
					}

				}
			}
		}
Esempio n. 20
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. 21
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. 22
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. 23
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choiceTheFirst = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "Discard 2 cards", "Put a card on your deck", "Gain a Copper" }, player);
			ChoiceResult resultTheFirst = player.MakeChoice(choiceTheFirst);
			if (resultTheFirst.Options.Contains("Discard 2 cards"))
			{
				Choice choiceDiscard = new Choice("Discard 2 cards.", this, player.Hand, player, false, 2, 2);
				ChoiceResult resultDiscard = player.MakeChoice(choiceDiscard);
				player.Discard(DeckLocation.Hand, resultDiscard.Cards);
			}
			else if (resultTheFirst.Options.Contains("Put a card on your deck"))
			{
				Choice replaceChoice = new Choice("Choose a card to put back on your deck", this, player.Hand, player, false, 1, 1);
				ChoiceResult replaceResult = player.MakeChoice(replaceChoice);
				player.RetrieveCardsFrom(DeckLocation.Hand, replaceResult.Cards);
				player.AddCardsToDeck(replaceResult.Cards, DeckPosition.Top);
			}
			else
			{
				player.Gain(player._Game.Table.Copper);
			}

			Choice choiceTheSecond = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "+<coin>3</coin>", "Trash your hand", "Gain a Duchy" }, player);
			ChoiceResult resultTheSecond = player.MakeChoice(choiceTheSecond);
			if (resultTheSecond.Options.Contains("+<coin>3</coin>"))
			{
				player.ReceiveBenefit(this, new CardBenefit() { Currency = new Currency(3) });
			}
			else if (resultTheSecond.Options.Contains("Trash your hand"))
			{
				player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand));
			}
			else
			{
				player.Gain(player._Game.Table.Duchy);
			}
		}
Esempio n. 24
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. 25
0
		public override void Play(Player player)
		{
			base.Play(player);

			Choice choiceTrash = new Choice("Choose a card to trash", this, player.Hand, player);
			ChoiceResult resultTrash = player.MakeChoice(choiceTrash);
			player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards));

			player.ReceiveBenefit(this, new CardBenefit()
			{
				Currency = new Currency(player._Game.Table.Trash.Where(card => 
					(card.Category & Cards.Category.Treasure) == Cards.Category.Treasure
					).GroupBy(card => card.Name).Count())
			});
		}
Esempio n. 26
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. 27
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. 28
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. 29
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. 30
0
		public override void Play(Player player)
		{
			base.Play(player);

			player.ReturnHand(player.RevealHand());

			int plusActions = 0;
			if (player.CurrentTurn.CardsResolved.Count(c => c.LogicalCard.CardType == TypeClass.Crossroads) == 1)
				plusActions = 3;
			player.ReceiveBenefit(this, new CardBenefit() { Cards = player.Hand[Cards.Category.Victory].Count, Actions = plusActions });
		}