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 IActivity CreateChooseActionActivity(TurnContext context, RevealZone revealZone, ICard source) { var selectTreasure = new SelectFromRevealedCardsActivity(context.Game.Log, context.ActivePlayer, revealZone, "Select the action to play first.", SelectionSpecifications.SelectExactlyXCards(1), source); selectTreasure.AfterCardsSelected = cards => { var first = cards.OfType <IActionCard>().Single(); var second = revealZone.OfType <IActionCard>().Single(c => c != first); // Reverse order because we're on a stack. context.AddEffect(source, new PlayCardEffect(second)); context.AddEffect(source, new PlayCardEffect(first)); }; return(selectTreasure); }
private IEnumerable <IActionCard> MatchingActions(RevealZone zone) { return(zone.OfType <IActionCard>().Where(c => !(c is Golem))); }
private IEnumerable <ITreasureCard> MatchingCards(RevealZone zone) { return(zone.OfType <ITreasureCard>()); }