public int AmountWillingtoOverPayFor(Card card, GameState gameState)
        {
            if (predicate(gameState))
                return this.picker.AmountWillingtoOverPayFor(card, gameState);

            return 0;
        }
Esempio n. 2
0
 private static CardPickByPriority ActionOrder(Card withCard)
 {
     return new CardPickByPriority(
                CardAcceptance.For(Cards.Rebuild, ShouldPlayRebuild),
                new CardAcceptance(withCard)
                );
 }
 public MatchDescription(CountSource countSource, Card cardType, Comparison comparison, int threshhold)
 {
     this.cardType = cardType;
     this.countSource = countSource;
     this.comparison = comparison;
     this.countThreshHold = threshhold;
 }
Esempio n. 4
0
 public void testEquals()
 {
     Card test = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Card estate = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Object generic = new Object();
     Assert.True(test.Equals(estate));
     Assert.False(test.Equals(generic));
     Card oneoff = new Card(1, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     oneoff = new Card(0, 1, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 1, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 1, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 0, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 1, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 1, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Not Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Changed Description", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 0, "Null");
     Assert.False(test.Equals(oneoff));
 }
            private static bool ShouldByLastCard(Card card, GameState gameState)
            {
                if (CountOfPile(card, gameState) != 1)
                    return true;

                return CountOfPile(Cards.Province, gameState) == 1;
            }
Esempio n. 6
0
        public override bool ShouldPutCardOnTopOfDeck(Card card, GameState gameState)
        {
            if (this.playerAction.discardOrder.DoesCardPickerMatch(gameState, card))
                return false;

            return true;
        }
 public static CardAcceptanceDescription For(Card card)
 {
     return new CardAcceptanceDescription(card, new MatchDescription[]
     {
         new MatchDescription(CountSource.Always, card, Comparison.GreaterThan, 0),
     });
 }
        private static bool CountOfPileLessthanEqual(Card cardType, GameState gameState, int count)
        {
            if (gameState.GetSupplyPile(cardType) == null)
                return true;

            return CountOfPile(cardType, gameState) <= count;
        }
Esempio n. 9
0
 public void drawMoreThanAll()
 {
     int rem = this.stackDefault.cardsRemaining();
     Card test = new Card(0, 0, 0, 0, 0, 0, 0, "String one", "String two", 0, "String three");
     for (int i = 0; i <= rem; i++)
     {
         test = this.stackDefault.buyOne();
     }
     Assert.True(this.stackDefault.isEmpty());
     Assert.Null(test);
     rem = this.stackOne.cardsRemaining();
     for (int i = 0; i <= rem; i++)
     {
         test = this.stackOne.buyOne();
     }
     Assert.True(this.stackOne.isEmpty());
     Assert.Null(test);
     rem = this.stackFive.cardsRemaining();
     for (int i = 0; i <= rem; i++)
     {
         test = this.stackFive.buyOne();
     }
     Assert.True(this.stackFive.isEmpty());
     Assert.Null(test);
 }
 public static PlayerAction Player(Card card, int cardCount = 1)
 {
     return new PlayerAction(
                 "BigMoneyCartographer",
                 purchaseOrder: PurchaseOrder(card, cardCount),
                 actionOrder: ActionOrder(card));
 }
 public void DrewCardIntoHand(PlayerState playerState, Card card)
 {
     for (int i = 0; i < this.gameLogs.Length; ++i)
     {
         this.gameLogs[i].DrewCardIntoHand(playerState, card);
     }
 }
Esempio n. 12
0
 public void AddNCardsToTop(Card card, int count)
 {
     for (int i = 0; i < count; ++i)
     {
         this.AddCardToTop(card);
     }
 }
Esempio n. 13
0
        public override DeckPlacement ChooseBetweenTrashAndTopDeck(GameState gameState, Card card)
        {
            if (playerAction.gainOrder.DoesCardPickerMatch(gameState, card))
                return DeckPlacement.TopOfDeck;

            return DeckPlacement.Trash;
        }
Esempio n. 14
0
 public override int GetCoinAmountToOverpayForCard(GameState gameState, Card card)
 {
     Card cardToOverpayFor = this.playerAction.purchaseOrder.GetPreferredCard(gameState, c => c.CurrentCoinCost(gameState.Self) <= gameState.Self.AvailableCoins);
     if (cardToOverpayFor == null)
         return 0;
     return cardToOverpayFor.CurrentCoinCost(gameState.Self);
 }
 public static PlayerAction Player(Card card, 
     string playerName = null,
     int cardCount = 1,
     int afterSilverCount = 0,
     int countGoldBeforeProvince = 3,
     int countRemainingProvinceBeforeDuchy = 4,
     int countRemainingProvinceBeforeEstateOverGold = 1,
     int countRemainingProvinceBeforeEstateOverSilver = 3,
     int afterGoldCount = int.MaxValue,
     bool enablePenultimateProvinceRule = false)
 {
     return new PlayerAction(
                 playerName == null ? "BigMoney" + card.GetType().Name : playerName,
                 purchaseOrder: PurchaseOrder(
                     card,
                     cardCount,
                     afterSilverCount,
                     afterGoldCount == int.MaxValue && card.DefaultCoinCost >= Cards.Gold.DefaultCoinCost ? 0 : afterGoldCount,
                     countGoldBeforeProvince,
                     countRemainingProvinceBeforeDuchy,
                     countRemainingProvinceBeforeEstateOverGold,
                     countRemainingProvinceBeforeEstateOverSilver),
                 actionOrder:ActionOrder(card),
                 enablePenultimateProvinceRule:enablePenultimateProvinceRule);
 }
 public static PlayerAction Player(Card card, string strategyName, int playerNumber, Card secondCard = null, int count = 1)
 {
     return new PlayerAction(
                 strategyName,
                 playerNumber,
                 purchaseOrder: PurchaseOrder(card, secondCard, count));
 }
Esempio n. 17
0
 public static int CountMightDraw(Card card, GameState gameState, int maxCount)
 {
     if (gameState.Self.CardsInDeck.Count >= maxCount)
         return CountInDeck(card, gameState);
     else
         return CountInDeckAndDiscard(card, gameState);
 }
 public void DiscardedCard(PlayerState playerState, Card card)
 {
     for (int i = 0; i < this.gameLogs.Length; ++i)
     {
         this.gameLogs[i].DiscardedCard(playerState, card);
     }
 }
Esempio n. 19
0
 public Player(int id)
 {
     this.gain = false;
     this.currencyForGain = 0;
     this.currencyForGainBonus = 0;
     this.gainsLeft = 0;
     this.playMultipleTimes = false;
     this.timesToPlayLeft = 1;
     this.timesToPlayNextCard = 1;
     this.id = id;
     myDeck = new Deck();
     myDeck.reshuffle();
     myHand = new Hand();
     for (int i = 0; i < 5; i++)
     {
         myHand.draw(myDeck);
     }
     timesPlayed = new List<int>();
     played = new List<Card>();
     victoryPts = 3;
     this.buysLeft = 1;
     this.currencyAvailable = 0;
     this.actionsLeft = 1;
     this.name = null;
     this.game = null;
     this.lastPlayedCard = null;
     this.trashesNeeded = 0;
     this.trashCurrencyBonus = 0;
     this.bonusCurrencyForBuy = 0;
     this.possibleTrashes = 0;
     this.otherPlayers = new List<Player>();
     this.functionsToCall = new Queue<DelayedFunction>();
     this.thiefList = new List<List<Card>>();
 }
 public MatchDescription(Card card)
 {
     this.cardType = card;
     this.countSource = CountSource.Always;
     this.comparison = Comparison.Equals;
     this.countThreshHold = 1;
 }
 public static CardAcceptanceDescription For(Card card, int count)
 {
     return new CardAcceptanceDescription(card, new MatchDescription[]
     {
         new MatchDescription(CountSource.Always, card, Comparison.GreaterThan, 0),
         new MatchDescription(CountSource.CountAllOwned, card, Comparison.LessThan, count),
     });
 }
Esempio n. 22
0
        public void AddCardToTop(Card card)
        {
            if (card != null)
                this.countKnownCard++;

            this.cards.Add(card);
            base.Add(card);
        }
 public static CardAcceptanceDescription For(Card card, CountSource countSouce, Card testCard, Comparison comparison, int threshhold)
 {
     return new CardAcceptanceDescription(card, new MatchDescription[]
     {
         new MatchDescription(CountSource.Always, card, Comparison.GreaterThan, 0),
         new MatchDescription(countSouce, testCard, comparison, threshhold),
     });
 }
 public override Card ChooseCardToPlayFirst(GameState gameState, Card card1, Card card2)
 {
     IPlayerAction playerAction = this.GetActionForCurrentCardContext(gameState);
     if (playerAction != null)
         return playerAction.ChooseCardToPlayFirst(gameState, card1, card2);
     else
         return base.ChooseCardToPlayFirst(gameState, card1, card2);
 }
 public override DeckPlacement ChooseBetweenTrashTopDeckDiscard(GameState gameState, Card card)
 {
     IPlayerAction playerAction = this.GetActionForCurrentCardContext(gameState);
     if (playerAction != null)
         return playerAction.ChooseBetweenTrashTopDeckDiscard(gameState, card);
     else
         return base.ChooseBetweenTrashTopDeckDiscard(gameState, card);
 }
 public static CardAcceptanceDescription For(Card card, int count, Card testCard, CountSource countSouce, Comparison comparison, int threshhold)
 {
     return new CardAcceptanceDescription(card, new MatchDescription[]
     {
         new MatchDescription(CountSource.CountAllOwned, card, Comparison.LessThan, count),
         new MatchDescription(countSouce, testCard, comparison, threshhold),
     });
 }
 public override void PlayerGainedCard(PlayerState playerState, Card card)
 {
     if (this.gainSequenceByPlayer != null)
     {
         List<Card> gainedList = this.gainSequenceByPlayer[playerState.PlayerIndex];
         gainedList.Add(card);
     }
 }
Esempio n. 28
0
 public GameDescription(Card[] kingdomPiles, Card[] events, Card baneCard, bool useShelters, bool useColonyAndPlatinum)
 {
     this.kingdomPiles = kingdomPiles;
     this.baneCard = baneCard;
     this.events = events;
     this.useShelters = useShelters;
     this.useColonyAndPlatinum = useColonyAndPlatinum;
 }
 public DeckPlacement ChooseBetweenTrashTopDeckDiscard(GameState gameState, Card card)
 {
     var saved = gameState.self;
     gameState.self = this.self;
     var result = this.playerAction.ChooseBetweenTrashTopDeckDiscard(gameState, card);
     gameState.self = saved;
     return result;
 }
Esempio n. 30
0
 public void testGetBuy()
 {
     Card test = new Card(0, 0, 0, 0, 0, 0, 0, "Null Card", "Null Card", 0, "Null");
     Assert.AreEqual(0, test.getBuy());
     test = new Card(1, 0, 1, 0, 0, 0, 0, "Null Card", "Null Card", 0, "Null");
     Assert.AreEqual(1, test.getBuy());
     test = new Card(5, 0, 99, 0, 0, 0, 0, "Null Card", "Null Card", 0, "Null");
     Assert.AreEqual(99, test.getBuy());
 }
Esempio n. 31
0
        public override bool DoReactionToAttackWhileInHand(PlayerState currentPlayer, GameState gameState, out bool cancelsAttack)
        {
            cancelsAttack = false;

            if (currentPlayer.actions.ShouldRevealCardFromHand(gameState, this))
            {
                Dominion.Card topCard    = currentPlayer.deck.TopCard();
                Dominion.Card secondCard = currentPlayer.deck.PeekTopCard(1);

                currentPlayer.DrawAdditionalCardsIntoHand(2, gameState);
                for (int i = 0; i < 2; ++i)
                {
                    currentPlayer.RequestPlayerTopDeckCardFromHand(gameState, acceptableCard => true, false);
                }

                return(topCard != currentPlayer.deck.TopCard() ||
                       secondCard != currentPlayer.deck.PeekTopCard(1));
            }
            else
            {
                return(false);
            }
        }