本文整理汇总了C#中Dominion.GameState类的典型用法代码示例。如果您正苦于以下问题:C# GameState类的具体用法?C# GameState怎么用?C# GameState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameState类属于Dominion命名空间,在下文中一共展示了GameState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoesHandHaveCombinationToTrash
private static bool DoesHandHaveCombinationToTrash(GameState gameState)
{
int countToTrash = CountInHandFrom(TrashOrder(), gameState);
int countInHand = gameState.Self.Hand.Count;
return (countInHand - countToTrash <= 2);
}
示例2: ShouldGainHermit
private static bool ShouldGainHermit(GameState gameState)
{
if (PlayBigHermit(gameState))
return CountHermitsEverGained(gameState) < 9 && CountAllOwned(Cards.MarketSquare, gameState) == 0;
return CountHermitsEverGained(gameState) < 7 && CountAllOwned(Cards.MarketSquare, gameState) == 0;
}
示例3: ShouldPlayRebuild
private static bool ShouldPlayRebuild(GameState gameState)
{
return !(gameState.players.CurrentPlayer.ExpectedCoinValueAtEndOfTurn >= 8 && CountOfPile(Cards.Province, gameState) == 1)
&& !(CountOfPile(Cards.Duchy, gameState) == 0
&& CountInDeckAndDiscard(Cards.Duchy, gameState) == 0 && PlayersPointLead(gameState) < 0)
&& CountOfPile(Cards.Province, gameState) > 0;
}
示例4: ShouldGainCopper
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);
}
示例5: GameStatePredicate
public bool GameStatePredicate(GameState gameState)
{
int countOfTheSource;
switch (countSource)
{
case CountSource.Pile:
countOfTheSource = Strategies.CountOfPile(this.cardType, gameState);
break;
case CountSource.AllOwned:
countOfTheSource = Strategies.CountAllOwned(this.cardType, gameState);
break;
case CountSource.InHand:
countOfTheSource = Strategies.CountInHand(this.cardType, gameState);
break;
case CountSource.None:
return true;
default:
throw new Exception("Unhandled source case");
}
switch (this.comparison)
{
case Comparison.GreaterThan:
{
return countOfTheSource > this.countThreshHold;
}
case Comparison.LessThan:
{
return countOfTheSource < this.countThreshHold;
}
default:
throw new Exception("Unhandled comparison case");
}
}
示例6: GetPreferredCardReverse
public Card GetPreferredCardReverse(GameState gameState, CardPredicate cardPredicate)
{
if (predicate(gameState))
return this.picker.GetPreferredCardReverse(gameState, cardPredicate);
return null;
}
示例7: EndGame
public override void EndGame(GameState gameState)
{
if (this.textWriter != null)
{
Write(this.textWriter, gameState.players.OriginalPlayerOrder);
}
}
示例8: GetCardFromHandToReveal
public override Card GetCardFromHandToReveal(GameState gameState, CardPredicate acceptableCard)
{
if (gameState.Self.Hand.HasCard(gameState.BaneCard))
return gameState.BaneCard;
return null;
}
示例9: AmountWillingtoOverPayFor
public int AmountWillingtoOverPayFor(Card card, GameState gameState)
{
if (predicate(gameState))
return this.picker.AmountWillingtoOverPayFor(card, gameState);
return 0;
}
示例10: ShouldPutCardOnTopOfDeck
public override bool ShouldPutCardOnTopOfDeck(Card card, GameState gameState)
{
if (this.playerAction.discardOrder.DoesCardPickerMatch(gameState, card))
return false;
return true;
}
示例11: ShouldPlayTrader
private static bool ShouldPlayTrader(GameState gameState)
{
if (gameState.Self.Hand.HasCard(Cards.Estate))
{
return !ShouldGainEstate(gameState);
}
if (gameState.Self.ExpectedCoinValueAtEndOfTurn >= 8)
return false;
/*
if (gameState.Self.Actions.ShouldGainCard(gameState, Cards.Duchy) && gameState.Self.ExpectedCoinValueAtEndOfTurn >= 5)
return false;
*/
if (gameState.Self.ExpectedCoinValueAtEndOfTurn <= 4)
return true;
/*
if (gameState.Self.Actions.ShouldGainCard(gameState, Cards.Province))
return false;*/
if (gameState.Self.ExpectedCoinValueAtEndOfTurn <= 3 && !gameState.Self.Hand.HasCard(Cards.Silver))
return false;
return true;
}
示例12: ChooseBetween
public override PlayerActionChoice ChooseBetween(GameState gameState, IsValidChoice acceptableChoice)
{
if (gameState.CurrentContext.CurrentCard == Cards.Governor)
return PlayerActionChoice.GainCard;
return base.ChooseBetween(gameState, acceptableChoice);
}
示例13: ShouldTrashPotion
private static bool ShouldTrashPotion(GameState gameState)
{
if (!gameState.Self.Actions.ShouldGainCard(gameState, Cards.ScryingPool))
return true;
return false;
}
示例14: DoSpecializedAction
public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
{
Card revealedCard = currentPlayer.RequestPlayerRevealCardFromHand(acceptableCard => true, gameState);
PlayerState.AttackAction attackAction = this.DoEmptyAttack;
if (revealedCard != null && !revealedCard.isShelter)
{
int maxReturnCount = Math.Max(currentPlayer.Hand.CountOf(revealedCard), 2);
int returnCount = currentPlayer.actions.GetCountToReturnToSupply(revealedCard, gameState);
returnCount = Math.Min(returnCount, maxReturnCount);
returnCount = Math.Max(returnCount, 0);
for (int i = 0; i < returnCount; ++i)
{
if (currentPlayer.hand.HasCard(revealedCard))
{
currentPlayer.ReturnCardFromHandToSupply(revealedCard, gameState);
}
}
attackAction = delegate(PlayerState currentPlayer2, PlayerState otherPlayer, GameState gameState2)
{
otherPlayer.GainCardFromSupply(gameState, revealedCard);
};
}
currentPlayer.AttackOtherPlayers(gameState, attackAction);
}
示例15: ShouldByLastCard
private static bool ShouldByLastCard(Card card, GameState gameState)
{
if (CountOfPile(card, gameState) != 1)
return true;
return CountOfPile(Cards.Province, gameState) == 1;
}