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


C# Player.Trash方法代码示例

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


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

示例1: Play

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

示例2: Play

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

示例3: Play

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

			SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= new Coin(5));
			Choice choice = new Choice("Gain a card costing up to <coin>5</coin>", this, gainableSupplies, player, false);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Supply != null)
				player.Gain(result.Supply);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:14,代码来源:DarkAges.cs

示例5: player_FoolsGold

		internal void player_FoolsGold(Player player, ref Players.CardGainEventArgs e)
		{
			if (player.Hand.Contains(this.PhysicalCard))
			{
				player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard));
				player.Trash(player.RetrieveCardFrom(DeckLocation.Revealed, this.PhysicalCard));
				player.Gain(player._Game.Table.Gold, DeckLocation.Deck, DeckPosition.Top);
				e.HandledBy.Add(TypeClass.FoolsGold);
			}
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:10,代码来源:Hinterlands.cs

示例6: Play

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

			// Step 1
			player.Gain(player._Game.Table.Silver);

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

			// Step 3
			player.Draw(5 - player.Hand.Count, DeckLocation.Hand);

			// Step 4
			Choice choiceTrash = new Choice("You may trash a card", this, player.Hand[c => (c.Category & Category.Treasure) != Category.Treasure], player, false, 0, 1);
			ChoiceResult resultTrash = player.MakeChoice(choiceTrash);
			player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards));

		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:28,代码来源:Hinterlands.cs

示例7: 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

示例8: Play

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

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

			Currencies.Coin uniqueCardsInPlay = new Currencies.Coin(cardTypes.Count);
			SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= uniqueCardsInPlay);
			Choice choice = new Choice("Gain a card.", this, gainableSupplies, player, false);
			ChoiceResult result = player.MakeChoice(choice);
			if (result.Supply != null)
			{
				player.Gain(result.Supply);
				if ((result.Supply.Category & Cards.Category.Victory) == Cards.Category.Victory)
				{
					player.RetrieveCardFrom(DeckLocation.InPlay, this);
					player.Trash(this);
				}
			}
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:32,代码来源:Cornucopia.cs

示例9: player_Action

		internal void player_Action(Player player, ref CardsDiscardEventArgs e)
		{
			e.Cards.Remove(this.PhysicalCard);
			if (player.InPlay.Contains(this.PhysicalCard))
				player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard));
			else if (player.SetAside.Contains(this.PhysicalCard))
				player.Trash(player.RetrieveCardFrom(DeckLocation.SetAside, this.PhysicalCard));

			player.Gain(player._Game.Table.SpecialPiles[TypeClass.Madman]);

			e.HandledBy.Add(this);
			_ShouldBeTrashed = false;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:13,代码来源:DarkAges.cs

示例10: player_TrashHovel

		internal void player_TrashHovel(Player player, ref Players.CardBuyEventArgs e)
		{
			player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard));

			e.HandledBy.Add(this);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:6,代码来源:DarkAges.cs

示例11: KnightAttack

		public void KnightAttack(Player player)
		{
			List<Cost> availableCosts = new List<Cost>() { new Cost(3), new Cost(4), new Cost(5), new Cost(6) };

			Boolean anyKnightsTrashed = false;
			IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
			enumerator.MoveNext();
			while (enumerator.MoveNext())
			{
				Player attackee = enumerator.Current;
				if (this.IsAttackBlocked[attackee])
					continue;

				CardCollection attackeeCards = attackee.Draw(2, DeckLocation.Revealed);
				Choice choiceTrash = new Choice("Choose a card to trash", this, attackee.Revealed[c => availableCosts.Any(cost => player._Game.ComputeCost(c) == cost)], player);
				ChoiceResult resultTrash = attackee.MakeChoice(choiceTrash);
				if (resultTrash.Cards.Count > 0)
				{
					Card cardToTrash = attackee.RetrieveCardFrom(DeckLocation.Revealed, resultTrash.Cards[0]);
					if ((cardToTrash.Category & Cards.Category.Knight) == Cards.Category.Knight)
						anyKnightsTrashed = true;
					attackee.Trash(cardToTrash);
				}
				attackee.DiscardRevealed();
			}

			if (anyKnightsTrashed && player.InPlay.Contains(this.PhysicalCard))
				player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard));
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:29,代码来源:DarkAges.cs

示例12: 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


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