本文整理汇总了C#中GameModel.GetCost方法的典型用法代码示例。如果您正苦于以下问题:C# GameModel.GetCost方法的具体用法?C# GameModel.GetCost怎么用?C# GameModel.GetCost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameModel
的用法示例。
在下文中一共展示了GameModel.GetCost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayAttack
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers)
{
bool hitKnight = false;
foreach (Player player in attackedPlayers)
{
IEnumerable<CardModel> cards = player.DrawCards(2);
IEnumerable<CardModel> eligible = cards.Where(c => gameModel.GetCost(c) >= 3 && gameModel.GetCost(c) <= 6 && !c.CostsPotion);
CardModel choice = player.Chooser.ChooseOneCard(CardChoiceType.TrashForKnight, "Choose a card to trash", Chooser.ChoiceSource.None, eligible);
if (choice != null)
{
player.Trash(choice);
if (choice.Is(CardType.Knight))
{
hitKnight = true;
}
}
foreach (CardModel card in cards)
{
if (card != choice)
{
player.DiscardCard(card);
}
}
}
if (hitKnight)
{
gameModel.CurrentPlayer.Trash(this.ThisAsTrashTarget);
}
}
示例2: OnTrash
public override void OnTrash(GameModel gameModel, Player owner)
{
IEnumerable<Pile> piles = gameModel.SupplyPiles.Where(p => (p.GetCost() < gameModel.GetCost(this) && (!p.CostsPotion || this.CostsPotion)) || p.GetCost() == gameModel.GetCost(this) && !p.CostsPotion && this.CostsPotion);
if(piles.Any())
{
Pile choice = owner.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing less than $" + gameModel.GetCost(this), piles);
owner.GainCard(choice);
}
}
示例3: PlayPostAttack
public override void PlayPostAttack(GameModel gameModel)
{
if (this.choice != null)
{
Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.GainOnTopOfDeck, "Gain a treasure costing up to $" + (gameModel.GetCost(this.choice) + 3).ToString() + (this.choice.CostsPotion ? "P" : ""), gameModel.SupplyPiles.Where(p => p.Count > 0 && p.Card.Is(CardType.Treasure) && p.GetCost() <= gameModel.GetCost(this.choice) + 3 && (!p.CostsPotion || this.choice.CostsPotion)));
if (pile != null)
{
gameModel.CurrentPlayer.GainCard(pile, GainLocation.TopOfDeck);
}
}
}
示例4: OnBuy
public override void OnBuy(GameModel gameModel)
{
if (gameModel.CurrentPlayer.Hand.Count > 0)
{
CardModel choice = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForFarmland, "Trash a card", ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand);
gameModel.CurrentPlayer.Trash(choice);
IEnumerable<Pile> piles = gameModel.SupplyPiles.Where(pile => gameModel.GetCost(pile) == gameModel.GetCost(choice) + 2 && choice.CostsPotion == pile.CostsPotion && pile.Count > 0);
if (piles.Any())
{
Pile chosenPile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing $" + (gameModel.GetCost(choice) + 2), piles);
gameModel.CurrentPlayer.GainCard(chosenPile);
}
}
}
示例5: Play
public override void Play(GameModel gameModel)
{
CardModel trashedCard = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForExpand, "Choose a card to trash with Expand", ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand);
if (trashedCard != null)
{
gameModel.CurrentPlayer.Trash(trashedCard);
Pile newChoice = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing up to $" + (gameModel.GetCost(trashedCard) + 3).ToString(),
gameModel.SupplyPiles.Where(pile => gameModel.GetCost(pile) <= gameModel.GetCost(trashedCard) + 3 && pile.Count > 0 && (trashedCard.CostsPotion || !pile.CostsPotion)));
if (newChoice != null)
{
gameModel.CurrentPlayer.GainCard(newChoice);
}
}
}
示例6: Play
public override void Play(GameModel gameModel)
{
IEnumerable<CardModel> trash = gameModel.Trash.Where(c => gameModel.GetCost(c) >= 3 && gameModel.GetCost(c) <= 6 && !c.CostsPotion);
if (trash.Any())
{
this.foundTrash = true;
CardModel card = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.Gain, "Gain a card costing between $3 and $6 from the trash.", Chooser.ChoiceSource.FromTrash, trash);
gameModel.CurrentPlayer.GainCard(card, null);
gameModel.Trash.Remove(card);
}
else
{
this.foundTrash = false;
}
}
示例7: DoRemake
private void DoRemake(GameModel gameModel)
{
CardModel trashedCard = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForRemake, "Trash a card", ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand);
if (trashedCard != null)
{
gameModel.CurrentPlayer.Trash(trashedCard);
Pile newChoice = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing $" + (gameModel.GetCost(trashedCard) + 1).ToString(), gameModel.SupplyPiles.Where(pile =>
gameModel.GetCost(pile) == gameModel.GetCost(trashedCard) + 1 && pile.Count > 0 &&
(trashedCard.CostsPotion == pile.CostsPotion)));
if (newChoice != null)
{
gameModel.CurrentPlayer.GainCard(newChoice);
}
}
}
示例8: Play
public override void Play(GameModel gameModel)
{
CardModel trashedCard = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForRemodel, "Choose a card to Remodel", ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand);
if (trashedCard != null)
{
gameModel.CurrentPlayer.Trash(trashedCard);
Pile newChoice = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Choose a card to gain", gameModel.SupplyPiles.Where(pile =>
gameModel.GetCost(pile) <= gameModel.GetCost(trashedCard) + 2 && pile.Count > 0 &&
(trashedCard.CostsPotion || !pile.CostsPotion)));
if (newChoice != null)
{
gameModel.CurrentPlayer.GainCard(newChoice);
}
}
}
示例9: BeforePlay
public override void BeforePlay(GameModel gameModel)
{
if (this.mimic == null)
{
CardModel target = null;
if (this.forceMimic != null)
{
target = this.forceMimic;
}
else
{
Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.BandOfMisfits, "Play Band of Misfits as...", gameModel.SupplyPiles.Where(p => p.GetCost() < gameModel.GetCost(this) && !p.CostsPotion && p.Count > 0 && p.Card.Is(CardType.Action)));
if (pile != null)
{
target = (CardModel)Activator.CreateInstance(pile.TopCard.GetType());
}
}
if (target != null)
{
this.mimic = target;
if (this.lockCount > 0)
{
this.forceMimic = target;
}
this.SetMimic();
}
}
}
示例10: Play
public override void Play(GameModel gameModel)
{
IEnumerable<CardModel> trashedCards = gameModel.CurrentPlayer.Chooser.ChooseSeveralCards(CardChoiceType.TrashForForge, "Choose cards to trash", ChoiceSource.FromHand, 0, gameModel.CurrentPlayer.Hand.Count, gameModel.CurrentPlayer.Hand);
int cost = 0;
foreach (CardModel card in trashedCards.ToList())
{
gameModel.CurrentPlayer.Trash(card);
cost += gameModel.GetCost(card);
}
IEnumerable<Pile> piles = from pile in gameModel.SupplyPiles where gameModel.GetCost(pile) == cost && pile.Count > 0 && !pile.CostsPotion select pile;
Pile newChoice = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing " + cost, piles);
if (newChoice != null)
{
gameModel.CurrentPlayer.GainCard(newChoice);
}
}
示例11: Play
public override void Play(GameModel gameModel)
{
IEnumerable<CardModel> treasures = gameModel.CurrentPlayer.Hand.Where(card => card.Is(CardType.Treasure));
Player currentPlayer = gameModel.CurrentPlayer;
if (treasures.Any())
{
CardModel chosenCard = currentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForMine, "Trash a treasure from your hand", ChoiceSource.FromHand, treasures);
currentPlayer.Trash(chosenCard);
Pile newCardPile = currentPlayer.Chooser.ChooseOnePile(CardChoiceType.GainInHand, "Gain a treasure costing up to $" + (gameModel.GetCost(chosenCard) + 3).ToString(),
gameModel.SupplyPiles.Where(pile => pile.Card.Is(CardType.Treasure) && gameModel.GetCost(pile) <= gameModel.GetCost(chosenCard) + 3 &&
(chosenCard.CostsPotion || !pile.CostsPotion)));
if (newCardPile != null)
{
currentPlayer.GainCard(newCardPile, GainLocation.InHand);
}
}
}
示例12: Play
public override void Play(GameModel gameModel)
{
Pile choice = gameModel.CurrentPlayer.Chooser.ChooseZeroOrOnePile(CardChoiceType.Gain, "You may gain an action costing up to $5", gameModel.SupplyPiles.Where(
pile => gameModel.GetCost(pile) <= 5 && pile.Count > 0 && !pile.CostsPotion && pile.Card.Is(CardType.Action)));
if (choice != null)
{
gameModel.CurrentPlayer.GainCard(choice);
}
}
示例13: Play
public override void Play(GameModel gameModel)
{
IEnumerable<Pile> piles = gameModel.SupplyPiles.Where(pile => pile.Count > 0 && gameModel.GetCost(pile) <= 4 && !pile.CostsPotion);
Pile chosenPile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing up to $4", piles);
if (chosenPile != null)
{
gameModel.CurrentPlayer.GainCard(chosenPile);
}
}
示例14: Play
public override void Play(GameModel gameModel)
{
CardModel card = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForSalvager, "Choose a card to trash with Salvager", ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand);
if (card != null)
{
gameModel.CurrentPlayer.AddActionCoin(gameModel.GetCost(card));
gameModel.CurrentPlayer.Trash(card);
}
}
示例15: Play
public override void Play(GameModel gameModel)
{
Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing $5 or less", gameModel.SupplyPiles.Where(p => gameModel.GetCost(p) <= 5 && !p.CostsPotion && p.Count > 0));
gameModel.CurrentPlayer.Trash(this);
if (pile != null)
{
gameModel.CurrentPlayer.GainCard(pile);
}
}