当前位置: 首页>>代码示例>>C#>>正文


C# Player.RetrieveCardsFrom方法代码示例

本文整理汇总了C#中DominionBase.Players.Player.RetrieveCardsFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Player.RetrieveCardsFrom方法的具体用法?C# Player.RetrieveCardsFrom怎么用?C# Player.RetrieveCardsFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DominionBase.Players.Player的用法示例。


在下文中一共展示了Player.RetrieveCardsFrom方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Play

		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();
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:13,代码来源:Base.cs

示例2: Play

		public override void Play(Player player)
		{
			base.Play(player);

			Choice choiceCard = new Choice("Reveal a card from your hand to return up to 2 to the Supply.", this, player.Hand, player);
			ChoiceResult resultCard = player.MakeChoice(choiceCard);

			if (resultCard.Cards.Count > 0)
			{
				Card revealedCard = resultCard.Cards[0];
				player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, revealedCard));
				player.AddCardInto(DeckLocation.Hand, player.RetrieveCardFrom(DeckLocation.Revealed, revealedCard));

				Supply supply = player._Game.Table.FindSupplyPileByCard(revealedCard);
				if (supply != null)
				{
					List<String> options = new List<string>() { "0", "1" };
					if (player.Hand[revealedCard.CardType].Count > 1)
						options.Add("2");
					Choice choice = new Choice("How many would you like to return to the Supply?", this, new CardCollection() { revealedCard }, options, player);
					ChoiceResult result = player.MakeChoice(choice);

					int numberToReturn = int.Parse(result.Options[0]);
					if (numberToReturn > 0)
					{
						CardCollection cardsToReturn = player.RetrieveCardsFrom(DeckLocation.Hand, revealedCard.CardType, numberToReturn);
						player.Lose(cardsToReturn);
						supply.AddTo(cardsToReturn);
					}

					player._Game.SendMessage(player, this, supply, numberToReturn);
				}

				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;

					if (supply != null && supply.CanGain() && supply.TopCard.Name == revealedCard.Name)
						attackee.Gain(supply);
				}
			}
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:47,代码来源:Seaside.cs

示例3: Play

		public override void Play(Player player)
		{
			base.Play(player);

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

			player.AddCardsToHand(player.RetrieveCardsFrom(DeckLocation.Revealed, 
				c => (c.Category & Cards.Category.Curse) == Cards.Category.Curse ||
					(c.Category & Cards.Category.Ruins) == Cards.Category.Ruins ||
					(c.Category & Cards.Category.Shelter) == Cards.Category.Shelter ||
					(c.Category & Cards.Category.Victory) == Cards.Category.Victory
				));

			player.AddCardsToDeck(player.RetrieveCardsFrom(DeckLocation.Revealed), DeckPosition.Top);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:15,代码来源:DarkAges.cs

示例4: Play

		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));

			if (resultTrash.Cards.Count > 0)
			{
				player.Gain(player._Game.Table.Silver, player._Game.ComputeCost(resultTrash.Cards[0]).Coin.Value);
			}
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:13,代码来源:Hinterlands.cs

示例5: player_GainMandarin

		internal void player_GainMandarin(Player player, ref Players.CardGainEventArgs e)
		{
			CardCollection cardsInPlay = new CardCollection(player.InPlay[Cards.Category.Treasure]);
			cardsInPlay.AddRange(player.SetAside[Cards.Category.Treasure]);
			Choice replaceChoice = new Choice("Choose order of Treasure cards to put back on your deck", this, cardsInPlay, player, true, cardsInPlay.Count, cardsInPlay.Count);
			ChoiceResult replaceResult = player.MakeChoice(replaceChoice);

			player.RetrieveCardsFrom(DeckLocation.InPlay, c => replaceResult.Cards.Contains(c));
			player.RetrieveCardsFrom(DeckLocation.SetAside, c => replaceResult.Cards.Contains(c));

			player.AddCardsToDeck(replaceResult.Cards, DeckPosition.Top);

			e.HandledBy.Add(TypeClass.Mandarin);

			// Clear out the Event Triggers -- this only happens when its Gained, so we don't care any more
			foreach (Player playerLoop in _CardGainedHandlers.Keys)
				playerLoop.CardGained -= _CardGainedHandlers[playerLoop];
			_CardGainedHandlers.Clear();
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:19,代码来源:Hinterlands.cs

示例6: player_BuyFarmland

		internal void player_BuyFarmland(Player player, ref Players.CardBuyEventArgs e)
		{
			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));

			if (resultTrash.Cards.Count > 0)
			{
				Cost trashedCardCost = player._Game.ComputeCost(resultTrash.Cards[0]);
				SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost == (trashedCardCost + new Coin(2)));
				Choice choice = new Choice("Gain a card", this, gainableSupplies, player, false);
				ChoiceResult result = player.MakeChoice(choice);
				if (result.Supply != null)
					player.Gain(result.Supply);
			}

			e.HandledBy.Add(TypeClass.Farmland);

			// Clear out the Event Triggers -- this only happens when its Gained, so we don't care any more
			foreach (Player playerLoop in _CardBoughtHandlers.Keys)
				playerLoop.CardBought -= _CardBoughtHandlers[playerLoop];
			_CardBoughtHandlers.Clear();
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:23,代码来源:Hinterlands.cs

示例7: Play

		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");
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:40,代码来源:Alchemy.cs

示例8: player_BuyMint

		internal void player_BuyMint(Player player, ref Players.CardBuyEventArgs e)
		{
			player.Trash(player.RetrieveCardsFrom(DeckLocation.InPlay, Category.Treasure));
			player.Trash(player.RetrieveCardsFrom(DeckLocation.SetAside, Category.Treasure));

			e.HandledBy.Add(TypeClass.Mint);

			// Clear out the Event Triggers -- this only happens when its Gained, so we don't care any more
			foreach (Player playerLoop in _CardBoughtHandlers.Keys)
				playerLoop.CardBought -= _CardBoughtHandlers[playerLoop];
			_CardBoughtHandlers.Clear();
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:12,代码来源:Prosperity.cs

示例9: Play

		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);
			}
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:27,代码来源:Cornucopia.cs


注:本文中的DominionBase.Players.Player.RetrieveCardsFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。