本文整理汇总了C#中Dominion.Rules.TurnContext.Trash方法的典型用法代码示例。如果您正苦于以下问题:C# TurnContext.Trash方法的具体用法?C# TurnContext.Trash怎么用?C# TurnContext.Trash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dominion.Rules.TurnContext
的用法示例。
在下文中一共展示了TurnContext.Trash方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Play
public void Play(TurnContext context)
{
context.Trash(context.ActivePlayer, this);
var otherMap = context.ActivePlayer.Hand.OfType<TreasureMap>().FirstOrDefault();
if(otherMap != null)
{
context.Trash(context.ActivePlayer, otherMap);
var gainUtil = new GainUtility(context, context.ActivePlayer);
var deck = context.ActivePlayer.Deck;
gainUtil.Gain<Gold>(deck.MoveToTop);
gainUtil.Gain<Gold>(deck.MoveToTop);
gainUtil.Gain<Gold>(deck.MoveToTop);
gainUtil.Gain<Gold>(deck.MoveToTop);
}
}
示例2: 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);
}
示例3: 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);
}
}
示例4: Resolve
public override void Resolve(TurnContext context, ICard source)
{
if (context.ActivePlayer.Hand.OfType<Copper>().Any())
{
var copperCard = context.ActivePlayer.Hand.OfType<Copper>().FirstOrDefault();
context.Trash(context.ActivePlayer, copperCard);
context.AvailableSpend += 3;
};
}
示例5: Resolve
public override void Resolve(TurnContext context)
{
var activity = new SelectCardsActivity(
context,
"Select up to 4 cards to trash",
SelectionSpecifications.SelectUpToXCards(4));
activity.AfterCardsSelected = cards =>
{
foreach (var cardToTrash in cards)
context.Trash(activity.Player, cardToTrash);
};
_activities.Add(activity);
}
示例6: Resolve
public override void Resolve(TurnContext context)
{
var activity = new SelectCardsActivity(context, "Select a treasure card to mine",
SelectionSpecifications.SelectExactlyXCards(1));
activity.Specification.CardTypeRestriction = typeof(ITreasureCard);
activity.AfterCardsSelected = cardList =>
{
var cardToMine = cardList.Single();
context.Trash(context.ActivePlayer, cardToMine);
AddGainActivity(context.Game.Log, context.ActivePlayer, cardToMine.Cost + 3);
};
_activities.Add(activity);
}
示例7: Resolve
public override void Resolve(TurnContext context, ICard source)
{
if (context.ActivePlayer.Hand.CardCount > 0)
{
var activity = new SelectCardsActivity(context, "Select a card to trash",
SelectionSpecifications.SelectExactlyXCards(1), source);
activity.AfterCardsSelected = cardList =>
{
var cardToSalvage = cardList.Single();
context.AvailableSpend += cardToSalvage.Cost.Money;
context.Trash(context.ActivePlayer, cardToSalvage);
};
_activities.Add(activity);
}
}
示例8: Resolve
public override void Resolve(TurnContext context, ICard source)
{
var remodelActivity = new SelectCardsActivity(context, _message,
SelectionSpecifications.SelectExactlyXCards(1), source);
remodelActivity.AfterCardsSelected = cardList =>
{
var player = context.ActivePlayer;
var cardToRemodel = cardList.Single();
context.Trash(player, cardToRemodel);
var gainActivity = Activities.GainACardCostingUpToX(context.Game.Log, player, cardToRemodel.Cost + _costIncrease, source);
_activities.Add(gainActivity);
};
_activities.Add(remodelActivity);
}
示例9: Resolve
public override void Resolve(TurnContext context, ICard source)
{
if (!context.Game.Trash.Contains(_source))
{
var activity = Activities.ChooseYesOrNo(context.Game.Log, context.ActivePlayer,
"Trash mining village for +2 buy?",
source,
() =>
{
context.Trash(context.ActivePlayer, _source);
context.AvailableSpend += 2;
}
);
_activities.Add(activity);
}
}
示例10: Resolve
public override void Resolve(TurnContext context, ICard source)
{
if (context.ActivePlayer.Hand.CardCount > 0)
{
var activity = new SelectCardsActivity(context, "Select a card to trash",
SelectionSpecifications.SelectExactlyXCards(1), source);
activity.AfterCardsSelected = cardList =>
{
var cardToTrash = cardList.Single();
var cardsToDraw = cardToTrash.Cost.Money;
// Notice the card doesn't say its 2 per potion (if we add cards that cost multiple potions)
if (cardToTrash.Cost.Potions > 0)
cardsToDraw += 2;
context.DrawCards(cardsToDraw);
context.Trash(context.ActivePlayer, cardToTrash);
};
_activities.Add(activity);
}
}
示例11: Resolve
public override void Resolve(TurnContext context, ICard source)
{
if (context.ActivePlayer.Hand.OfType<ITreasureCard>().Any())
{
var activity = new SelectCardsActivity(context, "Select a treasure card to mine",
SelectionSpecifications.SelectExactlyXCards(1), source);
activity.Specification.CardTypeRestriction = typeof (ITreasureCard);
activity.AfterCardsSelected = cardList =>
{
var cardToMine = cardList.Single();
context.Trash(context.ActivePlayer, cardToMine);
AddGainActivity(context.Game.Log, context.ActivePlayer, cardToMine.Cost + 3, source);
};
_activities.Add(activity);
}
else
{
context.Game.Log.LogMessage("No treasure cards to trash.");
}
}
示例12: Play
public void Play(TurnContext context)
{
context.Trash(context.ActivePlayer, this);
context.AddEffect(this, new FeastEffect());
}