当前位置: 首页>>代码示例>>C#>>正文


C# GameModel.GetCost方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:29,代码来源:Knights.cs

示例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);
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:9,代码来源:Catacombs.cs

示例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);
         }
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:11,代码来源:Taxman.cs

示例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);
         }
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:14,代码来源:Farmland.cs

示例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);
                }
            }
        }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:15,代码来源:Expand.cs

示例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;
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:15,代码来源:Rogue.cs

示例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);
         }
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:15,代码来源:Remake.cs

示例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);
         }
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:15,代码来源:Remodel.cs

示例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();
         }
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:28,代码来源:BandOfMisfits.cs

示例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);
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:16,代码来源:Forge.cs

示例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);
         }
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:17,代码来源:Mine.cs

示例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);
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:9,代码来源:University.cs

示例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);
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:9,代码来源:Workshop.cs

示例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);
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:9,代码来源:Salvager.cs

示例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);
     }
 }
开发者ID:alanjg,项目名称:MajorDomo,代码行数:9,代码来源:Feast.cs


注:本文中的GameModel.GetCost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。