コード例 #1
0
ファイル: Base.cs プロジェクト: micahpaul/dominion_net_multi
		public override void Play(Player player)
		{
			base.Play(player);
			player.BeginDrawing();
			while (player.Revealed[Category.Treasure].Count < 2 && player.CanDraw)
				player.Draw(DeckLocation.Revealed);

			player.EndDrawing();

			player.AddCardsToHand(player.RetrieveCardsFrom(DeckLocation.Revealed, c => (c.Category & Category.Treasure) == Category.Treasure));

			player.DiscardRevealed();
		}
コード例 #2
0
		public override void Play(Player player)
		{
			base.Play(player);
			// We're looking for 2 non-Golem Action cards
			player.BeginDrawing();
			while (player.Revealed[Category.Action].Count(c => c.CardType != Cards.Alchemy.TypeClass.Golem) < 2 && player.CanDraw)
				player.Draw(DeckLocation.Revealed);

			player.EndDrawing();

			player.Revealed.BeginChanges();
			CardCollection actions = player.Revealed[c => (c.Category & Category.Action) == Category.Action && c.CardType != Cards.Alchemy.TypeClass.Golem];
			player.DiscardRevealed(c => !actions.Contains(c));
			player.Revealed.EndChanges();

			CardCollection cardsToPlay = player.RetrieveCardsFrom(DeckLocation.Revealed);
			Choice choice = new Choice("Which card would you like to play first?", this, actions, player);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Cards.Count > 0)
			{
				actions.Remove(result.Cards[0]);

				// Play the first (selected) one
				player.AddCardInto(DeckLocation.Private, result.Cards[0]);
				player.Actions++;
				player.PlayCardInternal(result.Cards[0], "first");
			}
			else
				player.PlayNothing("first");

			if (actions.Count > 0)
			{
				// Play the other one
				player.AddCardInto(DeckLocation.Private, actions[0]);
				player.Actions++;
				player.PlayCardInternal(actions[0], "second");
			}
			else
				player.PlayNothing("second");
		}
コード例 #3
0
		public override void Play(Player player)
		{
			base.Play(player);

			player.Draw(3, DeckLocation.Revealed);

			CardCollection actionCards = player.Revealed[Cards.Category.Action];
			Choice replaceChoice = new Choice("Choose order of cards to put back on your deck", this, actionCards, player, true, actionCards.Count, actionCards.Count);
			ChoiceResult replaceResult = player.MakeChoice(replaceChoice);
			player.AddCardsToDeck(player.RetrieveCardsFrom(DeckLocation.Revealed, replaceResult.Cards), DeckPosition.Top);

			player.DiscardRevealed();
		}
コード例 #4
0
ファイル: Base.cs プロジェクト: micahpaul/dominion_net_multi
		public override void Play(Player player)
		{
			base.Play(player);
			while (player.Hand.Count < 7 && player.CanDraw)
			{
				Card card = player.Draw(DeckLocation.Private);
				if ((card.Category & Category.Action) == Category.Action)
				{
					Choice choice = Choice.CreateYesNoChoice(String.Format("Would you like to set aside {0}?", card.Name), this, card, player, null);
					ChoiceResult result = player.MakeChoice(choice);
					if (result.Options[0] == "Yes")
					{
						player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Private, card));
					}
					else if (result.Options[0] == "No")
					{
						player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Private, card));
					}
				}
				else
				{
					player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Private, card));
				}
			}
			player.DiscardRevealed();
		}
コード例 #5
0
		public override void Play(Player player)
		{
			base.Play(player);

			SupplyCollection availableSupplies = new SupplyCollection(player._Game.Table.Supplies.Where(kvp => kvp.Value.Randomizer != null && kvp.Value.Randomizer.GroupMembership != Group.None));
			CardCollection cards = new CardCollection();
			Choice choice = new Choice("Name a card", this, availableSupplies, player, false);
			foreach (Supply supply in player._Game.Table.Supplies.Values.Union(player._Game.Table.SpecialPiles.Values))
			{
				foreach (Type type in supply.CardTypes)
				{
					if (!choice.Supplies.Any(kvp => kvp.Value.CardType == type))
						cards.Add(Card.CreateInstance(type));
				}
			}
			choice.AddCards(cards);

			ChoiceResult result = player.MakeChoice(choice);
			ICard namedCard = null;
			if (result.Supply != null)
				namedCard = result.Supply;
			else
				namedCard = result.Cards[0];

			player._Game.SendMessage(player, this, namedCard);

			Card foundCard = null;
			player.BeginDrawing();
			while (player.CanDraw)
			{
				player.Draw(DeckLocation.Revealed);
				Card lastRevealed = player.Revealed.Last();
				if ((lastRevealed.Category & Cards.Category.Victory) == Cards.Category.Victory &&
					namedCard.Name != lastRevealed.Name)
				{
					foundCard = lastRevealed;
					break;
				}
			}
			player.EndDrawing();

			if (foundCard != null)
				foundCard = player.RetrieveCardFrom(DeckLocation.Revealed, foundCard);

			player.DiscardRevealed();

			if (foundCard != null)
			{
				player.Trash(foundCard);

				Cost trashedCardCost = player._Game.ComputeCost(foundCard);
				SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && (supply.Category & Cards.Category.Victory) == Cards.Category.Victory && supply.CurrentCost <= (trashedCardCost + new Coin(3)));
				Choice choiceGain = new Choice("Gain a Victory card", this, gainableSupplies, player, false);
				ChoiceResult resultGain = player.MakeChoice(choiceGain);
				if (resultGain.Supply != null)
					player.Gain(resultGain.Supply);
			}
		}
