public override IEffectHandle GetHandle(IGame game) { var exhaustable = game.GetCardInPlay <IExhaustableInPlay>(CardSource.Id); if (exhaustable == null || exhaustable.IsExhausted) { return(base.GetHandle(game)); } var controller = exhaustable.GetController(game); var attachment = game.GetCardInPlay <IAttachableInPlay>(CardSource.Id); if (attachment == null || attachment.AttachedTo == null) { return(base.GetHandle(game)); } var resourceful = attachment.AttachedTo as ICharacterInPlay; if (resourceful == null) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder(string.Format("You may exhaust '{0}' to add 2 resources to {1}'s resource pool", CardSource.Title, resourceful.Title), game, controller) .Question(string.Format("{0}, do you want to exhaust '{0}'?", controller, CardSource.Title)) .Answer(string.Format("Yes, I want to exhaust '{0}' to add 2 resources to {1}'s resource pool", CardSource.Title, resourceful.Title), true, (source, handle, item) => ExhaustAndAddTwoResources(source, handle, controller, exhaustable, resourceful)) .LastAnswer(string.Format("No, I do not to exhaust '{0}' to add 2 resources to {1}'s resource pool", CardSource.Title, resourceful.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to exhaust '{1}' to add 2 resources to {2}'s resource pool", controller.Name, CardSource.Title, resourceful.Title))); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { if (game.StagingArea.RevealedEncounterCard == null) { return base.GetHandle(game); } if (!(game.StagingArea.RevealedEncounterCard.Card is ITreacheryCard) || !game.StagingArea.RevealedEncounterCard.Card.HasEffect<IWhenRevealedEffect>()) { return base.GetHandle(game); } var controller = game.GetController(CardSource.Id); if (controller == null) return base.GetHandle(game); var exhaustable = controller.CardsInPlay.OfType<IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault(); if (exhaustable == null || exhaustable.IsExhausted) return base.GetHandle(game); var builder = new ChoiceBuilder(string.Format("Exhaust '{0}' to cancel the when revealed effects of a treachery just revealed by the encounter deck", CardSource.Title), game, controller) .Question(string.Format("{0}, do you want to exhaust '{1}' to cancel the revealed treachery?", controller.Name, CardSource.Title)) .Answer(string.Format("Yes, exhaust '{0}' to cancel the revealed treachery", CardSource.Title), exhaustable, (source, handle, item) => ExhaustToCancelRevealedTreachery(source, handle, exhaustable)); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var questPhase = game.CurrentPhase as IQuestPhase; if (questPhase == null) { return(new EffectHandle(this)); } var controller = game.GetController(CardSource.Id); if (controller == null) { throw new InvalidOperationException("Could not find Theodred in play"); } var questingHeroes = questPhase.GetAllCharactersCommittedToQuest().OfType <IHeroInPlay>().ToList(); if (questingHeroes.Count == 0) { return(new EffectHandle(this)); } var builder = new ChoiceBuilder("Chose a questing hero to add 1 resource to", game, controller) .Question(string.Format("{0}, which questing hero do you want to add 1 resource to?", controller.Name)) .LastAnswers(questingHeroes, item => item.Title, (source, handle, hero) => AddOneResourceToQuestingHero(game, handle, controller, hero)); var choice = builder.ToChoice(); return(new EffectHandle(this, choice)); }
public override IEffectHandle GetHandle(IGame game) { var limit = new Limit(PlayerScope.Controller, TimeScope.Round, 1); var controller = game.GetController(CardSource.Id); if (controller == null) return base.GetHandle(game); var exhaustable = controller.CardsInPlay.OfType<IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault(); if (exhaustable == null || exhaustable.IsExhausted) return base.GetHandle(game); var builder = new ChoiceBuilder(string.Format("Exhaust '{0}' to have a plyer draw 2 cards", CardSource.Title), game, controller); if (game.Players.Count() == 1) { builder.Question(string.Format("You are the only player, exhaust '{0}' to draw 2 cards?", CardSource.Title)) .Answer(string.Format("Yes, I want to exhaust '{0}' to draw 2 cards", CardSource.Title), controller, (source, handle, player) => ExhaustAndPlayerDrawsTwoCards(source, handle, controller, exhaustable, player)) .LastAnswer("No, I do not want to exhaust '{0}' to draw 2 cards", false, (source, handle, item) => CancelEffect(source, handle, controller)); } else { builder.Question(string.Format("{0}, do you want to exhaust '{1}' to have a player draw 2 cards?", controller.Name)) .Answer(string.Format("Yes, I will exhaust '{0}' to have a player draw 2 cards", CardSource.Title), true) .Question("Which player should draw 2 cards?") .LastAnswers(game.Players.ToList(), item => item.Name, (source, handle, player) => ExhaustAndPlayerDrawsTwoCards(game, handle, controller, exhaustable, player)) .LastAnswer(string.Format("No, I do not want to exhaust '{0}' to have a player draw 2 cards", CardSource.Title), false, (source, handle, item) => CancelEffect(source, handle, controller)); } var choice = builder.ToChoice(); return new EffectHandle(this, choice, limit); }
public override IEffectHandle GetHandle(IGame game) { var controller = game.GetController(CardSource.Id); if (controller == null) { throw new InvalidOperationException("Could not determine the controll of Gandalf after he entered play"); } var enemies = GetEnemiesInPlay(game); var builder = new ChoiceBuilder(string.Format("Choose which effect you want to trigger on '{0}' after he enters play", CardSource.Title), game, controller) .Question(string.Format("{0}, which effect do you want to trigger on '{1}'?", controller.Name, CardSource.Title)) .Answer("Draw 3 cards", 1, (source, handle, item) => DrawThreeCards(game, handle, controller)); if (enemies.Count() > 0) { builder.Answer("Deal 4 damage to 1 enemy in play", 2) .Question("Which enemy do you want to deal 4 damage to?") .LastAnswers(enemies, (item) => string.Format("'{0}' ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, enemy) => DealFourDamageToEnemyInPlay(game, handle, controller, enemy)); } builder.LastAnswer("Reduce your threat by 5", 3, (source, handle, item) => ReduceYourThreatByFive(game, handle, controller)); var choice = builder.ToChoice(); return(new EffectHandle(this, choice)); }
public override IEffectHandle GetHandle(IGame game) { IChoiceBuilder builder = new ChoiceBuilder("Quest Resolution", game, game.FirstPlayer); var check = Math.Abs(outcome.TotalWillpower - outcome.TotalThreat); byte difference = check <= 255 ? (byte)check : (byte)255; if (outcome.IsQuestSuccessful && difference > 0) { var description = GetProgressDescription(difference); builder.Question("The total willpower of committed characters is greater than the total threat of all cards in the staging area.") .LastAnswer(string.Format("Ok, questing was successful. {0} will be added to the current quest.", description), difference, (source, handle, item) => ResolveSuccessfulQuest(source, handle, item)); } else if (outcome.IsQuestFailed && difference > 0) { builder.Question("The total willpower of committed characters is less than the total threat of all cards in the staging area.") .LastAnswer(string.Format("Ok, questing was unsuccessful. Each player's threat will be raised by {0}.", difference), difference, (source, handle, item) => ResolveFailedQuest(source, handle, item)); } else { builder.Question("The total willpower of committed characters is equal to the total threat of all cards in the staging area.") .LastAnswer("Ok, questing was neither successful nor a failure", difference, (source, handle, item) => ResolveTiedQuest(source, handle)); } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { if (game.StagingArea.RevealedEncounterCard == null) { return(base.GetHandle(game)); } if (!(game.StagingArea.RevealedEncounterCard.Card is ITreacheryCard) || !game.StagingArea.RevealedEncounterCard.Card.HasEffect <IWhenRevealedEffect>()) { return(base.GetHandle(game)); } var controller = game.GetController(CardSource.Id); if (controller == null) { return(base.GetHandle(game)); } var exhaustable = controller.CardsInPlay.OfType <IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault(); if (exhaustable == null || exhaustable.IsExhausted) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder(string.Format("Exhaust '{0}' to cancel the when revealed effects of a treachery just revealed by the encounter deck", CardSource.Title), game, controller) .Question(string.Format("{0}, do you want to exhaust '{1}' to cancel the revealed treachery?", controller.Name, CardSource.Title)) .Answer(string.Format("Yes, exhaust '{0}' to cancel the revealed treachery", CardSource.Title), exhaustable, (source, handle, item) => ExhaustToCancelRevealedTreachery(source, handle, exhaustable)); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var availableCards = new Dictionary <Guid, IList <IPlayerCard> >(); foreach (var player in game.Players) { var topFive = player.Deck.GetFromTop(5).ToList(); availableCards.Add(player.StateId, topFive); } var builder = new ChoiceBuilder("Each player may search the top 5 cards of his deck for 1 card of their choice", game, game.FirstPlayer, true) .Question("Each play searches") .Answer("Yes", 1); foreach (var player in game.Players) { var cards = player.Deck.GetFromTop(5).ToList(); if (cards.Count == 0) { continue; } builder.Question(string.Format("{0}, which card would you like to add to your hand?", player.Name)) .Answers(cards, item => item.Title, (source, handle, card) => AddChosenCardToHand(game, handle, player, card)); } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var questPhase = game.CurrentPhase as IQuestPhase; if (questPhase == null) { return(new EffectHandle(this)); } var builder = new ChoiceBuilder("Each player must choose 1 character currently commited to the quest", game, game.FirstPlayer); foreach (var player in game.Players) { var characters = questPhase.GetCharactersCommitedToTheQuest(player.StateId); var count = characters.Count(); if (count == 0) { continue; } else if (count == 1) { var first = characters.First(); builder.Question(string.Format("{0}, '{1}' is your only character committed to the quest. You must remove them from the quest", player.Name, first.Title)) .Answer(string.Format("Ok, remove '{0}' from the quest", first.Title), first, (source, handle, character) => RemoveCharacterFromQuest(source, handle, character, player, questPhase)); } else { builder.Question(string.Format("{0}, which character do you want to remove from the quest?", player.Name)) .Answers(characters, (item) => string.Format("{0} ({1} willpower)", item.Title, item.Willpower), (source, handle, character) => RemoveCharacterFromQuest(source, handle, character, player, questPhase)); } } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var controller = game.GetController(CardSource.Id); if (controller == null) return base.GetHandle(game); var exhaustable = controller.CardsInPlay.OfType<IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault(); if (exhaustable == null) return base.GetHandle(game); var encounterCard = game.StagingArea.EncounterDeck.GetFromTop(1).FirstOrDefault(); if (encounterCard == null) return base.GetHandle(game); var builder = new ChoiceBuilder(string.Format("Exhaust {0} to look at the top of the encounter deck. You may move that card to the bottom of the deck", CardSource.Title), game, controller) .Question(string.Format("{0}, do you want to exhaust '{1}' to look at the top card of the encounter deck?", controller.Name)) .Answer(string.Format("Yes, I want to exhaust '{0}' to look at the top card of the encounter deck", CardSource.Title), true) .Question(string.Format("{0}, do you want to put '{1}' on the bottom of the encounter deck?", controller.Name, encounterCard.Title)) .Answer(string.Format("Yes, put '{0}' on the bottom of the encounter deck", encounterCard.Title), encounterCard, (source, handle, card) => PutEncounterCardOnBottomOfDeck(game, handle, controller, exhaustable, card)) .LastAnswer(string.Format("No, put '{0}' back on the top of the encounter deck", encounterCard.Title), encounterCard, (source, handle, card) => PutEncounterCardBackOnTopOfDeck(game, handle, controller, exhaustable, card)) .LastAnswer(string.Format("No, I do not want to exhaust '{0}' to look at the top card of the encounter deck", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to exhaust '{1}' to look at the top card of the encounter deck", controller.Name, CardSource.Title))); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var questPhase = game.CurrentPhase as IQuestPhase; if (questPhase == null) return new EffectHandle(this); var builder = new ChoiceBuilder("Each player must choose 1 character currently commited to the quest", game, game.FirstPlayer); foreach (var player in game.Players) { var characters = questPhase.GetCharactersCommitedToTheQuest(player.StateId); var count = characters.Count(); if (count == 0) continue; else if (count == 1) { var first = characters.First(); builder.Question(string.Format("{0}, '{1}' is your only character committed to the quest. You must remove them from the quest", player.Name, first.Title)) .Answer(string.Format("Ok, remove '{0}' from the quest", first.Title), first, (source, handle, character) => RemoveCharacterFromQuest(source, handle, character, player, questPhase)); } else { builder.Question(string.Format("{0}, which character do you want to remove from the quest?", player.Name)) .Answers(characters, (item) => string.Format("{0} ({1} willpower)", item.Title, item.Willpower), (source, handle, character) => RemoveCharacterFromQuest(source, handle, character, player, questPhase)); } } return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var limit = new Limit(PlayerScope.None, TimeScope.Round, 1); var controller = game.GetController(CardSource.Id); if (controller == null) { return(base.GetHandle(game)); } var resourceful = controller.CardsInPlay.OfType <ICharacterInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (resourceful == null || resourceful.Resources == 0) { return(base.GetHandle(game)); } var characters = game.GetAllCardsInPlay <ICharacterInPlay>().Where(x => x.Damage > 0).ToList(); if (characters.Count == 0) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder("Choose a wounded character in play to heal", game, controller) .Question("Which character do you want to heal 1 damage on?") .Answers(characters, item => string.Format("{0} ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, character) => HealOneDamageOnCharacter(game, handle, controller, resourceful, character)) .LastAnswer(string.Format("No, I do not want to pay 1 resource from '{0}' to heal a character", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to pay 1 resource from '{1}' to heal a character", controller.Name, CardSource.Title))); return(new EffectHandle(this, builder.ToChoice(), limit)); }
public override IEffectHandle GetHandle(IGame game) { var limit = new Limit(PlayerScope.AnyPlayer, TimeScope.Round, 1); var handSize = game.ActivePlayer.Hand.Cards.Count(); if (handSize == 0) { return(base.GetHandle(game)); } else { var builder = new ChoiceBuilder(string.Format("The active player may discard a card from their hand to give '{0}' +1 Willpower until the end of the phase", CardSource.Title), game, game.ActivePlayer); if (handSize == 1) { builder.Question("You only have 1 card in your hand, do you want to discard it?") .Answer("Yes, I will discard it", game.ActivePlayer.Hand.Cards.First(), (source, handle, card) => PlayerDiscardsOneCard(source, handle, game.ActivePlayer, card)) .LastAnswer("No, I will not discard my last card from my hand", false, (source, handle, item) => CancelDiscard(source, handle, game.ActivePlayer)); } else { builder.Question(string.Format("{0}, do you want to discard a card from your hand?", game.ActivePlayer.Name)) .Answer("Yes, I will discard a card from my hand", true) .Question("Which card will you discard?") .LastAnswers(game.ActivePlayer.Hand.Cards.ToList(), (item) => item.Title, (source, handle, card) => PlayerDiscardsOneCard(source, handle, game.ActivePlayer, card)) .LastAnswer("No, I will not discard a card from my hand", false, (source, handle, item) => CancelDiscard(source, handle, game.ActivePlayer)); } return(new EffectHandle(this, builder.ToChoice())); } }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder(GetText(player), game, player); var characters = GetReadyCharacters(); if (characters.Count == 0) { builder.Question("You do not have any ready characters available to commit to the quest") .LastAnswer("Ok, I will not commit any characters to the quest", false, (source, handle, item) => DoNotCommitAnyCharactersToTheQuest(handle)); } else { var description = characters.Count > 1 ? string.Format("{0} characters", characters.Count) : "1 character"; var threat = game.StagingArea.CardsInStagingArea.OfType <IThreateningInPlay>().Sum(x => x.Threat); builder.Question(string.Format("You have {0} available to commit to the quest and there is currently {1} threat in the staging area.\r\nDo you want to commit any characters to the quest?", description, threat)) .Answer("Yes, I want to commit characters to the quest", true) .Question("Which characters do you want to commit to the quest?", 0, (uint)characters.Count) .LastAnswers(characters, (item) => string.Format("{0} ({1} willpower)", item.Title, item.Willpower), (source, handle, character) => CommitCharacterToTheQuest(source, handle, character)) .LastAnswer("No, I do not want to commit characters to the quest", false, (source, handle, item) => DoNotCommitAnyCharactersToTheQuest(handle)); } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var controller = game.GetController(CardSource.Id); if (controller == null) { return(base.GetHandle(game)); } var exhaustable = controller.CardsInPlay.OfType <IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault(); if (exhaustable == null) { return(base.GetHandle(game)); } var encounterCard = game.StagingArea.EncounterDeck.GetFromTop(1).FirstOrDefault(); if (encounterCard == null) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder(string.Format("Exhaust {0} to look at the top of the encounter deck. You may move that card to the bottom of the deck", CardSource.Title), game, controller) .Question(string.Format("{0}, do you want to exhaust '{1}' to look at the top card of the encounter deck?", controller.Name)) .Answer(string.Format("Yes, I want to exhaust '{0}' to look at the top card of the encounter deck", CardSource.Title), true) .Question(string.Format("{0}, do you want to put '{1}' on the bottom of the encounter deck?", controller.Name, encounterCard.Title)) .Answer(string.Format("Yes, put '{0}' on the bottom of the encounter deck", encounterCard.Title), encounterCard, (source, handle, card) => PutEncounterCardOnBottomOfDeck(game, handle, controller, exhaustable, card)) .LastAnswer(string.Format("No, put '{0}' back on the top of the encounter deck", encounterCard.Title), encounterCard, (source, handle, card) => PutEncounterCardBackOnTopOfDeck(game, handle, controller, exhaustable, card)) .LastAnswer(string.Format("No, I do not want to exhaust '{0}' to look at the top card of the encounter deck", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to exhaust '{1}' to look at the top card of the encounter deck", controller.Name, CardSource.Title))); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var card = source as IPlayerCard; if (card == null) { throw new InvalidOperationException(); } var player = card.Owner; if (player == null) { throw new InvalidOperationException(); } var allies = GetExhausedAlliesInPlay(game); if (allies.Count() == 0) { return(new EffectHandle(this)); } var builder = new ChoiceBuilder("Choose an ally to ready", game, player) .Question("Which exhausted ally will you ready?") .LastAnswers(allies, item => string.Format("'{0}' controlled by {1}", item.Title, game.GetController(item.BaseCard.Id).Name), (src, handle, ally) => ReadyExhaustedAlly(src, handle, player, ally)); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var questPhase = game.CurrentPhase as IQuestPhase; if (questPhase == null) { return(new EffectHandle(this)); } if (game.FirstPlayer == null) { return(new EffectHandle(this)); } var questingCharacters = questPhase.GetAllCharactersCommittedToQuest().OfType <ICharacterInPlay>().ToList(); if (questingCharacters.Count == 0) { return(new EffectHandle(this)); } var builder = new ChoiceBuilder("The first player chooses 1 character currently committed to a quest", game, game.FirstPlayer) .Question(string.Format("Which character will have 2 damage dealt to it by '{0}'?", CardSource.Title)) .Answers(questingCharacters, (item) => string.Format("{0} ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, character) => DealTwoDamageToChosenCharacter(source, handle, character)); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder(GetText(player), game, player); var characters = GetReadyCharacters(); if (characters.Count == 0) { builder.Question("You do not have any ready characters available to commit to the quest") .LastAnswer("Ok, I will not commit any characters to the quest", false, (source, handle, item) => DoNotCommitAnyCharactersToTheQuest(handle)); } else { var description = characters.Count > 1 ? string.Format("{0} characters", characters.Count) : "1 character"; var threat = game.StagingArea.CardsInStagingArea.OfType<IThreateningInPlay>().Sum(x => x.Threat); builder.Question(string.Format("You have {0} available to commit to the quest and there is currently {1} threat in the staging area.\r\nDo you want to commit any characters to the quest?", description, threat)) .Answer("Yes, I want to commit characters to the quest", true) .Question("Which characters do you want to commit to the quest?", 0, (uint)characters.Count) .LastAnswers(characters, (item) => string.Format("{0} ({1} willpower)", item.Title, item.Willpower), (source, handle, character) => CommitCharacterToTheQuest(source, handle, character)) .LastAnswer("No, I do not want to commit characters to the quest", false, (source, handle, item) => DoNotCommitAnyCharactersToTheQuest(handle)); } return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.ShadowCards.Any(y => y.Card.Id == CardSource.Id)).FirstOrDefault(); if (enemyAttack == null) { return(base.GetHandle(game)); } var player = enemyAttack.DefendingPlayer; if (enemyAttack.IsUndefended) { var undefendedChoiceBuilder = new ChoiceBuilder("Defending player must discard all attachments they control", game, player) .Question(string.Format("{0} must discard all attachments they control", player)) .Answer("Yes", player, (source, handle, item) => DiscardAllAttachmentsControlledByDefendingPlayer(source, handle, item)); return(new EffectHandle(this, undefendedChoiceBuilder.ToChoice())); } var builder = new ChoiceBuilder("Choose and discard 1 attachment from defending character", game, player) .Question("Which defending character must discard an attachment?"); var attachedDefenders = 0; foreach (var defender in enemyAttack.Defenders.OfType <IAttachmentHostInPlay>()) { var controller = game.GetController(defender.Card.Id); if (controller == null) { continue; } var attachments = defender.Attachments.OfType <IAttachableInPlay>().Where(x => (x.Card is IObjectiveCard || x.Card is IPlayerCard) && (x.AttachedTo != null)).ToList(); if (attachments.Count == 0) { continue; } attachedDefenders++; builder.Answer(string.Format("{0} (controlled by {1}", defender.Title, controller.Name), defender) .Question(string.Format("Which attachment will be discarded from '{0}'?", defender.Title)) .Answers(attachments, item => item.Title, (source, handle, attachment) => DiscardOneAttachmentFromDefendingCharacter(game, handle, player, attachment)); } if (attachedDefenders == 0) { return(base.GetHandle(game)); } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder(string.Format("{0} has an opportunity to respond to a game effect", player.Name), game, player) .Question(string.Format("{0}, do you want to trigger the response '{1}'?", player.Name, responseEffect)) .Answer("Yes, I want to trigger this response", true, (source, handle, item) => TriggerResponse(source, handle)) .LastAnswer("No, I do not want to trigger this response", false, (sourcr, handle, item) => DoNotTriggerResponse(handle)); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder(string.Format("{0} has an opportunity to respond to a game effect", player.Name), game, player) .Question(string.Format("{0}, do you want to trigger the response '{1}'?", player.Name, responseEffect)) .Answer("Yes, I want to trigger this response", true, (source, handle, item) => TriggerResponse(source, handle)) .LastAnswer("No, I do not want to trigger this response", false, (sourcr, handle, item) => DoNotTriggerResponse(handle)); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder("Reduce 1 player's threat by 6, or reduce each player's threat by 2.", game, playerCard.Owner) .Question("Which effect would you like to trigger?") .Answer("Reduce 1 player's threat by 6", 1) .Question("Which players threat do you want to reduce by 6?") .LastAnswers(game.Players, (item) => item.Name, (source, handle, player) => ReduceOnePlayersThreatBySix(source, handle, player)) .LastAnswer("Reduce each player's threat by 2", 2, (source, handle, player) => ReduceEachPlayersThreatByTwo(source, handle)); return(new EffectHandle(this, builder.ToChoice())); //new ChooseGaladhrimsGreetingEffect(game, CardSource, playerCard.Owner)); }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder("Reduce 1 player's threat by 6, or reduce each player's threat by 2.", game, playerCard.Owner) .Question("Which effect would you like to trigger?") .Answer("Reduce 1 player's threat by 6", 1) .Question("Which players threat do you want to reduce by 6?") .LastAnswers(game.Players, (item) => item.Name, (source, handle, player) => ReduceOnePlayersThreatBySix(source, handle, player)) .LastAnswer("Reduce each player's threat by 2", 2, (source, handle, player) => ReduceEachPlayersThreatByTwo(source, handle)); return new EffectHandle(this, builder.ToChoice()); //new ChooseGaladhrimsGreetingEffect(game, CardSource, playerCard.Owner)); }
public override IEffectHandle GetHandle(IGame game) { var controller = game.GetController(CardSource.Id); if (controller == null) { return(base.GetHandle(game)); } var resourceful = game.GetCardInPlay <ICharacterInPlay>(CardSource.Id); if (resourceful == null || resourceful.Resources == 0) { return(base.GetHandle(game)); } var creatures = game.GetAllCardsInPlay <ICharacterInPlay>().Where(x => x.HasTrait(Trait.Creature) && x.Damage > 0).ToList(); if (creatures.Count == 0) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder("Choose a Creature in play", game, controller); if (resourceful.Resources == 1) { builder.Question(string.Format("'{0}' only has 1 resource available do you want to pay that one resource to heal a creature?", CardSource.Title)) .Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true) .Question("Which Creature do you want to heal?") .LastAnswers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1)); } else { builder.Question("Which Creature do you want to heal?"); foreach (var creature in creatures) { //.Answers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1)); //builder.Question(string.Format("How many resources do you want to pay from '{0}' to heal a creature?", CardSource.Title)) //.Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true) } } builder.LastAnswer(string.Format("No, I do not want to pay any resources from '{0}' to heal a creature", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to have '{1}' pay any resources to heal a creature", controller.Name, CardSource.Title))); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var exhaustedCharacters = game.FirstPlayer.CardsInPlay.OfType<ICharacterInPlay>().OfType<IExhaustableInPlay>().Where(x => x.IsExhausted).ToList(); if (exhaustedCharacters.Count == 0) return base.GetHandle(game); var builder = new ChoiceBuilder("The first player may choose and ready 1 character he controls", game, game.FirstPlayer) .Question(string.Format("{0}, which character would you like to ready?")) .Answers(exhaustedCharacters, (item) => item.Title, (source, handle, character) => ReadyCharacterInPlay(source, handle, game.FirstPlayer, character)); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var exhaustedCharacters = game.FirstPlayer.CardsInPlay.OfType <ICharacterInPlay>().OfType <IExhaustableInPlay>().Where(x => x.IsExhausted).ToList(); if (exhaustedCharacters.Count == 0) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder("The first player may choose and ready 1 character he controls", game, game.FirstPlayer) .Question(string.Format("{0}, which character would you like to ready?")) .Answers(exhaustedCharacters, (item) => item.Title, (source, handle, character) => ReadyCharacterInPlay(source, handle, game.FirstPlayer, character)); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var enemyEngage = game.CurrentPhase.GetEngagedEnemies().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyEngage == null) return base.GetHandle(game); var player = enemyEngage.DefendingPlayer; var builder = new ChoiceBuilder(string.Format("{0} must choose a hero for '{1}' to deal 5 damage to", player.Name, CardSource.Title), game, player) .Question(string.Format("Which hero will '{0}' deal 5 damage to?", CardSource.Title)) .LastAnswers(GetHeroes(player), item => item.Title, (source, handle, hero) => DealFiveDamageToHero(game, handle, player, hero)); var choice = builder.ToChoice(); return new EffectHandle(this, choice); }
public override IEffectHandle GetHandle(IGame game) { var playerCard = CardSource as IPlayerCard; if (playerCard == null) throw new InvalidOperationException(); var owner = playerCard.Owner; if (owner == null) throw new InvalidOperationException(); var builder = new ChoiceBuilder("Choose 1 ally card in your hand", game, owner) .Question("Which ally do you want to put into play from your hand?") .LastAnswers(owner.Hand.Cards.OfType<IAllyCard>().ToList(), (item) => item.Title, (source, handle, allyCard) => PutAllyIntoPlayFromYourHand(game, handle, owner, allyCard)); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var character = game.GetCardInPlay<ICharacterInPlay>(CardSource.Id); if (character == null || character.Resources == 0) return base.GetHandle(game); var controller = game.GetController(CardSource.Id); if (controller == null) return base.GetHandle(game); var builder = new ChoiceBuilder(string.Format("Pay 1 resource from his resource pool to ready '{0}' after commiting him to the quest", CardSource.Title), game, controller) .Question(string.Format("{0}, do you want to pay 1 resource from his resource pool to ready '{0}'?", CardSource.Title)) .Answer("Yes, I want to ready him", controller, (source, handle, item) => PayOneResourceToReadyAragorn(source, handle, item)) .LastAnswer("No, I do not want to ready him", false, (source, handle, item) => handle.Cancel(string.Format("", controller.Name))); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder<IGame>("The players determine a first player based on a majority group decision. If this proves impossible, determine a first player at random.", game, game.Players.First()); if (game.Players.Count() > 1) { builder.Question("Who will be first player?") .Answers(game.Players, (player) => player.Name, (source, handle, item) => ChooseFirstPlayer(handle, item)) .Answer("Determine a first player at random", game.Players.GetRandomItem(), (source, handle, item) => ChooseFirstPlayerRandomly(handle, item)); } else { var first = game.Players.First(); builder.Question(string.Format("{0} is the only player so there is no need to determine first player", first.Name)) .LastAnswer(string.Format("{0} is first player", first.Name), first, (source, handle, item) => ChooseFirstPlayer(handle, first)); } return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var enemyEngage = game.CurrentPhase.GetEngagedEnemies().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyEngage == null) { return(base.GetHandle(game)); } var player = enemyEngage.DefendingPlayer; var builder = new ChoiceBuilder(string.Format("{0} must choose a hero for '{1}' to deal 5 damage to", player.Name, CardSource.Title), game, player) .Question(string.Format("Which hero will '{0}' deal 5 damage to?", CardSource.Title)) .LastAnswers(GetHeroes(player), item => item.Title, (source, handle, hero) => DealFiveDamageToHero(game, handle, player, hero)); var choice = builder.ToChoice(); return(new EffectHandle(this, choice)); }
public override IEffectHandle GetHandle(IGame game) { var questPhase = game.CurrentPhase as IQuestPhase; if (questPhase == null) return new EffectHandle(this); if (game.FirstPlayer == null) return new EffectHandle(this); var questingCharacters = questPhase.GetAllCharactersCommittedToQuest().OfType<ICharacterInPlay>().ToList(); if (questingCharacters.Count == 0) return new EffectHandle(this); var builder = new ChoiceBuilder("The first player chooses 1 character currently committed to a quest", game, game.FirstPlayer) .Question(string.Format("Which character will have 2 damage dealt to it by '{0}'?", CardSource.Title)) .Answers(questingCharacters, (item) => string.Format("{0} ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, character) => DealTwoDamageToChosenCharacter(source, handle, character)); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var builder = new ChoiceBuilder <IGame>("The players determine a first player based on a majority group decision. If this proves impossible, determine a first player at random.", game, game.Players.First()); if (game.Players.Count() > 1) { builder.Question("Who will be first player?") .Answers(game.Players, (player) => player.Name, (source, handle, item) => ChooseFirstPlayer(handle, item)) .Answer("Determine a first player at random", game.Players.GetRandomItem(), (source, handle, item) => ChooseFirstPlayerRandomly(handle, item)); } else { var first = game.Players.First(); builder.Question(string.Format("{0} is the only player so there is no need to determine first player", first.Name)) .LastAnswer(string.Format("{0} is first player", first.Name), first, (source, handle, item) => ChooseFirstPlayer(handle, first)); } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var card = source as IPlayerCard; if (card == null) throw new InvalidOperationException(); var player = card.Owner; if (player == null) throw new InvalidOperationException(); var allies = GetExhausedAlliesInPlay(game); if (allies.Count() == 0) return new EffectHandle(this); var builder = new ChoiceBuilder("Choose an ally to ready", game, player) .Question("Which exhausted ally will you ready?") .LastAnswers(allies, item => string.Format("'{0}' controlled by {1}", item.Title, game.GetController(item.BaseCard.Id).Name), (src, handle, ally) => ReadyExhaustedAlly(src, handle, player, ally)); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var limit = new Limit(PlayerScope.Controller, TimeScope.Round, 1); var controller = game.GetController(CardSource.Id); if (controller == null) { return(base.GetHandle(game)); } var exhaustable = controller.CardsInPlay.OfType <IExhaustableInPlay>().Where(x => x.BaseCard.Id == source.Id).FirstOrDefault(); if (exhaustable == null || exhaustable.IsExhausted) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder(string.Format("Exhaust '{0}' to have a plyer draw 2 cards", CardSource.Title), game, controller); if (game.Players.Count() == 1) { builder.Question(string.Format("You are the only player, exhaust '{0}' to draw 2 cards?", CardSource.Title)) .Answer(string.Format("Yes, I want to exhaust '{0}' to draw 2 cards", CardSource.Title), controller, (source, handle, player) => ExhaustAndPlayerDrawsTwoCards(source, handle, controller, exhaustable, player)) .LastAnswer("No, I do not want to exhaust '{0}' to draw 2 cards", false, (source, handle, item) => CancelEffect(source, handle, controller)); } else { builder.Question(string.Format("{0}, do you want to exhaust '{1}' to have a player draw 2 cards?", controller.Name)) .Answer(string.Format("Yes, I will exhaust '{0}' to have a player draw 2 cards", CardSource.Title), true) .Question("Which player should draw 2 cards?") .LastAnswers(game.Players.ToList(), item => item.Name, (source, handle, player) => ExhaustAndPlayerDrawsTwoCards(game, handle, controller, exhaustable, player)) .LastAnswer(string.Format("No, I do not want to exhaust '{0}' to have a player draw 2 cards", CardSource.Title), false, (source, handle, item) => CancelEffect(source, handle, controller)); } var choice = builder.ToChoice(); return(new EffectHandle(this, choice, limit)); }
public override IEffectHandle GetHandle(IGame game) { IAttachableInPlay attachment = null; foreach (var player in game.Players) { attachment = player.CardsInPlay.OfType <IAttachableInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (attachment != null) { break; } } if (attachment == null || attachment.AttachedTo == null) { return(base.GetHandle(game)); } var resourceful = attachment.AttachedTo as ICharacterInPlay; if (resourceful == null) { return(base.GetHandle(game)); } var controller = resourceful.GetController(game); if (controller == null) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder(string.Format("You may pay 2 resources from {0}'s resource pool to allow them to ready as normal", resourceful.Title), game, controller) .Question(string.Format("{0}, do you want to pay 2 resources from {1}'s resource pool?", controller.Name, resourceful.Title)) .Answer(string.Format("Yes, I want to pay 2 resources from {0}'s resource pool", resourceful.Title), true, (source, handle, item) => PayResourcesToReadyAttachedCharacter(source, handle, controller, resourceful)) .LastAnswer(string.Format("No, I do not want to pay 2 resources from {0}'s resource pool", resourceful.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to pay 2 resources from {1}'s resource pool (2)", controller.Name, resourceful.Title, CardSource.Title))); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var spiders = game.StagingArea.EncounterDeck.Cards.OfType<IEnemyCard>().Where(x => x.PrintedTraits.Contains(Trait.Spider)) .Concat(game.StagingArea.EncounterDeck.DiscardPile.OfType<IEnemyCard>().Where(x => x.PrintedTraits.Contains(Trait.Spider))).ToList(); if (spiders.Count == 0) return base.GetHandle(game); var builder = new ChoiceBuilder("Each player must search the encounter deck and discard pile for 1 Spider card of his choice", game, game.FirstPlayer) .Question("Each player must choose a Spider") .Answer("Yes", 1); foreach (var player in game.Players) { builder.Question(string.Format("{0}, which Spider card do you want to add to the staging area?", player.Name)) .Answers(spiders, (item) => GetSpiderDescription(game, item), (source, handle, spider) => AddSpiderToTheStagingArea(source, handle, spider)); } return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var playerCard = CardSource as IPlayerCard; if (playerCard == null) { throw new InvalidOperationException(); } var owner = playerCard.Owner; if (owner == null) { throw new InvalidOperationException(); } var builder = new ChoiceBuilder("Choose 1 ally card in your hand", game, owner) .Question("Which ally do you want to put into play from your hand?") .LastAnswers(owner.Hand.Cards.OfType <IAllyCard>().ToList(), (item) => item.Title, (source, handle, allyCard) => PutAllyIntoPlayFromYourHand(game, handle, owner, allyCard)); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) { return(base.GetHandle(game)); } var attachments = enemyAttack.DefendingPlayer.CardsInPlay.OfType <IAttachableInPlay>().Where(x => (x.Card is IPlayerCard || x.Card is IObjectiveCard) && (x.AttachedTo != null)).ToList(); if (attachments.Count == 0) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder("Defending player must choose 1 attachment he controls", game, enemyAttack.DefendingPlayer) .Question(string.Format("{0}, which attachment will be discarded?", enemyAttack.DefendingPlayer)) .Answers(attachments, item => string.Format("{0} (attached to {1}", item.AttachedTo.Title), (source, handle, attachment) => DiscardChosenAttachment(game, handle, enemyAttack.DefendingPlayer, attachment)); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var mostThreateningPlayers = game.Players.Where(x => x.CurrentThreat == game.Players.Max(y => y.CurrentThreat)).ToList(); var attachable = CardSource as IAttachableCard; if (mostThreateningPlayers.Count == 0) { return(new EffectHandle(this)); } else if (mostThreateningPlayers.Count == 1) { var player = mostThreateningPlayers.First(); var builder = new ChoiceBuilder(string.Format("{0} has the highest threat and must choose a hero to attach '{0}' to", player.Name, CardSource.Title), game, player) .Question(string.Format("{0}, which hero do you want to attach '{1}' to?", player.Name, CardSource.Title)) .LastAnswers(GetAttachableHeros(game, player, attachable), item => item.Title, (source, handle, hero) => AttachCaughtInAWebToHero(game, handle, player, attachable, hero)); return(new EffectHandle(this, builder.ToChoice())); } else { var builder = new ChoiceBuilder(string.Format("Multiple players are tied for the highest threat, The first player, {0}, must choose which of these players will attach '{1}' to one of their heroes.", game.FirstPlayer.Name, CardSource.Title), game, game.FirstPlayer) .Question(string.Format("Which player will attach '{0}' to one of their heroes?", CardSource.Title)); foreach (var player in mostThreateningPlayers) { builder.Answer(player.Name, player) .Question(string.Format("{0}, which hero do you want to attach '{1}' to?", player.Name, CardSource.Title)) .LastAnswers(GetAttachableHeros(game, player, attachable), item => item.Title, (source, handle, hero) => AttachCaughtInAWebToHero(game, handle, player, attachable, hero)); } return(new EffectHandle(this, builder.ToChoice())); } }
public override IEffectHandle GetHandle(IGame game) { var mostThreateningPlayers = game.Players.Where(x => x.CurrentThreat == game.Players.Max(y => y.CurrentThreat)).ToList(); var attachable = CardSource as IAttachableCard; if (mostThreateningPlayers.Count == 0) { return new EffectHandle(this); } else if (mostThreateningPlayers.Count == 1) { var player = mostThreateningPlayers.First(); var builder = new ChoiceBuilder(string.Format("{0} has the highest threat and must choose a hero to attach '{0}' to", player.Name, CardSource.Title), game, player) .Question(string.Format("{0}, which hero do you want to attach '{1}' to?", player.Name, CardSource.Title)) .LastAnswers(GetAttachableHeros(game, player, attachable), item => item.Title, (source, handle, hero) => AttachCaughtInAWebToHero(game, handle, player, attachable, hero)); return new EffectHandle(this, builder.ToChoice()); } else { var builder = new ChoiceBuilder(string.Format("Multiple players are tied for the highest threat, The first player, {0}, must choose which of these players will attach '{1}' to one of their heroes.", game.FirstPlayer.Name, CardSource.Title), game, game.FirstPlayer) .Question(string.Format("Which player will attach '{0}' to one of their heroes?", CardSource.Title)); foreach (var player in mostThreateningPlayers) { builder.Answer(player.Name, player) .Question(string.Format("{0}, which hero do you want to attach '{1}' to?", player.Name, CardSource.Title)) .LastAnswers(GetAttachableHeros(game, player, attachable), item => item.Title, (source, handle, hero) => AttachCaughtInAWebToHero(game, handle, player, attachable, hero)); } return new EffectHandle(this, builder.ToChoice()); } }
public override IEffectHandle GetHandle(IGame game) { var playableCards = GetPlayableCardsInHand(game); var playableEffects = GetPlayableEffects(game); var builder = new ChoiceBuilder <IGame>(string.Format("{0} can choose to take an action during the {1} step of the {2} phase", player.Name, game.CurrentPhase.StepName, game.CurrentPhase.Name), game, player); if (playableCards.Count == 0 && playableEffects.Count == 0) { builder.Question(string.Format("{0}, there are no actions that you can take right now", player.Name)) .LastAnswer("Ok, I will pass on taking actions right now", false, (source, handle, number) => PassOnTakingAnAction(source, handle)); } else { builder.Question(string.Format("{0}, do you want to take an action?", player.Name)); if (playableCards.Count > 0) { builder.Answer <uint>("Yes, I would like to play a card from my hand", 1) .Question("Which card would you like to play from your hand?") .LastAnswers(playableCards, (item) => item.Title, (source, handle, costlyCard) => PlayCardFromHand(game, handle, costlyCard)); } if (playableEffects.Count > 0) { builder.Answer <uint>("Yes, I would like to trigger an effect on a card I control", 2) .Question("Which effect would you like to trigger?") .LastAnswers(playableEffects, (item) => item.ToString(), (source, handle, cardEffect) => TriggerEffect(source, handle, cardEffect)); } builder.LastAnswer("No, I will pass on taking an action right now", false, (source, handle, number) => PassOnTakingAnAction(source, handle)); } return(new EffectHandle(this, builder.ToChoice())); //new ChoosePlayerAction(game, player)); }
public override IEffectHandle GetHandle(IGame game) { var limit = new Limit(PlayerScope.None, TimeScope.Round, 1); var controller = game.GetController(CardSource.Id); if (controller == null) return base.GetHandle(game); var resourceful = controller.CardsInPlay.OfType<ICharacterInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (resourceful == null || resourceful.Resources == 0) return base.GetHandle(game); var characters = game.GetAllCardsInPlay<ICharacterInPlay>().Where(x => x.Damage > 0).ToList(); if (characters.Count == 0) return base.GetHandle(game); var builder = new ChoiceBuilder("Choose a wounded character in play to heal", game, controller) .Question("Which character do you want to heal 1 damage on?") .Answers(characters, item => string.Format("{0} ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, character) => HealOneDamageOnCharacter(game, handle, controller, resourceful, character)) .LastAnswer(string.Format("No, I do not want to pay 1 resource from '{0}' to heal a character", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to pay 1 resource from '{1}' to heal a character", controller.Name, CardSource.Title))); return new EffectHandle(this, builder.ToChoice(), limit); }
public override IEffectHandle GetHandle(IGame game) { var character = game.GetCardInPlay <ICharacterInPlay>(CardSource.Id); if (character == null || character.Resources == 0) { return(base.GetHandle(game)); } var controller = game.GetController(CardSource.Id); if (controller == null) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder(string.Format("Pay 1 resource from his resource pool to ready '{0}' after commiting him to the quest", CardSource.Title), game, controller) .Question(string.Format("{0}, do you want to pay 1 resource from his resource pool to ready '{0}'?", CardSource.Title)) .Answer("Yes, I want to ready him", controller, (source, handle, item) => PayOneResourceToReadyAragorn(source, handle, item)) .LastAnswer("No, I do not want to ready him", false, (source, handle, item) => handle.Cancel(string.Format("", controller.Name))); return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var spiders = game.StagingArea.EncounterDeck.Cards.OfType <IEnemyCard>().Where(x => x.PrintedTraits.Contains(Trait.Spider)) .Concat(game.StagingArea.EncounterDeck.DiscardPile.OfType <IEnemyCard>().Where(x => x.PrintedTraits.Contains(Trait.Spider))).ToList(); if (spiders.Count == 0) { return(base.GetHandle(game)); } var builder = new ChoiceBuilder("Each player must search the encounter deck and discard pile for 1 Spider card of his choice", game, game.FirstPlayer) .Question("Each player must choose a Spider") .Answer("Yes", 1); foreach (var player in game.Players) { builder.Question(string.Format("{0}, which Spider card do you want to add to the staging area?", player.Name)) .Answers(spiders, (item) => GetSpiderDescription(game, item), (source, handle, spider) => AddSpiderToTheStagingArea(source, handle, spider)); } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) return base.GetHandle(game); var attachments = enemyAttack.DefendingPlayer.CardsInPlay.OfType<IAttachableInPlay>().Where(x => (x.Card is IPlayerCard || x.Card is IObjectiveCard) && (x.AttachedTo != null)).ToList(); if (attachments.Count == 0) return base.GetHandle(game); var builder = new ChoiceBuilder("Defending player must choose 1 attachment he controls", game, enemyAttack.DefendingPlayer) .Question(string.Format("{0}, which attachment will be discarded?", enemyAttack.DefendingPlayer)) .Answers(attachments, item => string.Format("{0} (attached to {1}", item.AttachedTo.Title), (source, handle, attachment) => DiscardChosenAttachment(game, handle, enemyAttack.DefendingPlayer, attachment)); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { IChoiceBuilder builder = new ChoiceBuilder("Quest Resolution", game, game.FirstPlayer); var check = Math.Abs(outcome.TotalWillpower - outcome.TotalThreat); byte difference = check <= 255 ? (byte)check : (byte)255; if (outcome.IsQuestSuccessful && difference > 0) { var description = GetProgressDescription(difference); builder.Question("The total willpower of committed characters is greater than the total threat of all cards in the staging area.") .LastAnswer(string.Format("Ok, questing was successful. {0} will be added to the current quest.", description), difference, (source, handle, item) => ResolveSuccessfulQuest(source, handle, item)); } else if (outcome.IsQuestFailed && difference > 0) { builder.Question("The total willpower of committed characters is less than the total threat of all cards in the staging area.") .LastAnswer(string.Format("Ok, questing was unsuccessful. Each player's threat will be raised by {0}.", difference), difference, (source, handle, item) => ResolveFailedQuest(source, handle, item)); } else { builder.Question("The total willpower of committed characters is equal to the total threat of all cards in the staging area.") .LastAnswer("Ok, questing was neither successful nor a failure", difference, (source, handle, item) => ResolveTiedQuest(source, handle)); } return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { IAttachableInPlay attachment = null; foreach (var player in game.Players) { attachment = player.CardsInPlay.OfType<IAttachableInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (attachment != null) break; } if (attachment == null || attachment.AttachedTo == null) return base.GetHandle(game); var resourceful = attachment.AttachedTo as ICharacterInPlay; if (resourceful == null) return base.GetHandle(game); var controller = resourceful.GetController(game); if (controller == null) return base.GetHandle(game); var builder = new ChoiceBuilder(string.Format("You may pay 2 resources from {0}'s resource pool to allow them to ready as normal", resourceful.Title), game, controller) .Question(string.Format("{0}, do you want to pay 2 resources from {1}'s resource pool?", controller.Name, resourceful.Title)) .Answer(string.Format("Yes, I want to pay 2 resources from {0}'s resource pool", resourceful.Title), true, (source, handle, item) => PayResourcesToReadyAttachedCharacter(source, handle, controller, resourceful)) .LastAnswer(string.Format("No, I do not want to pay 2 resources from {0}'s resource pool", resourceful.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to pay 2 resources from {1}'s resource pool (2)", controller.Name, resourceful.Title, CardSource.Title))); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var limit = new Limit(PlayerScope.AnyPlayer, TimeScope.Round, 1); var handSize = game.ActivePlayer.Hand.Cards.Count(); if (handSize == 0) { return base.GetHandle(game); } else { var builder = new ChoiceBuilder(string.Format("The active player may discard a card from their hand to give '{0}' +1 Willpower until the end of the phase", CardSource.Title), game, game.ActivePlayer); if (handSize == 1) { builder.Question("You only have 1 card in your hand, do you want to discard it?") .Answer("Yes, I will discard it", game.ActivePlayer.Hand.Cards.First(), (source, handle, card) => PlayerDiscardsOneCard(source, handle, game.ActivePlayer, card)) .LastAnswer("No, I will not discard my last card from my hand", false, (source, handle, item) => CancelDiscard(source, handle, game.ActivePlayer)); } else { builder.Question(string.Format("{0}, do you want to discard a card from your hand?", game.ActivePlayer.Name)) .Answer("Yes, I will discard a card from my hand", true) .Question("Which card will you discard?") .LastAnswers(game.ActivePlayer.Hand.Cards.ToList(), (item) => item.Title, (source, handle, card) => PlayerDiscardsOneCard(source, handle, game.ActivePlayer, card)) .LastAnswer("No, I will not discard a card from my hand", false, (source, handle, item) => CancelDiscard(source, handle, game.ActivePlayer)); } return new EffectHandle(this, builder.ToChoice()); } }
public override IEffectHandle GetHandle(IGame game) { var hosts = GetAttachmentHosts(game); var characters = GetCharactersWithResourceMatch(); var description = attachmentCard != null ? "attachment card" : "treasure card"; var sum = characters.Sum(x => x.Resources); var builder = new ChoiceBuilder(GetChoiceText(), game, player); if (characters.Count == 0) { builder.Question(string.Format("You do not have any characters with a resource match to pay for '{0}'", attachableCard.Title)) .Answer(string.Format("Ok, cancel playing this {0} from my hand", description), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else if (hosts.Count == 0) { builder.Question(string.Format("There are no valid targets to which you can attach '{0}'", attachableCard.Title)) .Answer(string.Format("Ok, cancel playing this {0} from my hand", description), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else if (isVariableCost) { if (characters.Count == 1) { var first = characters.First(); var amounts = new List <byte>(); for (byte i = 1; i <= first.Resources; i++) { amounts.Add(i); } builder.Question(string.Format("'{0}' has a resource match, and this {1} has a variable cost. How many resources do you want to spend from their resource pool?", first.Title, description)) .Answers(amounts, (item) => item == 1 ? "1 resource" : string.Format("{0} resources", item), (source, handle, number) => PayResourcesFromCharacter(source, handle, first, player, number)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question(string.Format("This {0} has a variable cost. Do you want to pay this cost?", description)) .Answer("Yes, pay this cost", true); foreach (var character in characters) { var amounts = new List <byte>(); for (byte i = 1; i <= character.Resources; i++) { amounts.Add(i); } builder.Question(string.Format("'{0}' has a resource match, and this {1} has a variable cost. How many resources do you want to spend from their resource pool?", character.Title, description)) .LastAnswers(amounts, (item) => item == 1 ? "1 resource" : string.Format("{0} resources", item), (source, handle, number) => PayResourcesFromCharacter(source, handle, character, player, number)); } builder.LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } } else if (numberOfResources == 0) { var character = characters.First(); builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question("This card does not have any cost. Do you want to play it?") .Answer("Yes, I want to play this card", true, (source, handle, item) => PayResourcesFromCharacter(game, handle, character, player, 0)) .LastAnswer("No, I do not want to play this card", false, (source, handle, item) => CancelPayingCost(game, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else if (sum < numberOfResources) { builder.Question("You do not have characters with enough resources available to pay this cost") .LastAnswer("Ok, cancel this payment", false, (source, handle, item) => UnableToPayCost(source, handle, player)); } else if (characters.Count == 1) { var first = characters.First(); if (first.Resources < numberOfResources) { builder.Question(string.Format("'{0}' has a resource match but does not have enough resources to pay this cost", first.Title)) .LastAnswer("Ok, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); var paymentText = numberOfResources == 1 ? "1 resource" : string.Format("{0} resources", numberOfResources); builder.Question(string.Format("'{0}' has a resource match, do you want to pay {1} from their resource pool?", first.Title, paymentText)) .Answer("Yes, make this payment", first, (source, handle, character) => PayResourcesFromCharacter(source, handle, character, player, numberOfResources)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } } else { if (numberOfResources == 1) { builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question(string.Format("Multiple characters have a resource match, and this {0} costs 1 resource. Which character do you want to use to pay this cost?", description)) .Answers(characters, (item) => item.Title, (source, handle, character) => PayResourcesFromCharacter(source, handle, character, player, numberOfResources)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { if (sum == numberOfResources) { var paymentText = GetPaymentText(characters); var charactersAndPayments = new List <Tuple <ICharacterInPlay, byte> >(); foreach (var character in characters) { charactersAndPayments.Add(new Tuple <ICharacterInPlay, byte>(character, character.Resources)); } builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question("You have just enough resources on your character to pay this cost. Do you want to pay all of the resources from matching characters?") .Answer(string.Format("Yes, pay {0}", paymentText), characters, (source, handle, item) => PayResourcesFromCharacters(source, handle, charactersAndPayments, player)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { var characterNames = GetCharacterNames(characters); builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question("You have muliple characters with a resource match to pay this cost. Do you want to choose the resources to pay from matching characters?") .Answer(string.Format("Yes, pay resources as follows:", characterNames), true); AddPaymentAnswers(builder, characters, numberOfResources); builder.LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } } } return(new EffectHandle(this, builder.ToChoice())); }
public override IEffectHandle GetHandle(IGame game) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.ShadowCards.Any(y => y.Card.Id == CardSource.Id)).FirstOrDefault(); if (enemyAttack == null) return base.GetHandle(game); var player = enemyAttack.DefendingPlayer; if (enemyAttack.IsUndefended) { var undefendedChoiceBuilder = new ChoiceBuilder("Defending player must discard all attachments they control", game, player) .Question(string.Format("{0} must discard all attachments they control", player)) .Answer("Yes", player, (source, handle, item) => DiscardAllAttachmentsControlledByDefendingPlayer(source, handle, item)); return new EffectHandle(this, undefendedChoiceBuilder.ToChoice()); } var builder = new ChoiceBuilder("Choose and discard 1 attachment from defending character", game, player) .Question("Which defending character must discard an attachment?"); var attachedDefenders = 0; foreach (var defender in enemyAttack.Defenders.OfType<IAttachmentHostInPlay>()) { var controller = game.GetController(defender.Card.Id); if (controller == null) continue; var attachments = defender.Attachments.OfType<IAttachableInPlay>().Where(x => (x.Card is IObjectiveCard || x.Card is IPlayerCard) && (x.AttachedTo != null)).ToList(); if (attachments.Count == 0) continue; attachedDefenders++; builder.Answer(string.Format("{0} (controlled by {1}", defender.Title, controller.Name), defender) .Question(string.Format("Which attachment will be discarded from '{0}'?", defender.Title)) .Answers(attachments, item => item.Title, (source, handle, attachment) => DiscardOneAttachmentFromDefendingCharacter(game, handle, player, attachment)); } if (attachedDefenders == 0) return base.GetHandle(game); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var controller = game.GetController(CardSource.Id); if (controller == null) return base.GetHandle(game); var resourceful = game.GetCardInPlay<ICharacterInPlay>(CardSource.Id); if (resourceful == null || resourceful.Resources == 0) return base.GetHandle(game); var creatures = game.GetAllCardsInPlay<ICharacterInPlay>().Where(x => x.HasTrait(Trait.Creature) && x.Damage > 0).ToList(); if (creatures.Count == 0) return base.GetHandle(game); var builder = new ChoiceBuilder("Choose a Creature in play", game, controller); if (resourceful.Resources == 1) { builder.Question(string.Format("'{0}' only has 1 resource available do you want to pay that one resource to heal a creature?", CardSource.Title)) .Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true) .Question("Which Creature do you want to heal?") .LastAnswers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1)); } else { builder.Question("Which Creature do you want to heal?"); foreach (var creature in creatures) { //.Answers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1)); //builder.Question(string.Format("How many resources do you want to pay from '{0}' to heal a creature?", CardSource.Title)) //.Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true) } } builder.LastAnswer(string.Format("No, I do not want to pay any resources from '{0}' to heal a creature", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to have '{1}' pay any resources to heal a creature", controller.Name, CardSource.Title))); return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var availableCards = new Dictionary<Guid, IList<IPlayerCard>>(); foreach (var player in game.Players) { var topFive = player.Deck.GetFromTop(5).ToList(); availableCards.Add(player.StateId, topFive); } var builder = new ChoiceBuilder("Each player may search the top 5 cards of his deck for 1 card of their choice", game, game.FirstPlayer, true) .Question("Each play searches") .Answer("Yes", 1); foreach (var player in game.Players) { var cards = player.Deck.GetFromTop(5).ToList(); if (cards.Count == 0) continue; builder.Question(string.Format("{0}, which card would you like to add to your hand?", player.Name)) .Answers(cards, item => item.Title, (source, handle, card) => AddChosenCardToHand(game, handle, player, card)); } return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var controller = game.GetController(CardSource.Id); if (controller == null) throw new InvalidOperationException("Could not determine the controll of Gandalf after he entered play"); var enemies = GetEnemiesInPlay(game); var builder = new ChoiceBuilder(string.Format("Choose which effect you want to trigger on '{0}' after he enters play", CardSource.Title), game, controller) .Question(string.Format("{0}, which effect do you want to trigger on '{1}'?", controller.Name, CardSource.Title)) .Answer("Draw 3 cards", 1, (source, handle, item) => DrawThreeCards(game, handle, controller)); if (enemies.Count() > 0) { builder.Answer("Deal 4 damage to 1 enemy in play", 2) .Question("Which enemy do you want to deal 4 damage to?") .LastAnswers(enemies, (item) => string.Format("'{0}' ({1} damage of {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, enemy) => DealFourDamageToEnemyInPlay(game, handle, controller, enemy)); } builder.LastAnswer("Reduce your threat by 5", 3, (source, handle, item) => ReduceYourThreatByFive(game, handle, controller)); var choice = builder.ToChoice(); return new EffectHandle(this, choice); }
public override IEffectHandle GetHandle(IGame game) { var hosts = GetAttachmentHosts(game); var characters = GetCharactersWithResourceMatch(); var description = attachmentCard != null ? "attachment card" : "treasure card"; var sum = characters.Sum(x => x.Resources); var builder = new ChoiceBuilder(GetChoiceText(), game, player); if (characters.Count == 0) { builder.Question(string.Format("You do not have any characters with a resource match to pay for '{0}'", attachableCard.Title)) .Answer(string.Format("Ok, cancel playing this {0} from my hand", description), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else if (hosts.Count == 0) { builder.Question(string.Format("There are no valid targets to which you can attach '{0}'", attachableCard.Title)) .Answer(string.Format("Ok, cancel playing this {0} from my hand", description), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else if (isVariableCost) { if (characters.Count == 1) { var first = characters.First(); var amounts = new List<byte>(); for (byte i = 1; i <= first.Resources; i++) { amounts.Add(i); } builder.Question(string.Format("'{0}' has a resource match, and this {1} has a variable cost. How many resources do you want to spend from their resource pool?", first.Title, description)) .Answers(amounts, (item) => item == 1 ? "1 resource" : string.Format("{0} resources", item), (source, handle, number) => PayResourcesFromCharacter(source, handle, first, player, number)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question(string.Format("This {0} has a variable cost. Do you want to pay this cost?", description)) .Answer("Yes, pay this cost", true); foreach (var character in characters) { var amounts = new List<byte>(); for (byte i = 1; i <= character.Resources; i++) { amounts.Add(i); } builder.Question(string.Format("'{0}' has a resource match, and this {1} has a variable cost. How many resources do you want to spend from their resource pool?", character.Title, description)) .LastAnswers(amounts, (item) => item == 1 ? "1 resource" : string.Format("{0} resources", item), (source, handle, number) => PayResourcesFromCharacter(source, handle, character, player, number)); } builder.LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } } else if (numberOfResources == 0) { var character = characters.First(); builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question("This card does not have any cost. Do you want to play it?") .Answer("Yes, I want to play this card", true, (source, handle, item) => PayResourcesFromCharacter(game, handle, character, player, 0)) .LastAnswer("No, I do not want to play this card", false, (source, handle, item) => CancelPayingCost(game, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else if (sum < numberOfResources) { builder.Question("You do not have characters with enough resources available to pay this cost") .LastAnswer("Ok, cancel this payment", false, (source, handle, item) => UnableToPayCost(source, handle, player)); } else if (characters.Count == 1) { var first = characters.First(); if (first.Resources < numberOfResources) { builder.Question(string.Format("'{0}' has a resource match but does not have enough resources to pay this cost", first.Title)) .LastAnswer("Ok, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); var paymentText = numberOfResources == 1 ? "1 resource" : string.Format("{0} resources", numberOfResources); builder.Question(string.Format("'{0}' has a resource match, do you want to pay {1} from their resource pool?", first.Title, paymentText)) .Answer("Yes, make this payment", first, (source, handle, character) => PayResourcesFromCharacter(source, handle, character, player, numberOfResources)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } } else { if (numberOfResources == 1) { builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question(string.Format("Multiple characters have a resource match, and this {0} costs 1 resource. Which character do you want to use to pay this cost?", description)) .Answers(characters, (item) => item.Title, (source, handle, character) => PayResourcesFromCharacter(source, handle, character, player, numberOfResources)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { if (sum == numberOfResources) { var paymentText = GetPaymentText(characters); var charactersAndPayments = new List<Tuple<ICharacterInPlay, byte>>(); foreach (var character in characters) { charactersAndPayments.Add(new Tuple<ICharacterInPlay, byte>(character, character.Resources)); } builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question("You have just enough resources on your character to pay this cost. Do you want to pay all of the resources from matching characters?") .Answer(string.Format("Yes, pay {0}", paymentText), characters, (source, handle, item) => PayResourcesFromCharacters(source, handle, charactersAndPayments, player)) .LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } else { var characterNames = GetCharacterNames(characters); builder.Question(string.Format("Which card do you want to attach '{0}' to?", attachableCard.Title)); foreach (var host in hosts) { builder.Answer(host.Title, host, (source, handle, item) => handle.SetTarget(item)); builder.Question("You have muliple characters with a resource match to pay this cost. Do you want to choose the resources to pay from matching characters?") .Answer(string.Format("Yes, pay resources as follows:", characterNames), true); AddPaymentAnswers(builder, characters, numberOfResources); builder.LastAnswer("No, cancel this payment", false, (source, handle, item) => CancelPayingCost(source, handle, player)); } builder.LastAnswer(string.Format("No, I do not want to attach '{0}' to any of these cards", attachableCard.Title), false, (source, handle, item) => CancelPayingCost(source, handle, player)); } } } return new EffectHandle(this, builder.ToChoice()); }
public override IEffectHandle GetHandle(IGame game) { var playableCards = GetPlayableCardsInHand(game); var playableEffects = GetPlayableEffects(game); var builder = new ChoiceBuilder<IGame>(string.Format("{0} can choose to take an action during the {1} step of the {2} phase", player.Name, game.CurrentPhase.StepName, game.CurrentPhase.Name), game, player); if (playableCards.Count == 0 && playableEffects.Count == 0) { builder.Question(string.Format("{0}, there are no actions that you can take right now", player.Name)) .LastAnswer("Ok, I will pass on taking actions right now", false, (source, handle, number) => PassOnTakingAnAction(source, handle)); } else { builder.Question(string.Format("{0}, do you want to take an action?", player.Name)); if (playableCards.Count > 0) { builder.Answer<uint>("Yes, I would like to play a card from my hand", 1) .Question("Which card would you like to play from your hand?") .LastAnswers(playableCards, (item) => item.Title, (source, handle, costlyCard) => PlayCardFromHand(game, handle, costlyCard)); } if (playableEffects.Count > 0) { builder.Answer<uint>("Yes, I would like to trigger an effect on a card I control", 2) .Question("Which effect would you like to trigger?") .LastAnswers(playableEffects, (item) => item.ToString(), (source, handle, cardEffect) => TriggerEffect(source, handle, cardEffect)); } builder.LastAnswer("No, I will pass on taking an action right now", false, (source, handle, number) => PassOnTakingAnAction(source, handle)); } return new EffectHandle(this, builder.ToChoice()); //new ChoosePlayerAction(game, player)); }