Пример #1
0
        public DefaultPlayerAction(
            string name,
            ICardPicker purchaseOrder,
            ICardPicker actionOrder,
            bool chooseDefaultActionOnNone,
            bool enablePenultimateProvinceRule,
            ICardPicker treasurePlayOrder,
            ICardPicker discardOrder,
            ICardPicker trashOrder,
            ICardPicker gainOrder)
        {
            this.purchaseOrder = purchaseOrder;
            this.actionOrder   = actionOrder == null?DefaultStrategies.DefaultActionPlayOrder(purchaseOrder) : actionOrder;

            this.discardOrder = discardOrder == null?DefaultStrategies.DefaultDiscardOrder() : discardOrder;

            this.trashOrder = trashOrder == null?DefaultStrategies.DefaultTrashOrder(purchaseOrder) : trashOrder;

            this.treasurePlayOrder = treasurePlayOrder == null?DefaultStrategies.DefaultTreasurePlayOrder() : treasurePlayOrder;

            this.gainOrder = gainOrder != null ? gainOrder : purchaseOrder;
            this.chooseDefaultActionOnNone     = chooseDefaultActionOnNone;
            this.enablePenultimateProvinceRule = enablePenultimateProvinceRule;
            this.name = name;
            this.defaultActionOrder = DefaultStrategies.DefaultActionPlayOrder(purchaseOrder);
            this.defaultShouldPlay  = DefaultPlayRules.DefaultResponses.GetCardShouldPlayDefaults(this);
        }
Пример #2
0
        public static MapOfCards <IPlayerAction> GetCardResponses(PlayerAction playerAction)
        {
            var result = new MapOfCards <IPlayerAction>();

            result[Dominion.Cards.Ambassador]     = new Ambassador(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.Golem]          = new Golem(playerAction);
            result[Dominion.Cards.HorseTraders]   = new HorseTraders(playerAction);
            result[Dominion.Cards.IllGottenGains] = new IllGottenGainsAlwaysGainCopper(playerAction);
            result[Dominion.Cards.Library]        = new Library(playerAction);
            result[Dominion.Cards.MarketSquare]   = new MarketSquare(playerAction);
            result[Dominion.Cards.Mystic]         = new MysticAndWishingWell(playerAction);
            result[Dominion.Cards.Nobles]         = new Nobles(playerAction);
            result[Dominion.Cards.Rebuild]        = new Rebuild(playerAction);
            result[Dominion.Cards.ScryingPool]    = new ScryingPool(playerAction);
            result[Dominion.Cards.Scheme]         = new Scheme(playerAction);
            result[Dominion.Cards.Treasury]       = new Treasury(playerAction);
            result[Dominion.Cards.Trader]         = new Trader(playerAction);
            result[Dominion.Cards.Watchtower]     = new Watchtower(playerAction);
            result[Dominion.Cards.WalledVillage]  = new WalledVillage(playerAction);
            result[Dominion.Cards.WishingWell]    = result[Dominion.Cards.Mystic];

            return(result);
        }
Пример #3
0
        public PlayerAction(
            string name,
            ICardPicker purchaseOrder,
            ICardPicker actionOrder        = null,
            bool chooseDefaultActionOnNone = true,
            ICardPicker treasurePlayOrder  = null,
            ICardPicker discardOrder       = null,
            ICardPicker trashOrder         = null,
            ICardPicker gainOrder          = null)
        {
            this.purchaseOrder = purchaseOrder;
            this.actionOrder   = actionOrder == null?DefaultStrategies.DefaultActionPlayOrder(purchaseOrder) : actionOrder;

            this.discardOrder = discardOrder == null?DefaultStrategies.DefaultDiscardOrder() : discardOrder;

            this.trashOrder = trashOrder == null?DefaultStrategies.DefaultTrashOrder(purchaseOrder) : trashOrder;

            this.treasurePlayOrder = treasurePlayOrder == null?DefaultStrategies.DefaultTreasurePlayOrder() : treasurePlayOrder;

            this.gainOrder = gainOrder != null ? gainOrder : purchaseOrder;
            this.chooseDefaultActionOnNone = chooseDefaultActionOnNone;
            this.name = name;
            this.defaultActionOrder = DefaultStrategies.DefaultActionPlayOrder(purchaseOrder);

            this.defaultCardResponses = new PlayerActionFromCardResponses(DefaultPlayRules.DefaultResponses.GetCardResponses(this));
            this.defaultShouldPlay    = DefaultPlayRules.DefaultResponses.GetCardShouldPlayDefaults(this);
        }
Пример #4
0
        public GameState(             
            IGameLog gameLog,
            IPlayerAction[] players,
            GameConfig gameConfig,
            Random random,
            IEnumerable<CardCountPair>[] startingDeckPerPlayer = null)
        {
            int playerCount = players.Length;
            this.gameLog = gameLog;
            this.cardGameSubset = gameConfig.cardGameSubset;
            this.supplyPiles = gameConfig.GetSupplyPiles(playerCount, random);
            this.nonSupplyPiles = gameConfig.GetNonSupplyPiles();

            this.mapCardToPile = new MapOfCards<PileOfCards>(this.cardGameSubset);
            this.BuildMapOfCardToPile();

            this.players = new PlayerCircle(playerCount, players, this.gameLog, random, this.cardGameSubset);

            this.hasPileEverBeenGained = new MapPileOfCardsToProperty<bool>(this.supplyPiles);
            this.pileEmbargoTokenCount = new MapPileOfCardsToProperty<int>(this.supplyPiles);
            this.trash = new BagOfCards(this.cardGameSubset);

            this.GainStartingCards(gameConfig);

            this.players.AllPlayersDrawInitialCards(gameConfig);

            foreach (PileOfCards cardPile in this.supplyPiles)
            {
                cardPile.ProtoTypeCard.DoSpecializedSetupIfInSupply(this);
            }
        }
Пример #5
0
        public static MapOfCards <GameStatePlayerActionPredicate> GetCardShouldPlayDefaults(PlayerAction playerAction)
        {
            var result = new MapOfCards <GameStatePlayerActionPredicate>();

            result[Dominion.Cards.Remodel]  = Strategy.HasCardToTrashInHand;
            result[Dominion.Cards.Salvager] = Strategy.HasCardToTrashInHand;
            result[Dominion.Cards.Bishop]   = Strategy.HasCardToTrashInHand;
            result[Dominion.Cards.Lookout]  = Lookout.ShouldPlay;

            return(result);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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.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.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;
        }
Пример #8
0
        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.JunkDealer]    = Strategy.HasCardToTrashInHand;
            result[Dominion.Cards.Lookout]       = Lookout.ShouldPlay;
            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);
        }
Пример #9
0
        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;
        }
Пример #10
0
 public PlayerActionFromCardResponses(DefaultPlayerAction playerAction)
     : base(playerAction)
 {
     this.cardResponses = DefaultPlayRules.DefaultResponses.GetCardResponses(playerAction);
 }
 public PlayerActionFromCardResponses(DefaultPlayerAction playerAction)
     : base(playerAction)
 {
     this.cardResponses = DefaultPlayRules.DefaultResponses.GetCardResponses(playerAction);
 }
 public PlayerActionFromCardResponses(MapOfCards <IPlayerAction> cardResponses)
 {
     this.cardResponses = cardResponses;
 }