private IEnumerator DiscardAndDrawResponse(TurnTaker turnTaker) { List <DiscardCardAction> storedResults = new List <DiscardCardAction>(); HeroTurnTakerController heroTurnTakerController = base.FindHeroTurnTakerController(turnTaker.ToHero()); IEnumerator coroutine = base.GameController.DiscardHand(heroTurnTakerController, false, storedResults, this.TurnTaker, base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } int numberOfCardsDiscarded = base.GetNumberOfCardsDiscarded(storedResults); if (numberOfCardsDiscarded > 0) { coroutine = base.DrawCards(heroTurnTakerController, numberOfCardsDiscarded); } else { coroutine = base.GameController.SendMessageAction(base.TurnTaker.Name + " did not discard any cards, so no cards will be drawn.", Priority.High, base.GetCardSource()); } if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } yield break; }
private IEnumerator DealDamageResponse(PhaseChangeAction phaseChange) { //Anathema deals the Hero character with the highest HP {H+1} melee damage.. List <DealDamageAction> storedResults = new List <DealDamageAction>(); IEnumerator coroutine = base.DealDamageToHighestHP(base.CharacterCard, 1, (Card c) => c.IsHeroCharacterCard, (Card c) => new int?(base.H + 1), DamageType.Melee, storedResults: storedResults); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } DealDamageAction dd = storedResults.FirstOrDefault(); //If that Hero takes damage this way, they must destroy 1 of their ongoing cards. if (dd != null && dd.DidDealDamage && DidIntendedTargetTakeDamage(new DealDamageAction[] { dd }, dd.OriginalTarget)) { HeroTurnTakerController httc = base.FindHeroTurnTakerController(dd.Target.Owner.ToHero()); coroutine = base.GameController.SelectAndDestroyCard(httc, new LinqCardCriteria((Card c) => c.IsOngoing && c.Owner == dd.Target.Owner, "ongoing"), false, cardSource: base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } yield break; }
#pragma warning restore IDE0060 // Remove unused parameter public IEnumerator MoveAndFlipResponse(HeroTurnTaker hero, Card card) { HeroTurnTakerController decisionMaker = this.FindHeroTurnTakerController(hero); IEnumerator coroutine; if (card.IsMissionCard) { coroutine = this.GameController.SendMessageAction("Mission cards cannot be flipped face-down, so it is played as normal.", Priority.Low, this.GetCardSource()); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } } coroutine = this.GameController.MoveCard(decisionMaker, card, hero.PlayArea, false, false, card.IsMissionCard, responsibleTurnTaker: decisionMaker.TurnTaker, flipFaceDown: !card.IsMissionCard, cardSource: this.GetCardSource()); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } }
private IEnumerator AdvancedResponse(DealDamageAction dd) { //That player must discard a card. HeroTurnTakerController hero = FindHeroTurnTakerController(dd.Target.Owner.ToHero()); return(GameController.SelectAndDiscardCard(hero, cardSource: GetCardSource())); }
private IEnumerator DealDamageResponse(PhaseChangeAction phaseChange) { //Anathema deals each Hero target 2 projectile damage. List <DealDamageAction> storedResults = new List <DealDamageAction>(); IEnumerator coroutine = base.DealDamage(base.CharacterCard, (Card card) => card.IsHero && card.IsTarget, 2, DamageType.Projectile, storedResults: storedResults); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } //Heroes that take damage this way must destroy 1 of their equipment cards. foreach (DealDamageAction dd in storedResults) { if (dd.DidDealDamage && dd.Target.IsHeroCharacterCard) { HeroTurnTakerController httc = base.FindHeroTurnTakerController(dd.Target.Owner.ToHero()); coroutine = base.GameController.SelectAndDestroyCard(httc, new LinqCardCriteria((Card c) => base.IsEquipment(c) && c.Owner == dd.Target.Owner, "equipment"), false, cardSource: base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } } yield break; }
private IEnumerator SearchForConstellationAndShuffleDeck(HeroTurnTakerController httc) { //we pre search the decks to control the locations, otherwise SearchForCard will ask which you to search locations that don't have the card, and Exodus doesn't have the restriction. bool hasConstellationInTrash = httc.HasCardsWhere(c => IsConstellation(c) && c.IsInTrash); bool hasConstellationInDeck = httc.HasCardsWhere(c => IsConstellation(c) && c.IsInDeck); //if not anywhere, set deck to true so we get the nice no cards found message if (!hasConstellationInTrash && !hasConstellationInDeck) { hasConstellationInDeck = true; } IEnumerator search = SearchForCards(httc, hasConstellationInDeck, hasConstellationInTrash, 1, 1, new LinqCardCriteria((Card c) => IsConstellation(c)), putIntoPlay: true, putInHand: false, putOnDeck: false, shuffleAfterwards: false); IEnumerator shuffle = ShuffleDeck(httc, httc.TurnTaker.Deck); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(search)); yield return(GameController.StartCoroutine(shuffle)); } else { GameController.ExhaustCoroutine(search); GameController.ExhaustCoroutine(shuffle); } yield break; }
public IEnumerator SelectAndMoveCardOptional(HeroTurnTakerController hero, Func <Card, bool> criteria, Location toLocation, bool toBottom = false, bool optional = false, bool isPutIntoPlay = false, bool playIfMovingToPlayArea = true, List <SelectCardDecision> storedResults = null, CardSource cardSource = null) { BattleZone battleZone = null; if (cardSource != null) { battleZone = cardSource.BattleZone; } SelectCardDecision selectCardDecision = new SelectCardDecision(this.GameController, hero, SelectionType.MoveCard, this.GameController.FindCardsWhere(criteria, true, null, battleZone), optional, false, null, null, null, null, null, false, true, cardSource, null); selectCardDecision.BattleZone = battleZone; if (storedResults != null) { storedResults.Add(selectCardDecision); } IEnumerator coroutine = this.GameController.SelectCardAndDoAction(selectCardDecision, (SelectCardDecision d) => this.GameController.MoveCard(hero, d.SelectedCard, toLocation, toBottom, isPutIntoPlay, playIfMovingToPlayArea, null, false, null, null, null, false, false, null, false, false, false, false, cardSource), true); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } yield break; }
public override TurnTakerController AskIfTurnTakerControllerIsReplaced(TurnTakerController ttc, CardSource cardSource) { //This is what handles the "as if it were their card" part of the instructions //Since CardController.CharacterCard ultimately goes through TurnTakerController.CharacterCard, //this usually handles swapping out hero names too. HeroTurnTakerController receiverTTC = _receiverController; HeroTurnTaker receiver = receiverTTC.HeroTurnTaker; if (cardSource != null && cardSource.Card.Owner != receiver && cardSource.AllowReplacements) { Card cardWithoutReplacements = cardSource.CardController.CardWithoutReplacements; TurnTakerController ttcWithoutReplacements = FindCardController(_passedCard).TurnTakerControllerWithoutReplacements; if (ttc == ttcWithoutReplacements) { if (cardWithoutReplacements == _passedCard) { return(receiverTTC); } if (cardSource.CardSourceChain.Any((CardSource cs) => cs.CardController == this)) { return(receiverTTC); } } } return(null); }
protected void AddDestroyEnvironmentCardCounterAttackTrigger(HeroTurnTakerController decisionMaker, Card target, CardSource cardsource) { Func <DealDamageAction, bool> criteria = (DealDamageAction dd) => dd.Target == target; Func <DealDamageAction, IEnumerator> response = (DealDamageAction dd) => this.GameController.DestroyCards(decisionMaker, new LinqCardCriteria(c => c.IsEnvironment, "environment"), autoDecide: true, cardSource: cardsource); GameController.AddTrigger <DealDamageAction>(new Trigger <DealDamageAction>(this.GameController, criteria, response, new TriggerType[] { TriggerType.DestroyCard }, TriggerTiming.After, cardsource)); }
public override IEnumerator Play() { //When this card enters play, the hero with the lowest HP must discard X cards, where X is the number of environment cards to the left of this one. List <Card> storedResults = new List <Card>(); IEnumerator coroutine = base.GameController.FindTargetWithLowestHitPoints(1, (Card c) => c.IsHeroCharacterCard, storedResults, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (DidFindCard(storedResults)) { Card heroCard = storedResults.First(); HeroTurnTakerController hero = FindHeroTurnTakerController(heroCard.Owner.ToHero()); int?X = GetNumberOfCardsToTheLeftOfThisOne(base.Card); coroutine = base.GameController.SelectAndDiscardCards(hero, X, false, X, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } yield break; }
public IEnumerator MoveItToTheBottomOfItsDeckResponse(DestroyCardAction d, HeroTurnTaker hero, StatusEffect effect, int[] powerNumerals = null) { //...you may move it to the bottom of its deck. if (d.PostDestroyDestinationCanBeChanged) { var storedResults = new List <YesNoCardDecision>(); HeroTurnTakerController httc = null; if (hero != null) { httc = FindHeroTurnTakerController(hero); } var e = this.GameController.MakeYesNoCardDecision(httc, SelectionType.MoveCardToHand, d.CardToDestroy.Card, storedResults: storedResults, cardSource: GetCardSource()); if (UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(e)); } else { this.GameController.ExhaustCoroutine(e); } if (DidPlayerAnswerYes(storedResults)) { var nativeDeck = d.CardToDestroy.Card.NativeDeck; var hand = nativeDeck.OwnerTurnTaker.ToHero().Hand; d.SetPostDestroyDestination(hand, false, storedResults.CastEnumerable <YesNoCardDecision, IDecision>(), cardSource: GetCardSource()); } } }
private IEnumerator IncreaseOrDiscardResponse(DealDamageAction action) { HeroTurnTakerController target = base.FindHeroTurnTakerController(action.Target.Owner.ToHero()); List <DiscardCardAction> storedResults = new List <DiscardCardAction>(); IEnumerator coroutine = base.GameController.SelectAndDiscardCards(base.FindHeroTurnTakerController(action.Target.Owner.ToHero()), new int?(1), true, new int?(1), storedResults: storedResults); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (DidDiscardCards(storedResults, 0)) { coroutine = base.GameController.IncreaseDamage(action, 1, cardSource: base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } yield break; }
private IEnumerator StartOfHeroResponse(PhaseChangeAction pca) { HeroTurnTakerController httc = base.FindHeroTurnTakerController(pca.ToPhase.TurnTaker.ToHero()); //that hero uses their innate power twice, IEnumerator power1 = base.UsePowerOnOtherCard(base.GetCardThisCardIsNextTo()); IEnumerator power2 = base.UsePowerOnOtherCard(base.GetCardThisCardIsNextTo()); //then immediately end their turn, IEnumerator endTurn = base.GameController.ImmediatelyEndTurn(httc, base.GetCardSource()); //draw a card IEnumerator draw = base.DrawCard(httc.HeroTurnTaker); //destroy this card. IEnumerator destroy = base.DestroyThisCardResponse(pca); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(power1)); yield return(base.GameController.StartCoroutine(power2)); yield return(base.GameController.StartCoroutine(endTurn)); yield return(base.GameController.StartCoroutine(draw)); yield return(base.GameController.StartCoroutine(destroy)); } else { base.GameController.ExhaustCoroutine(power1); base.GameController.ExhaustCoroutine(power2); base.GameController.ExhaustCoroutine(endTurn); base.GameController.ExhaustCoroutine(draw); base.GameController.ExhaustCoroutine(destroy); } yield break; }
private IEnumerator MoveCardToDeckResponse(TurnTakerController turnTakerController) { TurnTaker turnTaker = turnTakerController.TurnTaker; //allow each hero to choose for themselves, TangoOne decides for the villain and environment deck. HeroTurnTakerController decisionMaker = turnTaker.IsHero ? turnTakerController.ToHero() : this.DecisionMaker; var scsd = new SelectCardsDecision(GameController, decisionMaker, c => c.Location == turnTaker.Trash, SelectionType.ShuffleCardFromTrashIntoDeck, numberOfCards: CardsToMoveFromTrash, isOptional: false, requiredDecisions: CardsToMoveFromTrash, allowAutoDecide: true, cardSource: GetCardSource()); IEnumerator coroutine = GameController.SelectCardsAndDoAction(scsd, scd => GameController.MoveCard(decisionMaker, scd.SelectedCard, turnTaker.Deck, cardSource: GetCardSource()), cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } coroutine = base.GameController.ShuffleLocation(turnTaker.Deck, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } }
private void AddReduceDamageOfDamageTypeTrigger(HeroTurnTakerController httc, DamageType damageType, int amount) { ReduceDamageStatusEffect reduceDamageStatusEffect = new ReduceDamageStatusEffect(amount); reduceDamageStatusEffect.DamageTypeCriteria.AddType(damageType); reduceDamageStatusEffect.NumberOfUses = 1; this.RunCoroutine(this.GameController.AddStatusEffect(reduceDamageStatusEffect, true, new CardSource(httc.CharacterCardController))); }
private SelectCardDecision WasDamagedSelection(HeroTurnTakerController httc) { return(new SelectCardDecision(httc.GameController, httc, SelectionType.MoveCardToPlayArea, httc.GetCardsAtLocation(httc.HeroTurnTaker.Trash), isOptional: true, allowAutoDecide: true, additionalCriteria: IsEquipmentOrOngoing, cardSource: GetCardSource())); }
protected void AddIncreaseDamageOfDamageTypeTrigger(HeroTurnTakerController httc, DamageType damageType, int amount) { IncreaseDamageStatusEffect increaseDamageStatusEffect = new IncreaseDamageStatusEffect(amount); increaseDamageStatusEffect.DamageTypeCriteria.AddType(damageType); increaseDamageStatusEffect.NumberOfUses = 1; this.RunCoroutine(this.GameController.AddStatusEffect(increaseDamageStatusEffect, true, new CardSource(httc.CharacterCardController))); }
private IEnumerator StartOfTurnPhaseShiftResponse(PhaseChangeAction pca) { TurnTaker heroTT = pca.GameController.ActiveTurnTaker; HeroTurnTakerController heroTTC = pca.GameController.ActiveTurnTakerController.ToHero(); List <YesNoCardDecision> storedResults = new List <YesNoCardDecision>(); IEnumerator routine = base.GameController.MakeYesNoCardDecision(heroTTC, YesNoSelectionType, this.Card, storedResults: storedResults, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(routine)); } else { base.GameController.ExhaustCoroutine(routine); } if (!base.DidPlayerAnswerYes(storedResults)) { yield break; } var extraAction = new IncreasePhaseActionCountStatusEffect(1); extraAction.UntilThisTurnIsOver(Game); extraAction.ToTurnPhaseCriteria.Phase = PhaseToIncrease; extraAction.ToTurnPhaseCriteria.TurnTaker = GameController.ActiveTurnTaker; extraAction.CardSource = this.Card; routine = AddStatusEffect(extraAction); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(routine)); } else { base.GameController.ExhaustCoroutine(routine); } var skippedAction = new PreventPhaseActionStatusEffect(); skippedAction.UntilThisTurnIsOver(Game); skippedAction.ToTurnPhaseCriteria.Phase = PhaseToSkip; skippedAction.ToTurnPhaseCriteria.TurnTaker = GameController.ActiveTurnTaker; skippedAction.CardSource = this.Card; routine = AddStatusEffect(skippedAction); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(routine)); } else { base.GameController.ExhaustCoroutine(routine); } yield break; }
private bool HasHeroBeenDealtDamageByBlisterSinceStartOfLastBlisterTurn(HeroTurnTakerController httc) { int turnIndexOfBlister = GameController.AllTurnTakers.ToList().IndexOf(TurnTaker); bool hasBeenDealtDamage = (from e in Game.Journal.DealDamageEntries() where httc.CharacterCards.Contains(e.TargetCard) && e.SourceCard == CharacterCard && ((e.Round == Game.Round && e.TurnIndex >= turnIndexOfBlister) || (e.Round < Game.Round && e.TurnIndex < turnIndexOfBlister)) select e).Any(); return(hasBeenDealtDamage); }
public override IEnumerator Play() { //Find the hero with the most cards in hand List <TurnTaker> storedResults = new List <TurnTaker>(); IEnumerator coroutine = base.FindHeroWithMostCardsInHand(storedResults, 1, 1, null, null, false, false); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } TurnTaker turnTaker = storedResults.FirstOrDefault <TurnTaker>(); if (turnTaker != null) { //Anathema deals the Hero target with the most cards in hand {H-1} melee damage. HeroTurnTakerController hero = base.FindHeroTurnTakerController(turnTaker as HeroTurnTaker); IEnumerator coroutine2 = base.DealDamage(base.CharacterCard, hero.CharacterCard, base.H - 1, DamageType.Melee, false, false, false, null, null, null, false, base.GetCardSource(null)); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine2)); } else { base.GameController.ExhaustCoroutine(coroutine2); } } //Until the start of the next Villain Turn, increase damage dealt by Villain targets by 1 and reduce damage dealt to Villain targets by 1. ReduceDamageStatusEffect reduceDamageStatusEffect = new ReduceDamageStatusEffect(1); reduceDamageStatusEffect.TargetCriteria.IsVillain = true;; reduceDamageStatusEffect.UntilStartOfNextTurn(this.TurnTaker); IEnumerator reduceCoroutine = this.AddStatusEffect(reduceDamageStatusEffect, true); IncreaseDamageStatusEffect increaseDamageStatusEffect = new IncreaseDamageStatusEffect(1); increaseDamageStatusEffect.SourceCriteria.IsVillain = true;; increaseDamageStatusEffect.UntilStartOfNextTurn(this.TurnTaker); IEnumerator increaseCoroutine = this.AddStatusEffect(increaseDamageStatusEffect, true); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(reduceCoroutine)); yield return(this.GameController.StartCoroutine(increaseCoroutine)); } else { this.GameController.ExhaustCoroutine(reduceCoroutine); this.GameController.ExhaustCoroutine(increaseCoroutine); } yield break; }
public override IEnumerator Play() { List <DiscardCardAction> storedResults = new List <DiscardCardAction>(); IEnumerator discardCardRoutine = this.GameController.EachPlayerDiscardsCards(0, 1, storedResults, cardSource: GetCardSource()); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(discardCardRoutine)); } else { this.GameController.ExhaustCoroutine(discardCardRoutine); } foreach (DiscardCardAction dca in storedResults.Where(dca => dca.WasCardDiscarded)) { Debug.WriteLine("DEBUG: card was discarded"); List <YesNoCardDecision> storedYesNoResults = new List <YesNoCardDecision>(); HeroTurnTaker owner = dca.CardToDiscard.Owner.ToHero(); HeroTurnTakerController httc = FindHeroTurnTakerController(owner); //ask player if they want to reveal cards IEnumerator coroutine = base.GameController.MakeYesNoCardDecision(httc, SelectionType.RevealCardsFromDeck, base.Card, storedResults: storedYesNoResults, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (base.DidPlayerAnswerYes(storedYesNoResults)) { //reveal the top 3 cards of their deck, put 1 in their hand, 1 on the bottom of their deck, and 1 in their trash. IEnumerator orderedDestinationsRoutine = this.CustomizedRevealCardsFromDeckToMoveToOrderedDestinations(httc, owner.Deck, new[] { new MoveCardDestination(owner.Hand), new MoveCardDestination(owner.Deck, true), new MoveCardDestination(owner.Trash) }, sendCleanupMessageIfNecessary: true); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(orderedDestinationsRoutine)); } else { this.GameController.ExhaustCoroutine(orderedDestinationsRoutine); } } } yield break; }
private IEnumerator DiscardAndDrawResponse(TurnTaker turnTaker) { HeroTurnTakerController heroTurnTakerController = base.FindHeroTurnTakerController(turnTaker.ToHero()); //ask the selected player if they want to discard and draw YesNoDecision yesNo = new YesNoDecision(base.GameController, heroTurnTakerController, SelectionType.DiscardAndDrawCard, cardSource: GetCardSource()); IEnumerator coroutine = base.GameController.MakeDecisionAction(yesNo); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (!DidPlayerAnswerYes(yesNo)) { yield break; } //discard hand List <DiscardCardAction> storedResults = new List <DiscardCardAction>(); coroutine = base.GameController.DiscardHand(heroTurnTakerController, false, storedResults, turnTaker, GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } //draw same number of cards int numberOfCardsDiscarded = base.GetNumberOfCardsDiscarded(storedResults); if (numberOfCardsDiscarded > 0) { coroutine = base.DrawCards(heroTurnTakerController, numberOfCardsDiscarded); } else { coroutine = base.GameController.SendMessageAction(base.TurnTaker.Name + " did not discard any cards, so no cards will be drawn.", Priority.High, base.GetCardSource()); } if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } yield break; }
private IEnumerator DiscardAllBut1CardResponse(HeroTurnTakerController httc) { return(base.GameController.SelectCardsFromLocationAndMoveThem(httc, httc.HeroTurnTaker.Hand, null, httc.NumberOfCardsInHand - 1, new LinqCardCriteria(card => card.Location == httc.HeroTurnTaker.Hand && GameController.IsLocationVisibleToSource(card.Location, GetCardSource()), "hand"), new[] { new MoveCardDestination(httc.TurnTaker.Trash) }, isDiscardIfMovingToTrash: true, cancelDecisionsIfTrue: () => httc.HeroTurnTaker.NumberOfCardsInHand <= 1, selectionType: SelectionType.DiscardCard, cardSource: base.GetCardSource())); }
private IEnumerator RevealCardsResponse(TurnTakerController ttc) { //get this turntaker's deck Location deck = ttc.TurnTaker.Deck; HeroTurnTakerController httc = base.FindHeroTurnTakerController(ttc.TurnTaker.ToHero()); List <Card> storedResultsCard = new List <Card>(); //reveal the top card of the deck IEnumerator coroutine = base.GameController.RevealCards(ttc, deck, 1, storedResultsCard, cardSource: base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } Card card = storedResultsCard.FirstOrDefault <Card>(); if (card != null) { //turntakercontroller decides whether to put on top or bottom of deck List <MoveCardDestination> list = new List <MoveCardDestination>(); //top of deck list.Add(new MoveCardDestination(deck)); //bottom of deck list.Add(new MoveCardDestination(deck, true)); coroutine = base.GameController.SelectLocationAndMoveCard(httc, card, list, cardSource: base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } //clean up any revealed cards that should not be in play any more coroutine = base.CleanupCardsAtLocations(new List <Location> { deck.OwnerTurnTaker.Revealed }, deck, cardsInList: storedResultsCard); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } yield break; }
private IEnumerator SelectAndPlayConstellationFromTrash(HeroTurnTakerController hero) { IEnumerator coroutine = GameController.SelectAndPlayCard(hero, GetPlayableConstellationsInTrash(), cardSource: GetCardSource()); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } yield break; }
private IEnumerator GainHPResponse(PlayCardAction pca) { // "Whenever a player plays a hero card, if it's a One-Shot, their hero regains 2 HP. If not, 1 non-Terrain villain target with less than its maximum HP regains 2 HP." if (pca.WasCardPlayed) { if (pca.CardToPlay.DoKeywordsContain("one-shot")) { // "... their hero regains 2 HP." HeroTurnTakerController playing = pca.TurnTakerController.ToHero(); TurnTaker player = pca.TurnTakerController.TurnTaker; List <Card> resultsHeroCharacter = new List <Card>(); // The player chooses one of their hero characters to regain HP (stored in resultsHeroCharacter) IEnumerator chooseHeroCoroutine = base.FindCharacterCard(player, SelectionType.GainHP, resultsHeroCharacter); if (base.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(chooseHeroCoroutine)); } else { this.GameController.ExhaustCoroutine(chooseHeroCoroutine); } // That hero regains 2 HP IEnumerator healHeroCoroutine = base.GameController.GainHP(resultsHeroCharacter.First(), 2, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(healHeroCoroutine)); } else { this.GameController.ExhaustCoroutine(healHeroCoroutine); } } else { // "... 1 non-Terrain villain target with less than its maximum HP regains 2 HP." IEnumerator healVillainCoroutine = base.GameController.SelectAndGainHP(base.DecisionMaker, 2, additionalCriteria: (Card c) => c.IsVillainTarget && c.HitPoints < c.MaximumHitPoints && !c.DoKeywordsContain("terrain"), numberOfTargets: 1, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(healVillainCoroutine)); } else { this.GameController.ExhaustCoroutine(healVillainCoroutine); } } } yield break; }
private IEnumerable <Function> ChoiceFunction(HeroTurnTakerController httc) { var drawACard = new Function(httc, "Draw a card", SelectionType.DrawCard, () => this.DrawCard(httc.HeroTurnTaker), CanDrawCards(httc)); var criteria = new LinqCardCriteria(c => IsEquipment(c) || c.IsOngoing, "equipment or ongoing"); var coroutine = this.GameController.SelectCardFromLocationAndMoveIt(httc, httc.HeroTurnTaker.Trash, criteria, new[] { new MoveCardDestination(httc.HeroTurnTaker.Deck) }, cardSource: this.GetCardSource()); var pullFromTrash = new Function(httc, "Select an Equipment or Ongoing from the trash to put on top of your deck", SelectionType.MoveCardOnDeck, () => coroutine, httc.HeroTurnTaker.Trash.HasCards); return(new Function[] { drawACard, pullFromTrash }); }
private IEnumerator YesAction(HeroTurnTakerController hero, YesNoDecision decision, List <DrawCardAction> storedDraw) { IEnumerator coroutine = base.DrawCards(hero, 2, storedResults: storedDraw); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } yield break; }
private IEnumerator SelectAndPutInPlayConstellationFromTrash(HeroTurnTakerController hero, TurnPhase turnPhase) { var coroutine = GameController.SelectAndPlayCard(hero, GetPuttableConstellationsFromTrash(hero, turnPhase), optional: false, isPutIntoPlay: true, cardSource: GetCardSource()); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } yield break; }
private IEnumerator Discard2ToDestroyRoom(PhaseChangeAction phaseChange) { if (phaseChange.ToPhase.TurnTaker.IsHero) { //...that hero... HeroTurnTakerController heroTurnTakerController = base.GameController.FindHeroTurnTakerController(phaseChange.ToPhase.TurnTaker.ToHero()); if (heroTurnTakerController.NumberOfCardsInHand >= 2) { //... may discard 2 cards... List <DiscardCardAction> storedResults = new List <DiscardCardAction>(); IEnumerator coroutine = base.SelectAndDiscardCards(heroTurnTakerController, 2, true, storedResults: storedResults); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (base.DidDiscardCards(storedResults, 2)) { //... to destroy a Room in play. IEnumerator coroutine2 = base.GameController.SelectAndDestroyCard(this.DecisionMaker, new LinqCardCriteria((Card c) => c.IsRoom, "room"), false, cardSource: base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine2)); } else { base.GameController.ExhaustCoroutine(coroutine2); } } } else { //send message if not enough cards in hand IEnumerator coroutine3 = base.GameController.SendMessageAction(heroTurnTakerController.Name + " does not have enough cards in their hand to discard for " + base.Card.Title + ".", Priority.Low, base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine3)); } else { base.GameController.ExhaustCoroutine(coroutine3); } } } yield break; }