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


C# Players.Player类代码示例

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


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

示例1: TrashedBy

		internal override void TrashedBy(Player player)
		{
			base.TrashedBy(player);

			// Need to reset any Gain triggers when we're trashed -- we can technically be gained from the Trash
			ResetTriggers(player._Game);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:7,代码来源:Hinterlands.cs

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

示例3: AddRange

		public void AddRange(Player player, IEnumerable<Card> cardCollection, DeckPosition deckPosition)
		{
			switch (deckPosition)
			{
				case DeckPosition.Top:
					_Cards.InsertRange(0, cardCollection.Reverse());
					break;
				case DeckPosition.Bottom:
					_Cards.AddRange(cardCollection);
					break;
			}
			this.Sort();

			if (cardCollection.Count() > 0)
			{
				if (_AsynchronousChanging)
				{
					if (_AsynchronousPileChangedEventArgs == null)
						_AsynchronousPileChangedEventArgs = new PileChangedEventArgs(player, PileChangedEventArgs.Operation.Added, cardCollection);
					else
						_AsynchronousPileChangedEventArgs.AddedCards.AddRange(cardCollection);
				}
				else if (PileChanged != null)
				{
					lock (PileChanged)
					{
						PileChangedEventArgs pcea = new PileChangedEventArgs(player, PileChangedEventArgs.Operation.Added, cardCollection);
						PileChanged(this, pcea);
					}
				}
			}
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:32,代码来源:Deck.cs

示例4: PlayerModeChangedEventArgs

		public PlayerModeChangedEventArgs(Player player, PlayerMode oldPlayerMode)
		{
			CurrentPlayer = player;
			OldPlayerMode = oldPlayerMode;
			if (player != null)
				NewPlayerMode = player.PlayerMode;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:7,代码来源:EventArgs.cs

示例5: PhaseChangedEventArgs

		public PhaseChangedEventArgs(Player player, PhaseEnum oldPhase)
		{
			CurrentPlayer = player;
			OldPhase = oldPhase;
			if (player != null)
				NewPhase = player.Phase;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:7,代码来源:EventArgs.cs

示例6: PhaseChangingEventArgs

		public PhaseChangingEventArgs(Player player, PhaseEnum newPhase)
		{
			CurrentPlayer = player;
			if (player != null)
				CurrentPhase = player.Phase;
			NewPhase = newPhase;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:7,代码来源:EventArgs.cs

示例7: Play

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

			player.Gain(player._Game.Table.Silver, DeckLocation.Deck, DeckPosition.Top);

			// Perform attack on every player (including you)
			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 (attackee.Hand[Category.Victory].Count == 0)
				{
					attackee.ReturnHand(attackee.RevealHand());
				}
				else
				{
					Choice replaceChoice = new Choice("Choose a card to put back on your deck", this, attackee.Hand[Category.Victory], attackee);
					ChoiceResult replaceResult = attackee.MakeChoice(replaceChoice);
					if (replaceResult.Cards.Count > 0)
					{
						Card returnCard = attackee.RetrieveCardFrom(DeckLocation.Hand, replaceResult.Cards[0]);
						attackee.AddCardInto(DeckLocation.Revealed, returnCard);
						attackee.AddCardToDeck(attackee.RetrieveCardFrom(DeckLocation.Revealed, returnCard), DeckPosition.Top);
					}
				}
			}
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:33,代码来源:Base.cs

示例8: Retrieve

		internal Card Retrieve(Player player, Card card)
		{
			CardCollection cc = Retrieve(player, c => c == card);
			if (cc.Count == 0)
				throw new Exception(String.Format("Cannot find card {0}", card));
			return cc[0];
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:7,代码来源:Trash.cs

示例9: BenefitsChangedEventArgs

		public BenefitsChangedEventArgs(Player player)
		{
			this.Player = player;
			this.Actions = player.Actions;
			this.Buys = player.Buys;
			// Make a copy of this so it can't be changed
			this.Currency = new Currency(player.Currency);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:8,代码来源:EventArgs.cs

示例10: player_Action

		internal void player_Action(Player player, ref CardsDiscardEventArgs e)
		{
			e.Cards.Remove(this.PhysicalCard);
			Card thisCard = null;
			if (player.InPlay.Contains(this.PhysicalCard))
				thisCard = player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard);
			else
				thisCard = player.RetrieveCardFrom(DeckLocation.SetAside, this.PhysicalCard);
			player.AddCardToDeck(thisCard, DeckPosition.Top);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:10,代码来源:Alchemy.cs

示例11: Choice

		private Choice(String text, Card cardSource, CardCollection cardTriggers, ChoiceType choiceType, Player playerSource, EventArgs eventArgs, Boolean isOrdered, Boolean isSpecific, int minimum, int maximum)
		{
			_Text = text;
			_CardSource = cardSource;
			_CardTriggers = cardTriggers;
			_ChoiceType = choiceType;
			_PlayerSource = playerSource;
			_EventArgs = eventArgs;
			_IsOrdered = isOrdered;
			_IsSpecific = isSpecific;
			_Minimum = minimum < 0 ? 0 : minimum;
			_Maximum = maximum < _Minimum ? _Minimum : maximum;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:13,代码来源:Choice.cs

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

示例13: Play

		public override void Play(Player player)
		{
			base.Play(player);
			player.Draw(3, DeckLocation.Revealed);

			IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player);
			enumerator.MoveNext(); // Gets us... which we don't care about here.
			enumerator.MoveNext(); // Get the player to our left

			Player leftPlayer = enumerator.Current;
			Choice choice = new Choice(String.Format("Choose a card of {0}'s to discard", player), this, player.Revealed, player);
			ChoiceResult result = leftPlayer.MakeChoice(choice);
			// Discard the chosen card
			if (result.Cards.Count > 0)
				player.Discard(DeckLocation.Revealed, result.Cards[0]);
			player.AddCardsToHand(DeckLocation.Revealed);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:17,代码来源:Guilds.cs

示例14: Play

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

示例15: PlayerChoiceMessage

		public PlayerChoiceMessage(Player player, ChoiceResult choiceResult)
			: this(null, player, choiceResult)
		{
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:4,代码来源:Player.cs


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