コード例 #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);

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

				if (attackee.CanDraw)
				{
					Card card = attackee.Draw(DeckLocation.Revealed);
					Choice choice = new Choice(String.Format("Do you want to discard {0}'s {1} or put it back on top?", attackee.Name, card.Name), this, new CardCollection() { card }, new List<string>() { "Discard", "Put it back" }, attackee);
					ChoiceResult result = player.MakeChoice(choice);
					if (result.Options[0] == "Discard")
						attackee.DiscardRevealed();
					else
						attackee.AddCardsToDeck(attackee.RetrieveCardsFrom(DeckLocation.Revealed), DeckPosition.Top);
				}
			}

			player.BeginDrawing();
			// Keep flipping cards until we hit a non-Action card, thus making the counts different
			while (player.CanDraw && player.Revealed[Category.Action].Count == player.Revealed.Count)
				player.Draw(DeckLocation.Revealed);

			player.EndDrawing();
			player.AddCardsToHand(DeckLocation.Revealed);
		}
コード例 #3
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");
		}
コード例 #4
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();
		}
コード例 #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.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();
		}
コード例 #7
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();
		}
コード例 #8
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();
		}
コード例 #9
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]);
		}