public void Play(TurnContext context) { var leftPlayer = context.Opponents.FirstOrDefault(); if (leftPlayer != null) { var revealZone = new RevealZone(leftPlayer); leftPlayer.Deck.MoveTop(2, revealZone); revealZone.LogReveal(context.Game.Log); foreach (var card in revealZone.WithDistinctTypes()) { if (card is IActionCard) { context.RemainingActions += 2; } if (card is ITreasureCard) { context.AvailableSpend += 2; } if (card is IVictoryCard) { context.DrawCards(2); } } revealZone.MoveAll(leftPlayer.Discards); } }
public override void Attack(Player victim, TurnContext context, ICard source) { var revealZone = new RevealZone(victim); victim.Deck.MoveTop(2, revealZone); revealZone.LogReveal(context.Game.Log); var revealedTreasures = revealZone.OfType <ITreasureCard>().WithDistinctTypes(); switch (revealedTreasures.Count()) { case 0: revealZone.MoveAll(victim.Discards); return; case 1: var trashedCard = TrashAndDiscard(context, revealZone, revealedTreasures); var gainChoiceActivity = Activities.GainOpponentsCardChoice(context, trashedCard, revealZone.Owner, source); _activities.Add(gainChoiceActivity); break; default: var chooseTreasureActivity = CreateChooseTreasureActivity(context, revealZone, source); _activities.Add(chooseTreasureActivity); break; } }
private Card TrashAndDiscard(TurnContext context, RevealZone revealZone, IEnumerable <ITreasureCard> revealedTreasures) { var trashedCard = revealedTreasures.Single(); trashedCard.MoveTo(context.Game.Trash); context.Game.Log.LogTrash(revealZone.Owner, trashedCard); revealZone.MoveAll(revealZone.Owner.Discards); return((Card)trashedCard); }
private IActivity CreateChooseCardActivity(TurnContext context, RevealZone revealZone, Player player, ICard source) { var selectTreasure = new SelectFromRevealedCardsActivity(context.Game.Log, player, revealZone, string.Format("Select the card you do NOT want {0} to draw.", revealZone.Owner.Name), SelectionSpecifications.SelectExactlyXCards(1), source); selectTreasure.AfterCardsSelected = cards => { var discardingCard = cards.Single(); discardingCard.MoveTo(context.ActivePlayer.Discards); revealZone.MoveAll(context.ActivePlayer.Hand); }; return(selectTreasure); }