public override void Play(Player player) { base.Play(player); player.Gain(player._Game.Table.Silver, DeckLocation.Deck, DeckPosition.Top); // Perform attack on every player (including you) 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 (attackee.Hand[Category.Victory].Count == 0) { attackee.ReturnHand(attackee.RevealHand()); } else { Choice replaceChoice = new Choice("Choose a card to put back on your deck", this, attackee.Hand[Category.Victory], attackee); ChoiceResult replaceResult = attackee.MakeChoice(replaceChoice); if (replaceResult.Cards.Count > 0) { Card returnCard = attackee.RetrieveCardFrom(DeckLocation.Hand, replaceResult.Cards[0]); attackee.AddCardInto(DeckLocation.Revealed, returnCard); attackee.AddCardToDeck(attackee.RetrieveCardFrom(DeckLocation.Revealed, returnCard), DeckPosition.Top); } } } }
public override void Play(Player player) { base.Play(player); if (player.Hand[Cards.Universal.TypeClass.Estate].Count > 0) { Choice choice = Choice.CreateYesNoChoice("You may discard an Estate card for +<coin>4</coin>. Do you want to discard?", this, player); ChoiceResult result = player.MakeChoice(choice); if (result.Options.Contains("Yes")) { player.Discard(DeckLocation.Hand, Cards.Universal.TypeClass.Estate, 1); CardBenefit benefit = new CardBenefit(); benefit.Currency.Coin += 4; player.ReceiveBenefit(this, benefit); return; } } player.Gain(player._Game.Table.Estate); }
public override void Play(Player player) { base.Play(player); player.Gain(player._Game.Table.Copper, DeckLocation.Hand, DeckPosition.Automatic, 3); }
public override void Play(Player player) { _ShouldBeTrashed = false; base.Play(player); CardCollection nonTreasures = player.DiscardPile.LookThrough(c => (c.Category & Cards.Category.Treasure) != Cards.Category.Treasure); nonTreasures.Add(new Universal.Dummy()); nonTreasures.AddRange(player.Hand[c => (c.Category & Cards.Category.Treasure) != Cards.Category.Treasure]); if (nonTreasures.Count > 1) { Choice choiceTrash = new Choice("You may choose a non-Treasure card to trash", this, nonTreasures, player, false, 0, 1); ChoiceResult resultTrash = player.MakeChoice(choiceTrash); if (resultTrash.Cards.Count > 0) { Card cardToTrash = null; if (player.Hand.Contains(resultTrash.Cards[0])) cardToTrash = player.RetrieveCardFrom(DeckLocation.Hand, resultTrash.Cards[0]); else cardToTrash = player.RetrieveCardFrom(DeckLocation.Discard, resultTrash.Cards[0]); player.Trash(cardToTrash); } } SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= new Coin(3)); Choice choice = new Choice("Gain a card costing up to <coin>3</coin>", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); }
internal void player_RevealBeggar(Player player, ref AttackedEventArgs e) { player.Discard(DeckLocation.Hand, this.PhysicalCard); player.Gain(player._Game.Table.Silver, DeckLocation.Deck, DeckPosition.Top); player.Gain(player._Game.Table.Silver); e.HandledBy.Add(TypeClass.Beggar); // Attack isn't cancelled... it's just mitigated }
public override void Play(Player player) { base.Play(player); Choice choiceTrash = new Choice("Choose a card to trash", this, player.Hand, player); ChoiceResult resultTrash = player.MakeChoice(choiceTrash); player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); if (resultTrash.Cards.Count > 0) { Cost trashedCardCost = player._Game.ComputeCost(resultTrash.Cards[0]); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= (trashedCardCost + new Coin(2))); Choice choice = new Choice("Gain a card", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); } }
public override void Play(Player player) { base.Play(player); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= new Coin(4)); Choice choice = new Choice("Gain a card costing up to <coin>4</coin>", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); }
internal void player_GainCache(Player player, ref Players.CardGainEventArgs e) { player.Gain(player._Game.Table[TypeClass.RuinsSupply], 2); e.HandledBy.Add(TypeClass.DeathCart); // Clear out the Event Triggers -- this only happens when its Gained, so we don't care any more foreach (Player playerLoop in _CardGainedHandlers.Keys) playerLoop.CardGained -= _CardGainedHandlers[playerLoop]; _CardGainedHandlers.Clear(); }
public override void Play(Player player) { base.Play(player); Choice choiceTrash = new Choice("Choose a card to trash", this, player.Hand, player); ChoiceResult resultTrash = player.MakeChoice(choiceTrash); player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= new Coin(5)); Choice choice = new Choice("Gain a card costing up to <coin>5</coin>", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); }
public override void Play(Player player) { base.Play(player); player.Gain(player._Game.Table[TypeClass.Rats]); CardCollection nonRats = player.Hand[c => c.CardType != TypeClass.Rats]; if (nonRats.Count > 0) { Choice choiceTrash = new Choice("Choose a non-Rats card to trash", this, nonRats, player); ChoiceResult resultTrash = player.MakeChoice(choiceTrash); player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); } else { player.ReturnHand(player.RevealHand()); } }
public override void Play(Player player) { base.Play(player); SupplyCollection availableSupplies = new SupplyCollection(player._Game.Table.Supplies.Where(kvp => kvp.Value.Randomizer != null && kvp.Value.Randomizer.GroupMembership != Group.None)); CardCollection cards = new CardCollection(); Choice choice = new Choice("Name a card", this, availableSupplies, player, false); foreach (Supply supply in player._Game.Table.Supplies.Values.Union(player._Game.Table.SpecialPiles.Values)) { foreach (Type type in supply.CardTypes) { if (!choice.Supplies.Any(kvp => kvp.Value.CardType == type)) cards.Add(Card.CreateInstance(type)); } } choice.AddCards(cards); ChoiceResult result = player.MakeChoice(choice); ICard namedCard = null; if (result.Supply != null) namedCard = result.Supply; else namedCard = result.Cards[0]; player._Game.SendMessage(player, this, namedCard); Card foundCard = null; player.BeginDrawing(); while (player.CanDraw) { player.Draw(DeckLocation.Revealed); Card lastRevealed = player.Revealed.Last(); if ((lastRevealed.Category & Cards.Category.Victory) == Cards.Category.Victory && namedCard.Name != lastRevealed.Name) { foundCard = lastRevealed; break; } } player.EndDrawing(); if (foundCard != null) foundCard = player.RetrieveCardFrom(DeckLocation.Revealed, foundCard); player.DiscardRevealed(); if (foundCard != null) { player.Trash(foundCard); Cost trashedCardCost = player._Game.ComputeCost(foundCard); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && (supply.Category & Cards.Category.Victory) == Cards.Category.Victory && supply.CurrentCost <= (trashedCardCost + new Coin(3))); Choice choiceGain = new Choice("Gain a Victory card", this, gainableSupplies, player, false); ChoiceResult resultGain = player.MakeChoice(choiceGain); if (resultGain.Supply != null) player.Gain(resultGain.Supply); } }
public override void Play(Player player) { base.Play(player); if (player.InPlay.Contains(this.PhysicalCard)) player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard)); 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 (attackee.Hand.Count < 5) continue; attackee.RevealHand(); Choice choice = new Choice(String.Format("Choose a card for {0} to discard.", attackee), this, attackee.Revealed, attackee, false, 1, 1); ChoiceResult result = player.MakeChoice(choice); attackee.Discard(DeckLocation.Revealed, result.Cards); attackee.ReturnHand(attackee.Revealed[c => true]); } player.Gain(player._Game.Table.SpecialPiles[TypeClass.Spoils], 2); }
public override void Play(Player player) { this._CanCleanUp = true; base.Play(player); Choice choice = new Choice(String.Format("You may play an Action card twice", player), this, player.Hand[Cards.Category.Action], player, false, 0, 1); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { Card card = result.Cards[0]; card.ModifiedBy = this; player.Actions++; PlayerMode previousPlayerMode = player.PutCardIntoPlay(card, String.Empty); Card logicalCard = card.LogicalCard; player.PlayCard(card.LogicalCard, previousPlayerMode); player.Actions++; previousPlayerMode = player.PutCardIntoPlay(card, "again"); player.PlayCard(logicalCard, previousPlayerMode); this._CanCleanUp = logicalCard.CanCleanUp; if (player.InPlay.Contains(card)) player.Trash(DeckLocation.InPlay, card); Cost trashedCardCost = player._Game.ComputeCost(card); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && (supply.Category & Cards.Category.Action) == Cards.Category.Action && supply.CurrentCost == (trashedCardCost + new Coin(1))); Choice choiceGain = new Choice("Gain an Action card", this, gainableSupplies, player, false); ChoiceResult resultGain = player.MakeChoice(choiceGain); if (resultGain.Supply != null) player.Gain(resultGain.Supply); } else player.PlayNothing(); }
internal void player_DiscardMarketSquare(Player player, ref TrashEventArgs e) { player.Discard(DeckLocation.Hand, this); player.Gain(player._Game.Table.Gold); e.HandledBy.Add(this); }
public override void Play(Player player) { base.Play(player); player.Gain(player._Game.Table.SpecialPiles[TypeClass.Spoils]); 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; attackee.Gain(player._Game.Table[TypeClass.RuinsSupply]); } }
internal void player_PlusCard(Player player, ref TrashEventArgs e) { Choice choice = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "Gain a Duchy", "Gain 3 Estates" }, player); ChoiceResult result = player.MakeChoice(choice); if (result.Options.Contains("Gain a Duchy")) { player.Gain(player._Game.Table.Duchy); } else { player.Gain(player._Game.Table.Estate, 3); } e.HandledBy.Add(this); }
internal void player_PlusCard(Player player, ref TrashEventArgs e) { SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost < player._Game.ComputeCost(this)); Choice choice = new Choice(String.Format("Gain a card costing less than {0}", player._Game.ComputeCost(this).ToString()), this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); e.HandledBy.Add(this); }
public override void Play(Player player) { base.Play(player); List<Cost> availableCosts = new List<Cost>() { new Cost(3), new Cost(4), new Cost(5), new Cost(6) }; IEnumerable<Card> availableTrashCards = player._Game.Table.Trash.Where(c => availableCosts.Any(cost => player._Game.ComputeCost(c) == cost)); if (availableTrashCards.Count() > 0) { Choice choiceFromTrash = new Choice("Choose a card to gain from the trash", this, availableTrashCards, player); ChoiceResult resultFromTrash = player.MakeChoice(choiceFromTrash); if (resultFromTrash.Cards.Count > 0) { player.Gain(player._Game.Table.Trash, resultFromTrash.Cards[0]); } } else { 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; CardCollection attackeeCards = attackee.Draw(2, DeckLocation.Revealed); Choice choiceTrash = new Choice("Choose a card to trash", this, attackee.Revealed[c => availableCosts.Any(cost => player._Game.ComputeCost(c) == cost)], attackee); ChoiceResult resultTrash = attackee.MakeChoice(choiceTrash); attackee.Trash(attackee.RetrieveCardsFrom(DeckLocation.Revealed, resultTrash.Cards)); attackee.DiscardRevealed(); } } }
public override void Play(Player player) { base.Play(player); Choice choiceTheFirst = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "Discard 2 cards", "Put a card on your deck", "Gain a Copper" }, player); ChoiceResult resultTheFirst = player.MakeChoice(choiceTheFirst); if (resultTheFirst.Options.Contains("Discard 2 cards")) { Choice choiceDiscard = new Choice("Discard 2 cards.", this, player.Hand, player, false, 2, 2); ChoiceResult resultDiscard = player.MakeChoice(choiceDiscard); player.Discard(DeckLocation.Hand, resultDiscard.Cards); } else if (resultTheFirst.Options.Contains("Put a card on your deck")) { Choice replaceChoice = new Choice("Choose a card to put back on your deck", this, player.Hand, player, false, 1, 1); ChoiceResult replaceResult = player.MakeChoice(replaceChoice); player.RetrieveCardsFrom(DeckLocation.Hand, replaceResult.Cards); player.AddCardsToDeck(replaceResult.Cards, DeckPosition.Top); } else { player.Gain(player._Game.Table.Copper); } Choice choiceTheSecond = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "+<coin>3</coin>", "Trash your hand", "Gain a Duchy" }, player); ChoiceResult resultTheSecond = player.MakeChoice(choiceTheSecond); if (resultTheSecond.Options.Contains("+<coin>3</coin>")) { player.ReceiveBenefit(this, new CardBenefit() { Currency = new Currency(3) }); } else if (resultTheSecond.Options.Contains("Trash your hand")) { player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand)); } else { player.Gain(player._Game.Table.Duchy); } }
internal void player_GainGold(Player player, ref TrashEventArgs e) { player.Gain(player._Game.Table.Gold); e.HandledBy.Add(this); }
internal void player_Gain3Silvers(Player player, ref TrashEventArgs e) { player.Gain(player._Game.Table.Silver, 3); e.HandledBy.Add(this); }
internal void player_GainAttack(Player player, ref TrashEventArgs e) { SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll( supply => supply.CanGain() && ((supply.Category & Cards.Category.Attack) == Cards.Category.Attack)); Choice choice = new Choice("Gain an Attack card", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); e.HandledBy.Add(this); }
public override void Play(Player player) { base.Play(player); if (player.InPlay.Contains(this.PhysicalCard)) { player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard)); } SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= new Coin(5)); Choice choice = new Choice("Gain a card costing up to <coin>5</coin>", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); }
public override void Play(Player player) { Choice choice = new Choice("Trash a card.", this, player.Hand, player); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { Card trash = player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0]); player.Trash(trash); if ((trash.Category & Category.Action) == Category.Action) player.Gain(player._Game.Table.Duchy); if ((trash.Category & Category.Treasure) == Category.Treasure) player.Gain(player._Game.Table[Cards.Alchemy.TypeClass.Transmute]); if ((trash.Category & Category.Victory) == Category.Victory) player.Gain(player._Game.Table.Gold); } base.Play(player); }
public override void Play(Player player) { base.Play(player); // Perform attack on every player IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player); enumerator.MoveNext(); CardCollection trashed = new CardCollection(); while (enumerator.MoveNext()) { Player attackee = enumerator.Current; // Skip if the attack is blocked (Moat, Lighthouse, etc.) if (this.IsAttackBlocked[attackee]) continue; attackee.Draw(2, DeckLocation.Revealed); CardCollection treasures = attackee.Revealed[Category.Treasure]; Choice choice = new Choice(String.Format("Choose a Treasure card of {0} to trash", attackee), this, treasures, attackee); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { Card trashCard = attackee.RetrieveCardFrom(DeckLocation.Revealed, result.Cards[0]); attackee.Trash(trashCard); trashed.Add(trashCard); } attackee.DiscardRevealed(); } Choice keepCards = new Choice("Choose which cards you'd like to gain from being trashed.", this, trashed, player, true, 0, trashed.Count); ChoiceResult keptCards = player.MakeChoice(keepCards); foreach (Card card in keptCards.Cards) player.Gain(player._Game.Table.Trash, card); }
public override void Play(Player player) { base.Play(player); Choice choice = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "Gain a card from the trash", "Trash an Action card from your hand" }, player); ChoiceResult result = player.MakeChoice(choice); if (result.Options.Contains("Gain a card from the trash")) { List<Cost> availableCosts = new List<Cost>() { new Cost(3), new Cost(4), new Cost(5), new Cost(6) }; IEnumerable<Card> availableTrashCards = player._Game.Table.Trash.Where(c => availableCosts.Any(cost => player._Game.ComputeCost(c) == cost)); Choice choiceFromTrash = new Choice("Choose a card to gain from the trash", this, availableTrashCards, player); ChoiceResult resultFromTrash = player.MakeChoice(choiceFromTrash); if (resultFromTrash.Cards.Count > 0) { player.Gain(player._Game.Table.Trash, resultFromTrash.Cards[0], DeckLocation.Deck, DeckPosition.Top); } } else { Choice choiceTrash = new Choice("Choose an Action card to trash", this, player.Hand[Cards.Category.Action], player); ChoiceResult resultTrash = player.MakeChoice(choiceTrash); player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); if (resultTrash.Cards.Count > 0) { Cost trashedCardCost = player._Game.ComputeCost(resultTrash.Cards[0]); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= (trashedCardCost + new Coin(3))); Choice choiceGain = new Choice("Gain a card", this, gainableSupplies, player, false); ChoiceResult resultGain = player.MakeChoice(choiceGain); if (resultGain.Supply != null) player.Gain(resultGain.Supply); } } }
public override void Play(Player player) { base.Play(player); CardBenefit benefit = new CardBenefit(); Choice choice = new Choice("Choose one:", this, new CardCollection() { this }, new List<string>() { "+2<nbsp/>Actions", "+2<nbsp/>Buys", "Gain a Silver" }, player); ChoiceResult result = player.MakeChoice(choice); if (result.Options.Contains("+2<nbsp/>Actions")) benefit.Actions = 2; else if (result.Options.Contains("+2<nbsp/>Buys")) benefit.Buys = 2; else player.Gain(player._Game.Table.Silver); player.ReceiveBenefit(this, benefit); }
internal void player_Action(Player player, ref CardsDiscardEventArgs e) { e.Cards.Remove(this.PhysicalCard); if (player.InPlay.Contains(this.PhysicalCard)) player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard)); else if (player.SetAside.Contains(this.PhysicalCard)) player.Trash(player.RetrieveCardFrom(DeckLocation.SetAside, this.PhysicalCard)); player.Gain(player._Game.Table.SpecialPiles[TypeClass.Madman]); e.HandledBy.Add(this); _ShouldBeTrashed = false; }
public override void Play(Player player) { base.Play(player); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll( supply => supply.CanGain() && ((supply.Category & Cards.Category.Action) == Cards.Category.Action) && supply.CurrentCost <= new Coin(5)); Choice choice = new Choice("You may gain an Action card costing up to <coin>5</coin>", this, gainableSupplies, player, true); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); }
public override void Play(Player player) { base.Play(player); player.Gain(player._Game.Table.SpecialPiles[TypeClass.Spoils]); }