using DominionBase.Enums; using DominionBase.Piles; using DominionBase.Players; using DominionBase.Properties; using System.Diagnostics.Contracts; namespace DominionBase.Cards.Nocturne { public class Bat : Card { public const int BaseCount = 10; public Bat() : base(Categories.Night, Source.Nocturne, Location.Special, Traits.DeckReduction | Traits.RemoveCurses | Traits.RemoveFromHand | Traits.Transformable | Traits.Trasher) { BaseCost = new Cost(2, special: true); } public static void SetupSupply(IGame game) { Contract.Requires(game != null, "game cannot be null"); if (!game.Table.SpecialPiles.ContainsKey(TypeClass.Bat)) { var supply = new Supply(game, game.Players, TypeClass.Bat, BaseCount); supply.FullSetup(); game.Table.SpecialPiles.Add(TypeClass.Bat, supply); } } public override void FollowInstructions(IPlayer player) { Contract.Requires(player != null, "player cannot be null"); base.FollowInstructions(player); var choiceTrash = new Choice(Resource.Trash2, this, player.Hand, ChoiceOutcome.Trash, player, minimum: 0, maximum: 2); var resultTrash = player.MakeChoice(choiceTrash); player.Trash(this, player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); if (resultTrash.Cards.Count >= 1) { var thisCard = player.InPlayAndSetAside.Contains(PhysicalCard) ? player.RetrieveCardFrom(DeckLocation.InPlayAndSetAside, PhysicalCard) : null; if (thisCard != null) { // Exchanging isn't a gain, so treat it specially var exchangeFromSupply = player._Game.Table.FindSupplyPileByType(thisCard.BaseType, true); player.Lose(thisCard); exchangeFromSupply.AddTo(thisCard); var exchangeToSupply = player._Game.Table.FindSupplyPileByType(TypeClass.Vampire, true); var exchangeToCard = exchangeToSupply.Take(TypeClass.Vampire); player.AddCardInto(DeckLocation.Discard, exchangeToCard); exchangeToCard.ReceivedBy(player); player._Game.SendMessage(player, this, thisCard, exchangeToCard); } } } } }