private static bool ShouldGainCopper(GameState gameState, ICardPicker gainOrder) { PlayerState self = gameState.Self; int minValue = self.ExpectedCoinValueAtEndOfTurn; int maxValue = minValue + Strategy.CountInHand(Dominion.Cards.IllGottenGains, gameState); if (maxValue == minValue) { return(false); } CardPredicate shouldGainCard = delegate(Card card) { int currentCardCost = card.CurrentCoinCost(self); return(currentCardCost >= minValue && currentCardCost <= maxValue); }; Card cardType = gainOrder.GetPreferredCard(gameState, shouldGainCard); if (cardType == null) { return(false); } int coppersToGain = DefaultPlayerAction.CostOfCard(cardType, gameState) - minValue; return(coppersToGain > 0); }
private static bool DoesHandHaveCombinationToTrash(DefaultPlayerAction playerAction, GameState gameState) { int countToTrash = Strategy.CountInHandFrom(playerAction.trashOrder, gameState); int countInHand = gameState.Self.Hand.Count; return(countInHand - countToTrash <= 2); }
public static MapOfCards <IPlayerAction> GetCardResponses(DefaultPlayerAction playerAction) { var result = new MapOfCards <IPlayerAction>(); result[Dominion.Cards.Ambassador] = new AmbassadorAlwaysReturnBestTrash(playerAction); result[Dominion.Cards.Amulet] = new Amulet(playerAction); result[Dominion.Cards.Alchemist] = new Alchemist(playerAction); result[Dominion.Cards.BandOfMisfits] = new BandOfMisfits(playerAction); result[Dominion.Cards.Cartographer] = new Cartographer(playerAction); result[Dominion.Cards.Catacombs] = new Catacombs(playerAction); result[Dominion.Cards.Chancellor] = new Chancellor(playerAction); result[Dominion.Cards.Count] = new Count(playerAction); result[Dominion.Cards.Doctor] = new Doctor(playerAction); result[Dominion.Cards.Explorer] = new Explorer(playerAction); result[Dominion.Cards.Golem] = new Golem(playerAction); result[Dominion.Cards.Governor] = new Governor(playerAction); result[Dominion.Cards.Herbalist] = new Herbalist(playerAction); result[Dominion.Cards.Herald] = new Herald(playerAction); result[Dominion.Cards.HorseTraders] = new HorseTraders(playerAction); result[Dominion.Cards.IllGottenGains] = new IllGottenGainsAlwaysGainCopper(playerAction); result[Dominion.Cards.Island] = new Island(playerAction); result[Dominion.Cards.Library] = new Library(playerAction); result[Dominion.Cards.Masquerade] = new Masquerade(playerAction); result[Dominion.Cards.MarketSquare] = new MarketSquare(playerAction); result[Dominion.Cards.Masterpiece] = new Masterpiece(playerAction); result[Dominion.Cards.Messenger] = new Messenger(playerAction); result[Dominion.Cards.Mint] = new Mint(playerAction); result[Dominion.Cards.Miser] = new Miser(playerAction); result[Dominion.Cards.Moat] = new Moat(playerAction); result[Dominion.Cards.Mystic] = new MysticAndWishingWell(playerAction); result[Dominion.Cards.NomadCamp] = new NomadCamp(playerAction); result[Dominion.Cards.Nobles] = new Nobles(playerAction); result[Dominion.Cards.PearlDiver] = new PearlDiver(playerAction); result[Dominion.Cards.Rebuild] = new Rebuild(playerAction); result[Dominion.Cards.SpiceMerchant] = new SpiceMerchant(playerAction); result[Dominion.Cards.Scavenger] = new Scavenger(playerAction); result[Dominion.Cards.ScryingPool] = new ScryingPool(playerAction); result[Dominion.Cards.Scheme] = new Scheme(playerAction); result[Dominion.Cards.Steward] = new Steward(playerAction); result[Dominion.Cards.StoneMason] = new StoneMason(playerAction); result[Dominion.Cards.RoyalSeal] = new RoyalSeal(playerAction); result[Dominion.Cards.SecretChamber] = new SecretChamber(playerAction); result[Dominion.Cards.Treasury] = new Treasury(playerAction); result[Dominion.Cards.Trader] = new Trader(playerAction); result[Dominion.Cards.Urchin] = new Urchin(playerAction); result[Dominion.Cards.Vault] = new Vault(playerAction); result[Dominion.Cards.Watchtower] = new Watchtower(playerAction); result[Dominion.Cards.WalledVillage] = new WalledVillage(playerAction); result[Dominion.Cards.WishingWell] = result[Dominion.Cards.Mystic]; result[Dominion.Cards.YoungWitch] = new YoungWitch(playerAction); return(result); }
private static bool PreferMoneyOverDuchy(DefaultPlayerAction playerAction, GameState gameState) { if (!gameState.GetPile(Dominion.Cards.Duchy).Any) { return(true); } int minCoin = gameState.Self.ExpectedCoinValueAtEndOfTurn; int maxCoin = minCoin + 3; Card mostExpensiveCard = playerAction.purchaseOrder.GetPreferredCard(gameState, card => card.CurrentCoinCost(gameState.Self) > minCoin && card.CurrentCoinCost(gameState.Self) <= maxCoin); Card thatOrDuchy = playerAction.purchaseOrder.GetPreferredCard(gameState, card => card == Dominion.Cards.Duchy || card == mostExpensiveCard); if (mostExpensiveCard != null && thatOrDuchy != Dominion.Cards.Duchy) { return(true); } return(false); }
public static bool ShouldPlay(GameState gameState, DefaultPlayerAction playerAction) { int cardCountToTrash = Strategy.CountInDeck(Dominion.Cards.Copper, gameState); if (!playerAction.purchaseOrder.DoesCardPickerMatch(gameState, Dominion.Cards.Estate)) { cardCountToTrash += Strategy.CountInDeck(Dominion.Cards.Estate, gameState); } cardCountToTrash += Strategy.CountInDeck(Dominion.Cards.Curse, gameState); cardCountToTrash += Strategy.CountInDeck(Dominion.Cards.Hovel, gameState); cardCountToTrash += Strategy.CountInDeck(Dominion.Cards.Necropolis, gameState); cardCountToTrash += Strategy.CountInDeck(Dominion.Cards.OvergrownEstate, gameState); if (!playerAction.purchaseOrder.DoesCardPickerMatch(gameState, Dominion.Cards.Lookout)) { cardCountToTrash += Strategy.CountInDeck(Dominion.Cards.Lookout, gameState); } int totalCardsOwned = gameState.Self.CardsInDeck.Count; return(((double)cardCountToTrash) / totalCardsOwned > 0.4); }
public MysticAndWishingWell(DefaultPlayerAction playerAction) : base(playerAction) { }
public Watchtower(DefaultPlayerAction playerAction) : base(playerAction) { }
public IllGottenGainsAlwaysGainCopper(DefaultPlayerAction playerAction) : base(playerAction) { }
public Steward(DefaultPlayerAction playerAction) : base(playerAction) { }
public AmbassadorMaxReturn(DefaultPlayerAction playerAction) : base(playerAction) { }
public AmbassadorAlwaysReturnBestTrash(DefaultPlayerAction playerAction) : base(playerAction) { }
public Masquerade(DefaultPlayerAction playerAction) : base(playerAction) { }
public ScryingPool(DefaultPlayerAction playerAction) : base(playerAction) { }
public Moat(DefaultPlayerAction playerAction) : base(playerAction) { }
public Library(DefaultPlayerAction playerAction) : base(playerAction) { }
public Messenger(DefaultPlayerAction playerAction) : base(playerAction) { }
public SpiceMerchant(DefaultPlayerAction playerAction) : base(playerAction) { }
public Catacombs(DefaultPlayerAction playerAction) : base(playerAction) { }
public Amulet(DefaultPlayerAction playerAction) : base(playerAction) { }
public NomadCamp(DefaultPlayerAction playerAction) : base(playerAction) { }
public Masterpiece(DefaultPlayerAction playerAction) : base(playerAction) { }
public Doctor(DefaultPlayerAction playerAction) : base(playerAction) { }
public Island(DefaultPlayerAction playerAction) : base(playerAction) { }
public Chancellor(DefaultPlayerAction playerAction) : base(playerAction) { }
public AmbassadorReturnIfNotDisruptPurchase(DefaultPlayerAction playerAction) : base(playerAction) { }
public static MapOfCards <GameStatePlayerActionPredicate> GetCardShouldPlayDefaults(DefaultPlayerAction playerAction) { var result = new MapOfCards <GameStatePlayerActionPredicate>(); result[Dominion.Cards.Apprentice] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Altar] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Bishop] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Forager] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Island] = Strategy.HasCardToDiscardInHand; result[Dominion.Cards.JunkDealer] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Lookout] = Lookout.ShouldPlay; result[Dominion.Cards.Masquerade] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Mercenary] = Strategy.HasAtLeast2ToTrashInHand; result[Dominion.Cards.Remodel] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Salvager] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.SpiceMerchant] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Trader] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.TradingPost] = Strategy.HasAtLeast2ToTrashInHand; result[Dominion.Cards.Transmute] = Strategy.HasCardToTrashInHand; result[Dominion.Cards.Rats] = Strategy.HasCardToTrashInHand; return(result); }
public BandOfMisfits(DefaultPlayerAction playerAction) : base(playerAction) { }
public Herbalist(DefaultPlayerAction playerAction) : base(playerAction) { }
public Alchemist(DefaultPlayerAction playerAction) : base(playerAction) { }
public IllGottenGains(DefaultPlayerAction playerAction) : base(playerAction) { }