internal void player_Action(Player player, ref CardsDiscardEventArgs e) { e.Cards.Remove(this.PhysicalCard); Card thisCard = null; if (player.InPlay.Contains(this.PhysicalCard)) thisCard = player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard); else thisCard = player.RetrieveCardFrom(DeckLocation.SetAside, this.PhysicalCard); player.AddCardToDeck(thisCard, DeckPosition.Top); }
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); player.BeginDrawing(); while (player.CanDraw) { player.Draw(DeckLocation.Revealed); if (player._Game.ComputeCost(player.Revealed.Last()) >= new Cost(3)) break; } player.EndDrawing(); if (player.Revealed.Count > 0) { Card lastCard = player.Revealed.Last(); if (player._Game.ComputeCost(player.Revealed.Last()) >= new Cost(3)) player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Revealed, lastCard)); } player.DiscardRevealed(); }
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 PlayDuration(Player player) { base.PlayDuration(player); player.ReceiveBenefit(this, new CardBenefit() { Cards = 1 }); player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.SetAside, this)); }
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); } } } }
public override void Play(Player player) { base.Play(player); Choice choice = new Choice("Choose a card to trash", this, player.Hand, player, false, 1, 1); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0])); Cost cardCost = player._Game.ComputeCost(result.Cards[0]); int toDraw = cardCost.Coin.Value; if (cardCost.Potion.Value > 0) toDraw += 2; player.ReceiveBenefit(this, new CardBenefit() { Cards = toDraw }); } }
public override void Play(Player player) { base.Play(player); Choice choiceTrash = new Choice("You may trash an Action card", this, player.Hand[Cards.Category.Action], player, false, 0, 1); ChoiceResult resultTrash = player.MakeChoice(choiceTrash); if (resultTrash.Cards.Count > 0) { player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); } else if (player.InPlay.Contains(this.PhysicalCard)) { player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard)); } }
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_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; }
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_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); }
public override void Play(Player player) { base.Play(player); Choice choice = new Choice("You may choose a Treasure card to trash", this, player.Hand[Cards.Category.Treasure], player, false, 0, 1); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, result.Cards[0])); CardBenefit benefit = new CardBenefit(); Choice choiceBenefit = new Choice("Choose either +2 Cards and +1 Action; or +<coin>2</coin> and +1 Buy", this, new CardCollection() { this }, new List<string>() { "+2<nbsp/>Cards and +1<nbsp/>Action", "+<coin>2</coin> and +1<nbsp/>Buy" }, player); ChoiceResult resultBenefit = player.MakeChoice(choiceBenefit); if (resultBenefit.Options[0] == "+2<nbsp/>Cards and +1<nbsp/>Action") { benefit.Cards = 2; benefit.Actions = 1; } else { benefit.Currency.Coin.Value = 2; benefit.Buys = 1; } player.ReceiveBenefit(this, benefit); } }
internal void player_DiscardAction(Player player, ref CardsDiscardEventArgs e) { Card cardToTopDeck = e.Data as Card; e.Cards.Remove(cardToTopDeck); if (player.InPlay.Contains(cardToTopDeck)) player.RetrieveCardFrom(DeckLocation.InPlay, cardToTopDeck); else player.RetrieveCardFrom(DeckLocation.SetAside, cardToTopDeck); player.AddCardToDeck(cardToTopDeck, DeckPosition.Top); e.HandledBy.Add(cardToTopDeck); }
public override void Play(Player player) { base.Play(player); player.ReturnHand(player.RevealHand()); Boolean foundUniqueCard = false; player.BeginDrawing(); while (player.CanDraw) { player.Draw(DeckLocation.Revealed); if (player.Hand[player.Revealed.Last().CardType].Count == 0) { foundUniqueCard = true; break; } } player.EndDrawing(); if (foundUniqueCard && player.Revealed.Count > 0) player.AddCardToHand(player.RetrieveCardFrom(DeckLocation.Revealed, player.Revealed.Last())); player.DiscardRevealed(); }
public override void Play(Player player) { base.Play(player); if (player.InPlay.Contains(this.PhysicalCard)) { Card cardToReturn = player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard); Supply supply = player._Game.Table.SpecialPiles[TypeClass.Spoils]; player.Lose(this); supply.AddTo(this); player._Game.SendMessage(player, this, supply, 1); } }
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); }
public override void Play(Player player) { base.Play(player); Choice choice = new Choice(String.Format("You may play a Treasure card twice", player), this, player.Hand[Cards.Category.Treasure], player, false, 0, 1); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { Card card = result.Cards[0]; player.PlayCardInternal(card); player.PlayCardInternal(card, " again"); if (player.InPlay.Contains(card)) player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, card)); } else player.PlayNothing(); }
internal void player_TrashHovel(Player player, ref Players.CardBuyEventArgs e) { player.Trash(player.RetrieveCardFrom(DeckLocation.Hand, this.PhysicalCard)); 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 void KnightAttack(Player player) { List<Cost> availableCosts = new List<Cost>() { new Cost(3), new Cost(4), new Cost(5), new Cost(6) }; Boolean anyKnightsTrashed = false; IEnumerator<Player> enumerator = player._Game.GetPlayersStartingWithEnumerator(player); enumerator.MoveNext(); while (enumerator.MoveNext()) { Player attackee = enumerator.Current; 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)], player); ChoiceResult resultTrash = attackee.MakeChoice(choiceTrash); if (resultTrash.Cards.Count > 0) { Card cardToTrash = attackee.RetrieveCardFrom(DeckLocation.Revealed, resultTrash.Cards[0]); if ((cardToTrash.Category & Cards.Category.Knight) == Cards.Category.Knight) anyKnightsTrashed = true; attackee.Trash(cardToTrash); } attackee.DiscardRevealed(); } if (anyKnightsTrashed && player.InPlay.Contains(this.PhysicalCard)) player.Trash(player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard)); }
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); if (player.InPlay.Contains(this.PhysicalCard)) { Supply supply = player._Game.Table.SpecialPiles[TypeClass.Madman]; Card cardToReturn = player.RetrieveCardFrom(DeckLocation.InPlay, this.PhysicalCard); player.Lose(this); supply.AddTo(this); player._Game.SendMessage(player, this, supply, 1); player.ReceiveBenefit(this, new CardBenefit() { Cards = player.Hand.Count }); } }
internal void player_DiscardAction(Player player, ref CardsDiscardEventArgs e) { if (_CardsDiscardingEventHandler != null) this._TurnStartedPlayer.CardsDiscarding -= _CardsDiscardingEventHandler; Card cardToSetAside = e.Data as Card; e.Cards.Remove(cardToSetAside); if (player.InPlay.Contains(this._SetAsideCardInPlay)) player.RetrieveCardFrom(DeckLocation.InPlay, cardToSetAside); else player.RetrieveCardFrom(DeckLocation.SetAside, cardToSetAside); this._SetAsideCard = cardToSetAside; player._Game.SendMessage(player, this, this._SetAsideCard); this._SetAsideCardInPlay = null; player.PlayerMats[TypeClass.PrinceSetAside].Refresh(player); e.HandledBy.Add(this); }
public override void Play(Player player) { base.Play(player); List<Type> cardTypes = new List<Type>(); foreach (Card card in player.InPlay) { Type t = card.CardType; if (!cardTypes.Contains(t)) cardTypes.Add(t); } foreach (Card card in player.SetAside) { Type t = card.CardType; if (!cardTypes.Contains(t)) cardTypes.Add(t); } Currencies.Coin uniqueCardsInPlay = new Currencies.Coin(cardTypes.Count); SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost <= uniqueCardsInPlay); Choice choice = new Choice("Gain a card.", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) { player.Gain(result.Supply); if ((result.Supply.Category & Cards.Category.Victory) == Cards.Category.Victory) { player.RetrieveCardFrom(DeckLocation.InPlay, this); player.Trash(this); } } }
internal void player_Action(Player player, ref CardsDiscardEventArgs e) { Choice choice = new Choice("Select a treasure to place on your deck", this, e.Cards.Where(c => (c.Category & Category.Treasure) == Cards.Category.Treasure), player); ChoiceResult result = player.MakeChoice(choice); if (result.Cards.Count > 0) { e.Cards.Remove(result.Cards[0]); if (player.InPlay.Contains(result.Cards[0])) player.RetrieveCardFrom(DeckLocation.InPlay, result.Cards[0]); else player.RetrieveCardFrom(DeckLocation.SetAside, result.Cards[0]); player.AddCardToDeck(result.Cards[0], DeckPosition.Top); } e.HandledBy.Add(this); }
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); }
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); }