本文整理汇总了C#中Dominion.Rules.TurnContext.DiscardCard方法的典型用法代码示例。如果您正苦于以下问题:C# TurnContext.DiscardCard方法的具体用法?C# TurnContext.DiscardCard怎么用?C# TurnContext.DiscardCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dominion.Rules.TurnContext
的用法示例。
在下文中一共展示了TurnContext.DiscardCard方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
public override void Resolve(TurnContext context, ICard source)
{
var estate = context.ActivePlayer.Hand.OfType<Estate>().FirstOrDefault();
Action discardAction = () =>
{
context.AvailableSpend += 4;
context.DiscardCard(context.ActivePlayer, estate);
};
Action gainAction = () => new GainUtility(context, context.ActivePlayer).Gain<Estate>();
if (estate != null)
{
var activity = Activities.ChooseYesOrNo
(context.Game.Log, context.ActivePlayer, "Discard an Estate?",
source,
discardAction, gainAction);
_activities.Add(activity);
}
else
{
gainAction();
}
}
示例2: Attack
public override void Attack(Player victim, TurnContext context, ICard source)
{
var copper = victim.Hand.FirstOrDefault(c => c is Copper);
if (copper != null)
context.DiscardCard(victim, copper);
else
context.Game.Log.LogRevealHand(victim);
}
示例3: Attack
public override void Attack(Player player, TurnContext context)
{
var curseInHand = player.Hand.OfType<Curse>().FirstOrDefault();
if(curseInHand == null)
{
GainCopperAndCurse(player, context);
}
else
{
var activity = Activities.ChooseYesOrNo(context.Game.Log, player, "Discard a curse?",
() => context.DiscardCard(player, curseInHand),
() => GainCopperAndCurse(player, context));
_activities.Add(activity);
}
}