public GetPile ( Dominion.Card cardType ) : |
||
cardType | Dominion.Card | |
Résultat |
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 override void EndGame(GameState gameState) { lock (this.factory.theLock) { if (gameState.GetPile(Cards.Curse).Any) return; int player1Count = CountCurses(gameState, 0); int player2Count = CountCurses(gameState, 1); if (player1Count > player2Count) this.factory.player1Win++; if (player2Count > player1Count) this.factory.player2Win++; this.factory.totalGameCount++; } if (gameState.WinningPlayers.Count() > 1) { int playerIndex = gameState.WinningPlayers[0].PlayerIndex; //winningPlayerWas25++; } }
internal void ReturnCardToSupply(Card cardToReturn, GameState gameState) { this.gameLog.PlayerReturnedCardToPile(this, cardToReturn); PileOfCards pile = gameState.GetPile(cardToReturn); if (pile == null) throw new Exception("Could not find supply pile"); pile.AddCardToTop(cardToReturn); }
internal PileOfCards RequestPlayerEmbargoPileFromSupply(GameState gameState) { Card cardType = this.actions.GetCardFromSupplyToEmbargo(gameState); PileOfCards pile = gameState.GetPile(cardType); if (pile == null) { throw new Exception("Must choose pile from supply"); } return pile; }
internal bool RequestPlayerDiscardCardFromHand(GameState gameState, CardPredicate acceptableCardsToDiscard, bool isOptional) { if (!this.hand.HasCard(acceptableCardsToDiscard)) { return false; } Card cardTypeToDiscard = this.actions.GetCardFromHandToDiscard(gameState, acceptableCardsToDiscard, isOptional); if (cardTypeToDiscard == null) { if (isOptional) { return false; } else { throw new Exception("Player must choose a card to discard"); } } else { if (gameState.GetPile(cardTypeToDiscard) != null && // TODO: this currently can not find ruins ... rework this method so a card is returned instead of a type. !acceptableCardsToDiscard( cardTypeToDiscard)) throw new Exception("Card does not meet constraint: "); } this.MoveCardFromHandToDiscard(cardTypeToDiscard, gameState); return true; }
public static int CountOfPile(Card cardType, GameState gameState) { if (!gameState.CardGameSubset.HasCard(cardType)) return 0; return gameState.GetPile(cardType).Count; }
internal bool MoveCardFromPlayToPile(GameState gameState) { bool wasReturned = false; Card cardInPlay = this.cardsBeingPlayed.DrawCardFromTop(); if (cardInPlay != null) { PileOfCards pile = gameState.GetPile(cardInPlay); pile.AddCardToTop(cardInPlay); wasReturned = true; this.gameLog.PlayerReturnedCardToPile(this, cardInPlay); } this.cardsBeingPlayed.AddCardToTop(null); return wasReturned; }
public static int CountOfPile(Card cardType, GameState gameState) { return gameState.GetPile(cardType).Count; }