本文整理汇总了C#中Dominion.Rules.TurnContext类的典型用法代码示例。如果您正苦于以下问题:C# TurnContext类的具体用法?C# TurnContext怎么用?C# TurnContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TurnContext类属于Dominion.Rules命名空间,在下文中一共展示了TurnContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Play
public void Play(TurnContext context)
{
context.DrawCards(1);
context.RemainingActions += 1;
context.AddEffect(this, new UpgradeEffect());
}
示例2: OnTurnStarting
public override void OnTurnStarting(TurnContext context)
{
base.OnTurnStarting(context);
context.DrawCards(1);
context.Game.Log.LogMessage("Caravan draws an extra card");
}
示例3: Resolve
public override void Resolve(TurnContext context, ICard source)
{
var upgradeActivity = new SelectCardsActivity(context, "Select a card to Upgrade",
SelectionSpecifications.SelectExactlyXCards(1), source);
upgradeActivity.AfterCardsSelected = cardList =>
{
var player = context.ActivePlayer;
var cardToUpgrade = cardList.Single();
var upgradeCost = cardToUpgrade.Cost + 1;
context.Trash(player, cardToUpgrade);
if (context.Game.Bank.Piles.Any(p => !p.IsEmpty && p.TopCard.Cost == upgradeCost))
{
var gainActivity = Activities.GainACardCostingExactlyX(context.Game.Log, player,
upgradeCost, player.Discards, source);
_activities.Add(gainActivity);
}
else
{
context.Game.Log.LogMessage("{0} could gain no card of appropriate cost", player);
}
};
_activities.Add(upgradeActivity);
}
示例4: 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();
}
}
示例5: Resolve
public override void Resolve(TurnContext context)
{
var player = context.ActivePlayer;
var log = context.Game.Log;
if (player.Hand.OfType<IActionCard>().Any())
{
var activity = new SelectCardsActivity(
log, player,
"Select an action to play twice",
SelectionSpecifications.SelectExactlyXCards(1));
activity.Specification.CardTypeRestriction = typeof (IActionCard);
activity.AfterCardsSelected = cards =>
{
var actionCard = cards.OfType<IActionCard>().Single();
log.LogMessage("{0} selected {1} to be played twice.", player.Name, actionCard.Name);
actionCard.MoveTo(player.PlayArea);
actionCard.Play(context);
actionCard.Play(context);
};
_activities.Add(activity);
}
}
示例6: OnTurnStarting
public void OnTurnStarting(TurnContext context)
{
context.RemainingActions += 1;
context.AvailableSpend += 1;
IsFinished = true;
context.Game.Log.LogMessage("FishingVillage adds one action and one spend");
}
示例7: Play
public void Play(TurnContext context)
{
context.RemainingActions += 2;
context.AvailableSpend += 1;
context.AddLongLivedEffect(new FishingVillageEffect(this));
}
示例8: Attack
public override void Attack(Player victim, TurnContext context, ICard source)
{
var victoryTypes = victim.Hand.OfType<IVictoryCard>()
.WithDistinctTypes()
.ToList();
if(victoryTypes.Count() > 1)
{
var activity = Activities.PutCardOfTypeFromHandOnTopOfDeck(context.Game.Log, victim,
"Select a victory card to put on top",
typeof (IVictoryCard),
source);
_activities.Add(activity);
}
else if(victoryTypes.Any())
{
var card = victoryTypes.Single();
victim.Deck.MoveToTop(card);
context.Game.Log.LogMessage("{0} put a {1} on top of the deck.", victim.Name, card.Name);
}
else
{
context.Game.Log.LogRevealHand(victim);
}
}
示例9: Resolve
public override void Resolve(TurnContext context, ICard source)
{
base.Resolve(context, source);
if(context.ActivePlayer.Deck.TopCard != null)
_activities.Add(Activities.ChooseWhetherToMillTopCard(context, context.ActivePlayer, context.ActivePlayer, source));
}
示例10: Play
public void Play(TurnContext context)
{
context.DrawCards(1);
context.RemainingActions += 1;
context.Buys += 1;
context.AvailableSpend += 1;
}
示例11: Attack
public override void Attack(Player victim, TurnContext context, ICard source)
{
var swindledCard = victim.Deck.TopCard;
if(swindledCard == null)
{
context.Game.Log.LogMessage("{0} did not have any cards to be swindled.", victim.Name);
return;
}
context.Trash(victim, swindledCard);
var candidates = context.Game.Bank.Piles.Where(p => p.IsEmpty == false && p.TopCard.Cost == swindledCard.Cost);
if(candidates.Count() == 0)
{
context.Game.Log.LogMessage("There are no cards of cost {0}.", swindledCard.Cost);
}
else if (candidates.Count() == 1)
{
var pile = candidates.Single();
var card = pile.TopCard;
card.MoveTo(victim.Discards);
context.Game.Log.LogGain(victim, card);
}
else
{
var activity = Activities.SelectACardForOpponentToGain(context, context.ActivePlayer, victim, swindledCard.Cost, source);
_activities.Add(activity);
}
}
示例12: Play
public void Play(TurnContext context)
{
context.RemainingActions += 1;
context.DrawCards(1);
context.AddLongLivedEffect(new CaravanEffect(this));
}
示例13: Play
public void Play(TurnContext context)
{
context.DrawCards(4);
context.Buys += 1;
foreach (var opponent in context.Opponents)
opponent.DrawCards(1);
}
示例14: DoTrash
private void DoTrash(TurnContext context, ICard source)
{
if (context.ActivePlayer.Hand.CardCount > 0)
{
var activity = Activities.SelectUpToXCardsToTrash(context, context.ActivePlayer, 1, source);
_activities.Add(activity);
}
}
示例15: Attack
public override void Attack(Player victim, TurnContext context, ICard source)
{
if (victim.Deck.CardCount + victim.Discards.CardCount > 0)
victim.Deck.MoveTop(1, victim.Discards);
var gainUtil = new GainUtility(context, victim);
gainUtil.Gain<Curse>(c => victim.Deck.MoveToTop(c));
}