コード例 #6
0
		public override void Play(Player player)
		{
			base.Play(player);

			player.BeginDrawing();
			while (player.CanDraw)
			{
				player.Draw(DeckLocation.Revealed);
				if (player._Game.ComputeCost(player.Revealed.Last()) >= new Cost(3))
					break;
			}
			player.EndDrawing();

			if (player.Revealed.Count > 0)
			{
				Card lastCard = player.Revealed.Last();
				if (player._Game.ComputeCost(player.Revealed.Last()) >= new Cost(3))
					player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Revealed, lastCard));
			}

			player.DiscardRevealed();
		}
コード例 #7
0
		public override void Play(Player player)
		{
			base.Play(player);

			player.ReturnHand(player.RevealHand());

			Boolean foundUniqueCard = false;
			player.BeginDrawing();
			while (player.CanDraw)
			{
				player.Draw(DeckLocation.Revealed);
				if (player.Hand[player.Revealed.Last().CardType].Count == 0)
				{
					foundUniqueCard = true;
					break;
				}
			}
			player.EndDrawing();

			if (foundUniqueCard && player.Revealed.Count > 0)
				player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Revealed, player.Revealed.Last()));

			player.DiscardRevealed();
		}
コード例 #8
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);
				}
			}
		}
コード例 #9
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);
		}
コード例 #10
0
		public override void Play(Player player)
		{
			base.Play(player);

			player.BeginDrawing();
			while (player.CanDraw)
			{
				player.Draw(DeckLocation.Revealed);
				Card lastRevealed = player.Revealed.Last();
				if ((lastRevealed.Category & Cards.Category.Action) == Cards.Category.Action ||
					(lastRevealed.Category & Cards.Category.Treasure) == Cards.Category.Treasure)
					break;
			}
			player.EndDrawing();

			if (player.Revealed.Count > 0)
				player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Revealed, player.Revealed.Last()));

			player.DiscardRevealed();
		}
コード例 #11
0
		public override void Play(Player player)
		{
			base.Play(player);

			player.BeginDrawing();
			while (player.Revealed[Category.Treasure].Count < 1 && player.CanDraw)
				player.Draw(DeckLocation.Revealed);

			player.EndDrawing();

			CardCollection treasureCards = player.Revealed[c => (c.Category & Category.Treasure) == Category.Treasure];
			if (treasureCards.Count > 0)
			{
				Card card = treasureCards[0];
				Choice choice = new Choice(String.Format("You revealed a {0}.", card.Name), this, new CardCollection() { card }, new List<string>() { "Discard it", "Trash it" }, player);
				ChoiceResult result = player.MakeChoice(choice);
				if (result.Options[0] == "Discard it")
				{
					player.Discard(DeckLocation.Revealed, card);
				}
				else if (result.Options[0] == "Trash it")
				{
					player.Trash(player.RetrieveCardFrom(DeckLocation.Revealed, card));
				}
			}
			player.DiscardRevealed();
		}
コード例 #12
0
		public override void Play(Player player)
		{
			base.Play(player);
			player.BeginDrawing();
			while (player.Revealed[Category.Treasure].Count < 1 && player.CanDraw)
				player.Draw(DeckLocation.Revealed);

			player.EndDrawing();

			CardCollection cards = player.Revealed[Cards.Category.Treasure];
			player.DiscardRevealed(c => !cards.Contains(c));

			if (cards.Count > 0)
				player.PlayCardInternal(cards[0]);
		}
コード例 #13
0
		public override void Play(Player player)
		{
			base.Play(player);

			SupplyCollection availableSupplies = new SupplyCollection(player._Game.Table.Supplies.Where(kvp => kvp.Value.Randomizer != null && kvp.Value.Randomizer.GroupMembership != Group.None));
			CardCollection cards = new CardCollection();
			Choice choice = new Choice("Name a card", this, availableSupplies, player, false);
			foreach (Supply supply in player._Game.Table.Supplies.Values.Union(player._Game.Table.SpecialPiles.Values))
			{
				foreach (Type type in supply.CardTypes)
				{
					if (!choice.Supplies.Any(kvp => kvp.Value.CardType == type))
						cards.Add(Card.CreateInstance(type));
				}
			}
			cards.Sort();
			choice.AddCards(cards);

			ChoiceResult result = player.MakeChoice(choice);
			ICard namedCard = null;
			if (result.Supply != null)
				namedCard = result.Supply;
			else
				namedCard = result.Cards[0];

			player._Game.SendMessage(player, this, namedCard);
			while (player.CanDraw && player.Revealed.Count(c => c.CardType != namedCard.CardType) < 3)
			{
				player.Draw(DeckLocation.Revealed);
			}
			player.AddCardsToHand(player.RetrieveCardsFrom(DeckLocation.Revealed,c => c.CardType != namedCard.CardType));
			player.DiscardRevealed();
		}