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); } }
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); } }
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); } } }
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); } } }
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); } } }
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; } }
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); } } }
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); } } }
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(); } } }
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); } }
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); } } }
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); } }
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); } }
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); } }
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); } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { Player currentPlayer = gameModel.CurrentPlayer; foreach(Player player in attackedPlayers) { CardModel trashedCard = player.DrawCard(); if (trashedCard != null) { int cost = gameModel.GetCost(trashedCard); player.Trash(trashedCard); Pile pile = currentPlayer.Chooser.ChooseOnePile(CardChoiceType.ForceGain, "Pick a card for " + player.Name + " to gain", gameModel.SupplyPiles.Where(p => p.Count > 0 && gameModel.GetCost(p) == cost && p.CostsPotion == trashedCard.CostsPotion)); if (pile != null) { player.GainCard(pile); } } } }
public override void Play(GameModel gameModel) { IEnumerable<CardModel> cardsInTrash = gameModel.Trash.Where(c => gameModel.GetCost(c) >= 3 && gameModel.GetCost(c) <= 6 && !c.CostsPotion); IEnumerable<CardModel> cardsInHand = gameModel.CurrentPlayer.Hand.Where(c => c.Is(CardType.Action)); bool gainFromTrash = false; if (cardsInHand.Any() && cardsInTrash.Any()) { int choice = gameModel.CurrentPlayer.Chooser.ChooseOneEffect(EffectChoiceType.Graverobber, "Choose one", choices, choiceText); gainFromTrash = choice == 1; } else if(cardsInHand.Any() && !cardsInTrash.Any()) { gainFromTrash = false; } else if (!cardsInHand.Any() && cardsInTrash.Any()) { gainFromTrash = true; } else { return; } if (gainFromTrash) { CardModel choice = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.GainOnTopOfDeck, "Gain a card from the trash costing between $3 and $6", Chooser.ChoiceSource.FromTrash, cardsInTrash); gameModel.Trash.Remove(choice); gameModel.CurrentPlayer.GainCard(choice, null, GainLocation.TopOfDeck); } else { CardModel choice = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForGraverobber, "Trash an action from your hand", Chooser.ChoiceSource.FromHand, cardsInHand.Where(c => c.Is(CardType.Action))); gameModel.CurrentPlayer.Trash(choice); IEnumerable<Pile> piles = gameModel.SupplyPiles.Where(p => p.Count > 0 && p.GetCost() <= gameModel.GetCost(choice) + 3 && (!p.CostsPotion || choice.CostsPotion)); Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing up to $" + (gameModel.GetCost(choice) + 3).ToString(), piles); if (pile != null) { gameModel.CurrentPlayer.GainCard(pile); } } }
public override void Play(GameModel gameModel) { CardModel choice = gameModel.CurrentPlayer.Chooser.ChooseZeroOrOneCard(CardChoiceType.Procession, "You may play an action card from your hand twice.", Chooser.ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand.Where(c => c.Is(CardType.Action))); if (choice != null) { using (choice.ForceMultipleCardPlayChoice()) { gameModel.CurrentPlayer.Play(choice, false, true); gameModel.CurrentPlayer.Play(choice, false, false, " a second time"); } if (gameModel.CurrentPlayer.Played.Contains(choice)) { gameModel.CurrentPlayer.Trash(choice); } Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain an action card costing $" + (gameModel.GetCost(choice) + 1).ToString(), gameModel.SupplyPiles.Where(p => p.Count > 0 && p.GetCost() == gameModel.GetCost(choice) + 1 && p.CostsPotion == choice.CostsPotion && p.Card.Is(CardType.Action))); if (pile != null) { gameModel.CurrentPlayer.GainCard(pile); } } }
public override void Play(GameModel gameModel) { CardModel card = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForStonemason, "Trash a card from your hand.", ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand); if (card != null) { gameModel.CurrentPlayer.Trash(card); for (int i = 0; i < 2; i++) { Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a card costing less than $" + gameModel.GetCost(card), gameModel.SupplyPiles.Where( p => p.Count > 0 && (p.GetCost() < gameModel.GetCost(card) && (!p.CostsPotion || p.CostsPotion && card.CostsPotion) || (p.GetCost() == gameModel.GetCost(card) && !p.CostsPotion && card.CostsPotion)))); if (pile != null) { gameModel.CurrentPlayer.GainCard(pile); } } } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { Player currentPlayer = gameModel.CurrentPlayer; foreach (Player player in attackedPlayers) { List<CardModel> setAside = new List<CardModel>(); CardModel card = player.DrawCard(); while (card != null) { gameModel.TextLog.WriteLine(player.Name + " reveals " + card.Name); if (gameModel.GetCost(card) >= 3) { break; } else { setAside.Add(card); } card = player.DrawCard(); } if (card != null) { player.Trash(card); Pile choice = player.Chooser.ChooseZeroOrOnePile(CardChoiceType.Gain, "You may gain a card costing up to $" + (gameModel.GetCost(card) - 2).ToString(), gameModel.SupplyPiles.Where(p => gameModel.GetCost(p) <= gameModel.GetCost(card) - 2 && (card.CostsPotion || !p.CostsPotion) && p.Count > 0)); if (choice != null) { player.GainCard(choice); } } foreach (CardModel temp in setAside) { player.DiscardCard(temp); } } }
public override void Play(GameModel gameModel) { int value = gameModel.CurrentPlayer.Played.Select(card => card.Name).Distinct().Count(); Pile choice = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.GainForHornOfPlenty, "Gain a card costing up to $" + value.ToString(), gameModel.SupplyPiles.Where(pile => gameModel.GetCost(pile) <= value && !pile.CostsPotion && pile.Count > 0)); if (choice != null) { CardModel card = gameModel.CurrentPlayer.GainCard(choice); if (card != null && card.Is(CardType.Victory)) { gameModel.CurrentPlayer.Trash(this); } } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { if (gameModel.CurrentPlayer.JourneyTokenIsFaceUp) { foreach (Player player in attackedPlayers) { CardModel card = player.DrawCards(1).FirstOrDefault(); if(card != null) { if (gameModel.GetCost(card) >= 3 && gameModel.GetCost(card) <= 6 && !card.CostsPotion) { player.Trash(card); } else { player.DiscardCard(card); player.GainCard(typeof(Curse)); } } } } }
public override void Play(GameModel gameModel) { if (gameModel.CurrentPlayer.Hand.Count > 0) { CardModel choice = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.TrashForTrader, "Trash a card", ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand); int cost = gameModel.GetCost(choice); gameModel.CurrentPlayer.Trash(choice); for (int i = 0; i < cost; i++) { gameModel.CurrentPlayer.GainCard(typeof(Silver)); } } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { if (!this.foundTrash) { 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.Trash, "Choose a card to trash", Chooser.ChoiceSource.None, eligible); if (choice != null) { player.Trash(choice); } foreach (CardModel card in cards) { if (card != choice) { player.DiscardCard(card); } } } } }
public override void Play(GameModel gameModel) { CardModel choice = gameModel.CurrentPlayer.Chooser.ChooseOneCard(CardChoiceType.NameACardForRebuild, "Name a card", Chooser.ChoiceSource.None, gameModel.AllCardsInGame.Where(c => c.Is(CardType.Victory)).Union(new CardModel[] { new Copper() })); CardModel found = null; List<CardModel> setAside = new List<CardModel>(); do { CardModel card = gameModel.CurrentPlayer.DrawCard(); if (card != null && card.Is(CardType.Victory) && card.Name != choice.Name) { found = card; } else { if (card == null) { break; } setAside.Add(card); } } while (found == null); foreach (CardModel card in setAside) { gameModel.CurrentPlayer.DiscardCard(card); } if (found != null) { gameModel.CurrentPlayer.Trash(found); Pile pile = gameModel.CurrentPlayer.Chooser.ChooseOnePile(CardChoiceType.Gain, "Gain a Victory card costing up to $" + (gameModel.GetCost(found) + 3).ToString() + (found.CostsPotion ? "P" : ""), gameModel.SupplyPiles.Where(p => p.Count > 0 && p.TopCard.Is(CardType.Victory) && p.GetCost() <= gameModel.GetCost(found) + 3 && (!p.CostsPotion || found.CostsPotion))); if (pile != null) { gameModel.CurrentPlayer.GainCard(pile); } } }
public override void Play(GameModel gameModel) { Player player = gameModel.CurrentPlayer; CardModel choice = player.Chooser.ChooseOneCard(CardChoiceType.TrashForApprentice, "Trash a card", Chooser.ChoiceSource.FromHand, player.Hand); if (choice != null) { int cost = gameModel.GetCost(choice); if (choice.CostsPotion) { cost += 2; } player.Trash(choice); player.Draw(cost); } }
public override void OnBuy(GameModel gameModel) { if(gameModel.CurrentPlayer.Bought.Count == 0) { 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); foreach(Player otherPlayer in gameModel.Players) { if(otherPlayer != gameModel.CurrentPlayer) { otherPlayer.GainCard(chosenPile); } } } } }
public override void PlayAttack(GameModel gameModel, IEnumerable<Player> attackedPlayers) { for (int i = 0; i < gameModel.CurrentPlayer.Played.Count(c => c.Is(CardType.Traveller)) + 1; i++) { foreach (Player player in attackedPlayers) { CardModel topCard = player.DrawCard(); int cost = gameModel.GetCost(topCard); if ((cost == 3 || cost == 4) && !topCard.CostsPotion) { player.Trash(topCard); } else { player.DiscardCard(topCard); } } } }
public override void Play(GameModel gameModel) { IEnumerable<CardModel> sources = gameModel.CurrentPlayer.Hand.Union(new CardModel[] {this}); CardModel card = gameModel.CurrentPlayer.Chooser.ChooseOneCard(Chooser.CardChoiceType.Raze, "Trash this or a card from your hand", Chooser.ChoiceSource.FromHand, sources); if (card != null) { gameModel.CurrentPlayer.Trash(card.ThisAsTrashTarget); int cost = gameModel.GetCost(card); IList<CardModel> lookAt = gameModel.CurrentPlayer.DrawCards(cost); CardModel put = gameModel.CurrentPlayer.Chooser.ChooseOneCard(Chooser.CardChoiceType.PutInHand, "Put one into your hand and discard the rest", Chooser.ChoiceSource.None, lookAt); if(put != null) { lookAt.Remove(put); gameModel.CurrentPlayer.PutInHand(put); foreach (CardModel discard in lookAt) { gameModel.CurrentPlayer.DiscardCard(discard); } } } }
public override void Play(GameModel gameModel) { int choice = gameModel.CurrentPlayer.Chooser.ChooseOneEffect(Chooser.EffectChoiceType.Prince, "You may set aside Prince", setAside, setAside); if (choice == 0) { bool didSetAside = gameModel.CurrentPlayer.Played.Remove(this); if (didSetAside) { gameModel.CurrentPlayer.SetAsidePrince.Add(this); CardModel card = gameModel.CurrentPlayer.Chooser.ChooseOneCard(Chooser.CardChoiceType.Prince, "Choose a card to set aside for Prince", Chooser.ChoiceSource.FromHand, gameModel.CurrentPlayer.Hand.Where(c => c.Is(CardType.Action) && gameModel.GetCost(c) <= 4 && !c.CostsPotion)); if (card != null) { gameModel.TextLog.WriteLine(gameModel.CurrentPlayer.Name + " sets aside " + card.Name); gameModel.CurrentPlayer.Hand.Remove(card); gameModel.CurrentPlayer.SetAsidePrincePlay.Add(card); card.PlayedWithPrinceSource = this; } } } base.Play(gameModel); }