• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Players.Player类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AttackedBy

		/// <summary>
		/// Fires off the Attack event, so any listeners can pick it up.
		/// </summary>
		/// <param name="player">The attacking player</param>
		/// <param name="attackingCard">The card that triggered the Attack event</param>
		/// <returns>"true" if the Attack can proceed (wasn't blocked).  "false" if the Attack was blocked.</returns>
		/// <summary>
		public Boolean AttackedBy(Player attacker, Card attackingCard)
		{
			if (Attacked != null)
			{
				AttackedEventArgs aea = null;
				Boolean cancelled = false;
				do
				{
					aea = new AttackedEventArgs(attacker, attackingCard);
					aea.Cancelled |= cancelled;
					Attacked(this, aea);

					CardCollection cards = new CardCollection(aea.Revealable.Values.Select(s => s.Card));
					if (cards.Count > 0)
					{
						cards.Sort();
						Choice choice = new Choice("Reveal a card?", null, attackingCard, cards, this, true, aea);
						ChoiceResult result = this.MakeChoice(choice);

						if (result.Cards.Count > 0)
							aea.Revealable[result.Cards[0].CardType].Method(this, ref aea);
						else
							break;
					}

					cancelled |= aea.Cancelled;

				} while (Attacked != null && aea.HandledBy.Count > 0);

				if (aea != null)
					cancelled |= aea.Cancelled;

				return !cancelled;
			}
			return true;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:43,代码来源:Player.cs


示例17: SetupDeckAs

		internal void SetupDeckAs(Player player)
		{
			CardCollection cards = new CardCollection(this.RetrieveCardsFrom(DeckLocation.Hand).Union(this.RetrieveCardsFrom(DeckLocation.Deck)));
			foreach (Card sourceCard in player.Hand)
			{
				Card myFoundCard = cards.First(c => c.CardType == sourceCard.CardType);
				cards.Remove(myFoundCard);
				this.AddCardInto(DeckLocation.Hand, myFoundCard);
			}
			this.AddCardsInto(DeckLocation.Deck, cards);
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:11,代码来源:Player.cs


示例18: SumAll

		internal double SumAll(Player fromPlayer, Predicate<Card> filterPredicate, Func<Card, double> sumSelector, Boolean onlyObtainable, Boolean onlyCurrentlyDrawable)
		{
			double sum = 0;
			sum += this.DiscardPile.LookThrough(filterPredicate).Sum(sumSelector);
			sum += this.DrawPile.LookThrough(filterPredicate).Sum(sumSelector);

			if (!onlyCurrentlyDrawable)
			{
				sum += this.Hand[filterPredicate].Sum(sumSelector);
				sum += this.Private[filterPredicate].Sum(sumSelector);
				sum += this.Revealed[filterPredicate].Sum(sumSelector);
				sum += this.InPlay[filterPredicate].Sum(sumSelector);
				sum += this.SetAside[filterPredicate].Sum(sumSelector);

				foreach (Type deckType in this.PlayerMats.Keys)
				{
					// Don't count cards on mats that you can't obtain cards from
					if (onlyObtainable && !this.PlayerMats[deckType].IsObtainable)
						continue;
					sum += this.PlayerMats[deckType].LookThrough(filterPredicate).Sum(sumSelector);
				}
			}
			return sum;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:24,代码来源:Player.cs


示例19: CountAll

		internal int CountAll(Player fromPlayer, Predicate<Card> predicate, Boolean onlyObtainable, Boolean onlyCurrentlyDrawable)
		{
			int count = 0;
			count += this.DiscardPile.LookThrough(predicate).Count;
			count += this.DrawPile.LookThrough(predicate).Count;

			if (!onlyCurrentlyDrawable)
			{
				count += this.Hand[predicate].Count;
				count += this.Private[predicate].Count;
				count += this.Revealed[predicate].Count;
				count += this.InPlay[predicate].Count;
				count += this.SetAside[predicate].Count;

				foreach (Type deckType in this.PlayerMats.Keys)
				{
					// Don't count cards on mats that you can't obtain cards from
					if (onlyObtainable && !this.PlayerMats[deckType].IsObtainable)
						continue;
					count += this.PlayerMats[deckType].LookThrough(predicate).Count;
				}
			}
			return count;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:24,代码来源:Player.cs


示例20: player_DiscardHand

		internal void player_DiscardHand(Player player, ref CardsDiscardEventArgs e)
		{
			CardMovementCollection cardsToMove = (CardMovementCollection)e.Data;

			// Discard Hand
			this.AddCardsInto(DeckLocation.Discard,
				this.RetrieveCardsFrom(DeckLocation.Hand, c =>
					cardsToMove[c].CurrentLocation == DeckLocation.Hand && cardsToMove[c].Destination == DeckLocation.Discard));

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# XModel.XTypeReference类代码示例发布时间:2022-05-24
下一篇:
C# Rules.TurnContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap