public override void Play(Player player) { base.Play(player); Choice choiceCard = new Choice("Reveal a card from your hand to return up to 2 to the Supply.", this, player.Hand, player); ChoiceResult resultCard = player.MakeChoice(choiceCard); if (resultCard.Cards.Count > 0) { Card revealedCard = resultCard.Cards[0]; player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, revealedCard)); player.AddCardInto(DeckLocation.Hand, player.RetrieveCardFrom(DeckLocation.Revealed, revealedCard)); Supply supply = player._Game.Table.FindSupplyPileByCard(revealedCard); if (supply != null) { List<String> options = new List<string>() { "0", "1" }; if (player.Hand[revealedCard.CardType].Count > 1) options.Add("2"); Choice choice = new Choice("How many would you like to return to the Supply?", this, new CardCollection() { revealedCard }, options, player); ChoiceResult result = player.MakeChoice(choice); int numberToReturn = int.Parse(result.Options[0]); if (numberToReturn > 0) { CardCollection cardsToReturn = player.RetrieveCardsFrom(DeckLocation.Hand, revealedCard.CardType, numberToReturn); player.Lose(cardsToReturn); supply.AddTo(cardsToReturn); } player._Game.SendMessage(player, this, supply, numberToReturn); } IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player); enumerator.MoveNext(); while (enumerator.MoveNext()) { Player attackee = enumerator.Current; // Skip if the attack is blocked (Moat, Lighthouse, etc.) if (this.IsAttackBlocked[attackee]) continue; if (supply != null && supply.CanGain() && supply.TopCard.Name == revealedCard.Name) attackee.Gain(supply); } } }
public override void Play(Player player) { base.Play(player); // We're looking for 2 non-Golem Action cards player.BeginDrawing(); while (player.Revealed[Category.Action].Count(c => c.CardType != Cards.Alchemy.TypeClass.Golem) < 2 && player.CanDraw) player.Draw(DeckLocation.Revealed); player.EndDrawing(); player.Revealed.BeginChanges(); CardCollection actions = player.Revealed[c => (c.Category & Category.Action) == Category.Action && c.CardType != Cards.Alchemy.TypeClass.Golem]; player.DiscardRevealed(c => !actions.Contains(c)); player.Revealed.EndChanges(); CardCollection cardsToPlay = player.RetrieveCardsFrom(DeckLocation.Revealed); Choice choice = new Choice("Which card would you like to play first?", this, actions, player); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { actions.Remove(result.Cards[0]); // Play the first (selected) one player.AddCardInto(DeckLocation.Private, result.Cards[0]); player.Actions++; player.PlayCardInternal(result.Cards[0], "first"); } else player.PlayNothing("first"); if (actions.Count > 0) { // Play the other one player.AddCardInto(DeckLocation.Private, actions[0]); player.Actions++; player.PlayCardInternal(actions[0], "second"); } else player.PlayNothing("second"); }
public override void Play(Player player) { base.Play(player); if (player.InPlay.Contains(this.PhysicalCard)) { Choice choice = Choice.CreateYesNoChoice("Do you want to set this card aside?", this, player); ChoiceResult result = player.MakeChoice(choice); if (result.Options[0] == "Yes") { player.AddCardInto(TypeClass.PrinceSetAside, player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard)); if (_TurnStartedEventHandler != null) player.TurnStarted -= _TurnStartedEventHandler; _TurnStartedPlayer = player; _TurnStartedEventHandler = new Player.TurnStartedEventHandler(player_TurnStarted); _TurnStartedPlayer.TurnStarted += _TurnStartedEventHandler; Choice setAsideChoice = new Choice("Choose a card to set aside", this, player.Hand[c => (c.Category & Cards.Category.Action) == Cards.Category.Action && player._Game.ComputeCost(c) <= new Coin(4)], player, false, 1, 1); ChoiceResult setAsideResult = player.MakeChoice(setAsideChoice); if (setAsideResult.Cards.Count > 0) { _SetAsideCard = player.RetrieveCardFrom(DeckLocation.Hand, setAsideResult.Cards[0]); player.PlayerMats[TypeClass.PrinceSetAside].Refresh(player); player._Game.SendMessage(player, this, this._SetAsideCard); } } } }
internal void player_RevealMoat(Player player, ref AttackedEventArgs e) { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard)); e.Cancelled = true; player.AddCardInto(DeckLocation.Hand, player.RetrieveCardFrom(DeckLocation.Revealed, this.PhysicalCard)); e.HandledBy.Add(TypeClass.Moat); }
public override void Play(Player player) { base.Play(player); while (player.Hand.Count < 7 && player.CanDraw) { Card card = player.Draw(DeckLocation.Private); if ((card.Category & Category.Action) == Category.Action) { Choice choice = Choice.CreateYesNoChoice(String.Format("Would you like to set aside {0}?", card.Name), this, card, player, null); ChoiceResult result = player.MakeChoice(choice); if (result.Options[0] == "Yes") { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Private, card)); } else if (result.Options[0] == "No") { player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Private, card)); } } else { player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Private, card)); } } player.DiscardRevealed(); }
internal void player_FoolsGold(Player player, ref Players.CardGainEventArgs e) { if (player.Hand.Contains(this.PhysicalCard)) { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard)); player.Trash(player.RetrieveCardFrom(DeckLocation.Revealed, this.PhysicalCard)); player.Gain(player._Game.Table.Gold, DeckLocation.Deck, DeckPosition.Top); e.HandledBy.Add(TypeClass.FoolsGold); } }
internal void player_DiscardTunnel(Player player, ref CardsDiscardEventArgs e) { player.AddCardInto(DeckLocation.Revealed, this); player.RetrieveCardFrom(DeckLocation.Revealed, this); player.Gain(player._Game.Table.Gold); e.HandledBy.Add(this); }
internal void player_RevealTrader(Player player, ref Players.CardGainEventArgs e) { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, this)); player.AddCardInto(DeckLocation.Hand, player.RetrieveCardFrom(DeckLocation.Revealed, this)); // Cancel the gain, add the card back to the Supply pile, and then Gain a Silver instead. e.Cancelled = true; e.IsLostTrackOf = true; //player._Game.Table.Supplies[e.Card].AddTo(e.Card); player._Game.SendMessage(player, this, e.Card, player._Game.Table.Silver); player.Gain(player._Game.Table.Silver); }
internal void player_RevealHorseTraders(Player player, ref AttackedEventArgs e) { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard)); player.AddCardInto(DeckLocation.SetAside, player.RetrieveCardFrom(DeckLocation.Revealed, this.PhysicalCard)); // Attack isn't cancelled... it's just mitigated e.HandledBy.Add(TypeClass.HorseTraders); }
public override void Play(Player player) { base.Play(player); if (player.Hand[Category.Treasure].Count > 0) { Choice choice = new Choice("You may reveal a Treasure card to gain a copy of it.", this, player.Hand[Category.Treasure], player, false, 0, 1); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0])); player.AddCardInto(DeckLocation.Hand, player.RetrieveCardFrom(DeckLocation.Revealed, result.Cards[0])); Supply supply = player._Game.Table.FindSupplyPileByCard(result.Cards[0]); if (supply != null && supply.TopCard != null && supply.TopCard.Name == result.Cards[0].Name) player.Gain(supply); } } }
internal void player_RevealWatchtower(Player player, ref Players.CardGainEventArgs e) { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard)); player.AddCardInto(DeckLocation.Hand, player.RetrieveCardFrom(DeckLocation.Revealed, this.PhysicalCard)); Choice trashChoice = new Choice(String.Format("Trash {0} or put it on top of your deck?", e.Card), this, new CardCollection() { e.Card }, new List<String>() { "Trash", "Put on Deck" }, player); ChoiceResult trashResult = player.MakeChoice(trashChoice); if (trashResult.Options[0] == "Trash") { e.Cancelled = true; Card card = player.RetrieveCardFrom(e.Location, e.Card); if (card != null) player.Trash(e.Card); e.IsLostTrackOf = true; } else { e.Cancelled = true; if (e.Location != DeckLocation.Deck && e.Position != DeckPosition.Top) { Card c = player.RetrieveCardFrom(e.Location, e.Card); e.Location = DeckLocation.Deck; e.Position = DeckPosition.Top; } } e.HandledBy.Add(TypeClass.Watchtower); }
public override void Play(Player player) { base.Play(player); if (player.CanDraw) { Card card = player.Draw(DeckLocation.Revealed); if ((card.Category & Cards.Category.Action) == Cards.Category.Action) { player.Actions++; PlayerMode previousPlayerMode = player.PutCardIntoPlay(card, String.Empty); Card logicalCard = card.LogicalCard; player.PlayCard(logicalCard, previousPlayerMode); } else { player.AddCardInto(DeckLocation.Deck, player.RetrieveCardFrom(DeckLocation.Revealed, card), DeckPosition.Top); } } }
internal void player_RevealSecretChamber(Player player, ref AttackedEventArgs e) { player.AddCardInto(DeckLocation.Revealed, player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard)); player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Revealed, this.PhysicalCard)); player.Draw(2, DeckLocation.Hand); Choice replaceChoice = new Choice("Choose order of cards to put back on your deck", this, new CardCollection() { e.AttackCard }, player.Hand, player, true, 2, 2); ChoiceResult replaceResult = player.MakeChoice(replaceChoice); player.RetrieveCardsFrom(DeckLocation.Hand, replaceResult.Cards); player.AddCardsToDeck(replaceResult.Cards, DeckPosition.Top); e.HandledBy.Add(TypeClass.SecretChamber); // Attack isn't cancelled... it's just mitigated }
public override void Play(Player player) { base.Play(player); if (player.InPlay.Contains(this.PhysicalCard)) player.AddCardInto(TypeClass.IslandMat, player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard)); Choice choice = new Choice("Which card would you like to put on your island?", this, player.Hand, player); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { player.AddCardInto(TypeClass.IslandMat, player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0])); } }
public override void Play(Player player) { base.Play(player); Boolean provinceRevealed = false; if (player.Hand[Cards.Universal.TypeClass.Province].Count > 0) { Choice choice = Choice.CreateYesNoChoice("You may reveal a Province card to gain a Gold in your hand. Otherwise, gain a Silver in your hand. Do you want to reveal?", this, player); ChoiceResult result = player.MakeChoice(choice); if (result.Options.Contains("Yes")) { CardCollection singleProvince = player.RetrieveCardsFrom(DeckLocation.Hand, Cards.Universal.TypeClass.Province, 1); player.AddCardInto(DeckLocation.Revealed, singleProvince[0]); provinceRevealed = true; player.Gain(player._Game.Table.Gold, DeckLocation.Hand, DeckPosition.Bottom); player.AddCardsToHand(DeckLocation.Revealed); } } if (!provinceRevealed) player.Gain(player._Game.Table.Silver, DeckLocation.Hand, DeckPosition.Bottom); }