Beispiel #1
0
        public int GetCost(CardModel cardModel)
        {
            int cost = cardModel.GetBaseCost();
            if (cardModel is Peddler && this.CurrentPhase == GamePhase.Buy)
            {
                cost = Math.Max(0, cost - 2 * this.CurrentPlayer.Played.Count(card => card.Is(CardType.Action)));
            }

            foreach (CardModifier cardModifier in this.CardModifiers)
            {
                cost = cardModifier.GetCost(cardModel, cost);
            }

            if (this.CurrentPlayer.FerryPile != null)
            {
                if (this.CurrentPlayer.FerryPile.Card.Name == cardModel.ThisAsTrashTarget.Name || this.CurrentPlayer.FerryPile.Card.Is(CardType.Ruins) && cardModel.Is(CardType.Ruins) || this.CurrentPlayer.FerryPile.Card.Is(CardType.Knight) && cardModel.Is(CardType.Knight))
                {
                    cost = Math.Max(0, cost - 2);
                }
            }
            return cost;
        }
Beispiel #2
0
 public void Play(CardModel cardModel)
 {
     if (this.GameStarted && !this.GameOver)
     {
         if (cardModel != null && cardModel.Is(CardType.Action) && this.CanPlayAction)
         {
             this.CurrentPlayer.PlayAction(cardModel);
             this.OnPropertyChanged("CanPlayAction");
         }
         else if (cardModel != null && cardModel.Is(CardType.Treasure) && this.CanPlayTreasure)
         {
             this.CurrentPlayer.PlayTreasure(cardModel);
         }
     }
 }
Beispiel #3
0
        protected double StaticEvalSimple(CardModel card, double gamePhase)
        {
            int actionCount = 0, buyCount = 0, coinCount = 0, cardCount = 0;
            foreach (CardModel deckCard in this.Player.Hand.Union(this.Player.Discard.Union(this.Player.Played)))
            {
                actionCount += deckCard.Actions;
                buyCount += deckCard.Buys;
                coinCount += this.GameModel.GetCoins(deckCard);
                cardCount += deckCard.Cards;
            }

            double openingValue = -1;
            double endgameValue = -0.5;

            openingValue += (card.Actions * card.Actions) * Lerp(this.Weights[(int)Values.actionValue], this.Weights[(int)Values.actionValue] + 0.15, 3, 10, actionCount, true) +
                (card.Buys * card.Buys) * this.Weights[(int)Values.buyValue] +
                card.Cards * Lerp(this.Weights[(int)Values.cardValue], this.Weights[(int)Values.cardValue] + 0.75, 5, 10, cardCount, true) +
                (this.GameModel.GetCoins(card) * this.GameModel.GetCoins(card)) * Lerp(this.Weights[(int)Values.coinValue], this.Weights[(int)Values.coinValue] + 0.3, 5, 20, coinCount, true) +
                (card.Is(CardType.Action) ? this.Weights[(int)Values.ActionValue] : 0) +
                (card.Actions + card.Cards + this.GameModel.GetCoins(card)) * this.Weights[(int)Values.combinedValue] +
                (card.GetVictoryPoints(this.Player) * this.Weights[(int)Values.openingPointValue]);

            if (card.GetVictoryPoints(this.Player) >= 6)
            {
                // Essentially infinite value.
                openingValue += 30;
            }

            if (card is Bureaucrat)
            {
                openingValue += Lerp(0, this.Weights[(int)Values.bureaucratValue], 5, 20, coinCount, true);
            }

            if (card is Moat)
            {
                openingValue += this.Weights[(int)Values.moatValue];
            }

            endgameValue += card.GetVictoryPoints(this.Player) * card.GetVictoryPoints(this.Player) * card.GetVictoryPoints(this.Player) * this.Weights[(int)Values.endgamePointValue];
            endgameValue += this.GameModel.GetCoins(card) * this.GameModel.GetCoins(card) * this.Weights[(int)Values.endgameCoinValue];

            return (1.0 - gamePhase) * openingValue + gamePhase * endgameValue;
        }