public override void Resolve(TurnContext context, ICard source) { if (context.ActivePlayer.Hand.CardCount == 0) { context.Game.Log.LogMessage("{0} did not have any cards to upgrade.", context.ActivePlayer.Name); return; } 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); }
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); } }
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); } }
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; } ; }
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); } }
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); } }
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); }
public static IActivity SelectACardToTrash(TurnContext context, Player player, ICard source, Action <ICard> afterTrash) { var activity = new SelectCardsActivity(context.Game.Log, player, "Select a card to trash.", SelectionSpecifications.SelectExactlyXCards(1), source); activity.Hint = ActivityHint.TrashCards; activity.AfterCardsSelected = cards => { foreach (var cardToTrash in cards) { context.Trash(activity.Player, cardToTrash); } afterTrash(cards.Single()); }; return(activity); }
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."); } }
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); } }
public void Play(TurnContext context) { context.Trash(context.ActivePlayer, this); context.AddEffect(this, new FeastEffect()); }
public static IActivity SelectUpToXCardsToTrash(TurnContext context, Player player, int count, ICard source) { var activity = new SelectCardsActivity(context.Game.Log, player, string.Format("Select up to {0} card(s) to trash", count), SelectionSpecifications.SelectUpToXCards(count), source); activity.Hint = ActivityHint.TrashCards; activity.AfterCardsSelected = cards => { foreach (var cardToTrash in cards) context.Trash(activity.Player, cardToTrash); }; return activity; }
public static IActivity SelectACardToTrash(TurnContext context, Player player, ICard source, Action<ICard> afterTrash) { var activity = new SelectCardsActivity(context.Game.Log, player, "Select a card to trash.", SelectionSpecifications.SelectExactlyXCards(1), source); activity.Hint = ActivityHint.TrashCards; activity.AfterCardsSelected = cards => { foreach (var cardToTrash in cards) context.Trash(activity.Player, cardToTrash); afterTrash(cards.Single()); }; return activity; }