using DominionBase.Enums; using DominionBase.Piles; using DominionBase.Players; using DominionBase.Properties; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; namespace DominionBase.Cards.Renaissance { public class Treasurer : Card { public Treasurer() : base(Categories.Action, Source.Renaissance, Location.Kingdom, Traits.ConditionalBenefit | Traits.DeckReduction | Traits.Gainer | Traits.PlusCoin | Traits.Terminal | Traits.Trasher) { BaseCost = new Cost(5); Benefit.Currency.Coin.Value = 3; } public override void FollowInstructions(IPlayer player) { Contract.Requires(player != null, "player cannot be null"); base.FollowInstructions(player); var choiceOption = new Choice(Resource.ChooseOne, this, this, new List { "Trash a Treasure from your hand", "Gain a Treasure from the trash to your hand", "Take the Key" }, player, minimum: 1, maximum: 1); var resultOption = player.MakeChoice(choiceOption); switch (resultOption.Options.FirstOrDefault()) { case "Trash a Treasure from your hand": var choiceTrash = new Choice("Trash a Treasure from your hand", this, player.Hand[Categories.Treasure], ChoiceOutcome.Trash, player); var resultTrash = player.MakeChoice(choiceTrash); if (resultTrash.Cards.Any()) player.Trash(this, player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); break; case "Gain a Treasure from the trash to your hand": var choiceFromTrash = new Choice("Gain a Treasure from the trash to your hand", this, player._Game.Table.Trash[Categories.Treasure], ChoiceOutcome.Gain, player); var resultFromTrash = player.MakeChoice(choiceFromTrash); if (resultFromTrash.Cards.Any()) player.Gain(player._Game.Table.Trash, resultFromTrash.Cards[0], this, DeckLocation.Hand, DeckPosition.Automatic); break; case "Take the Key": player.Take(TypeClass.Key); break; default: break; } } } }