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); }
void player_CardsDiscarding(object sender, CardsDiscardEventArgs e) { if (!e.Cards.Contains(this.PhysicalCard) || e.GetAction(TypeClass.Alchemist) != null || (e.FromLocation != DeckLocation.InPlay && e.FromLocation != DeckLocation.SetAside && e.FromLocation != DeckLocation.InPlayAndSetAside)) { return; } if (e.Cards.Any(c => c.CardType == TypeClass.Potion)) { e.AddAction(TypeClass.Alchemist, new CardsDiscardAction(sender as Player, this, String.Format("Put {0} on your deck", this.PhysicalCard), player_Action, false)); } }
void player_CardsDiscarding(object sender, CardsDiscardEventArgs e) { if (!e.Cards.Contains(this.PhysicalCard) || e.GetAction(TypeClass.Herbalist) != null || e.HandledBy.Contains(this) || (e.FromLocation != DeckLocation.InPlay && e.FromLocation != DeckLocation.SetAside && e.FromLocation != DeckLocation.InPlayAndSetAside)) { return; } if (e.Cards.Any(c => (c.Category & Cards.Category.Treasure) == Cards.Category.Treasure)) { e.AddAction(TypeClass.Herbalist, new CardsDiscardAction(sender as Player, this, "Put a Treasure on your deck", player_Action, false)); } }
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); }
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); }
void player_CardsDiscarding(object sender, CardsDiscardEventArgs e) { if (e.FromLocation != DeckLocation.InPlay && e.FromLocation != DeckLocation.SetAside && e.FromLocation != DeckLocation.InPlayAndSetAside) { return; } if (e.HandledBy.Contains(this)) { return; } if (e.Cards.Contains(this._SetAsideCardInPlay)) { e.AddAction(TypeClass.Prince, this._SetAsideCardInPlay.CardType, new CardsDiscardAction(sender as Player, this, String.Format("Set aside {0}", this._SetAsideCardInPlay), player_DiscardAction, true) { Data = this._SetAsideCardInPlay }); } else { } }
protected override ChoiceResult Decide_CardsDiscard(Choice choice, CardsDiscardEventArgs cdea, IEnumerable<Tuple<Type, Type>> cardTriggerTypes) { // Always put Treasury on my deck if I can if (cardTriggerTypes.Any(t => t.Item1 == Cards.Seaside.TypeClass.Treasury)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Seaside.TypeClass.Treasury).Text }); // Always put Alchemist on my deck if I can if (cardTriggerTypes.Any(t => t.Item1 == Cards.Alchemy.TypeClass.Alchemist)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Alchemy.TypeClass.Alchemist).Text }); // Only perform Herbalist if there's at least 1 non-Copper Treasure card in play if (cardTriggerTypes.Any(t => t.Item1 == Cards.Alchemy.TypeClass.Herbalist)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Alchemy.TypeClass.Herbalist).Text }); // Always reveal this when discarding if (cardTriggerTypes.Any(t => t.Item1 == Cards.Hinterlands.TypeClass.Tunnel)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Hinterlands.TypeClass.Tunnel).Text }); IEnumerable<CardsDiscardAction> schemeOptions = cdea.Actions.Where(kvp => kvp.Key.Item1 == Cards.Hinterlands.TypeClass.Scheme).Select(kvp => kvp.Value).OrderBy(cda => ((ICard)cda.Data).BaseCost.Coin.Value + 2.5f * ((ICard)cda.Data).BaseCost.Potion.Value); if (schemeOptions.Count() > 0) return new ChoiceResult(new List<String>() { schemeOptions.ElementAt(0).Text }); // Dunno what to do -- choose a random IsRequired one or nothing if there are none IEnumerable<KeyValuePair<Tuple<Type, Type>, CardsDiscardAction>> requiredActions = cdea.Actions.Where(a => a.Value.IsRequired); if (requiredActions.Count() > 0) { int index = this._Game.RNG.Next(requiredActions.Count()); return new ChoiceResult(new List<String>() { cdea.Actions[requiredActions.ElementAt(index).Key].Text }); } return new ChoiceResult(new List<String>()); }
void otherPlayer_CardsDiscarded(object sender, CardsDiscardEventArgs e) { if (!KnownPlayerHands.ContainsKey(((Player)sender).UniqueId)) return; // We shouldn't cheat -- only the last card should be visible Card lastCard = e.Cards.LastOrDefault(); if (lastCard == null) return; // Remove the card if it's found in our list of cards that we know about Card foundCard = KnownPlayerHands[((Player)sender).UniqueId].FirstOrDefault(c => c.Name == lastCard.Name); if (foundCard != null) KnownPlayerHands[((Player)sender).UniqueId].Remove(foundCard); }
protected override ChoiceResult Decide_CardsDiscard(Choice choice, CardsDiscardEventArgs cdea, IEnumerable<Tuple<Type, Type>> cardTriggerTypes) { // Always put Treasury on my deck if I can if (cardTriggerTypes.Any(t => t.Item1 == Cards.Seaside.TypeClass.Treasury)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Seaside.TypeClass.Treasury).Text }); // Always put Alchemist on my deck if I can if (cardTriggerTypes.Any(t => t.Item1 == Cards.Alchemy.TypeClass.Alchemist)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Alchemy.TypeClass.Alchemist).Text }); // Only perform Herbalist if there's at least 1 non-Copper Treasure card in play if (cardTriggerTypes.Any(t => t.Item1 == Cards.Alchemy.TypeClass.Herbalist)) { if (this.RealThis.InPlay[Category.Treasure].Any(c => c.CardType != Cards.Universal.TypeClass.Copper)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Alchemy.TypeClass.Herbalist).Text }); } // Always reveal this when discarding if (cardTriggerTypes.Any(t => t.Item1 == Cards.Hinterlands.TypeClass.Tunnel)) return new ChoiceResult(new List<String>() { cdea.GetAction(Cards.Hinterlands.TypeClass.Tunnel).Text }); return new ChoiceResult(new List<String>()); }