public override IEnumerator Play() { // "{PalmreaderCharacter} deals 1 target 2 melee damage." List <SelectCardDecision> firstTargeting = new List <SelectCardDecision>(); IEnumerator meleeCoroutine = base.GameController.SelectTargetsAndDealDamage(base.HeroTurnTakerController, new DamageSource(base.GameController, base.CharacterCard), 2, DamageType.Melee, new int?(1), false, new int?(1), storedResultsDecisions: firstTargeting, selectTargetsEvenIfCannotDealDamage: true, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(meleeCoroutine)); } else { base.GameController.ExhaustCoroutine(meleeCoroutine); } // "If that target was in a play area with a Relay card, {PalmreaderCharacter} deals another target in that play area 2 irreducible psychic damage." if (firstTargeting != null && firstTargeting.Count > 0) { Card firstTarget = firstTargeting.FirstOrDefault().SelectedCard; // Figure out where firstTarget was when it was dealt damage Location playArea = firstTarget.Location; DealDamageJournalEntry damage = Journal.DealDamageEntriesThisTurn().Where((DealDamageJournalEntry ddje) => ddje.TargetCard == firstTarget && ddje.SourceCard == base.CharacterCard && ddje.DamageType == DamageType.Melee && ddje.CardThatCausedDamageToOccur == base.Card).LastOrDefault(); List <MoveCardJournalEntry> movesSince = Journal.MoveCardEntriesThisTurn().Where((MoveCardJournalEntry mcje) => mcje.Card == firstTarget && Journal.GetEntryIndex(mcje) > Journal.GetEntryIndex(damage)).ToList(); if (movesSince.Any()) { MoveCardJournalEntry firstMove = movesSince.FirstOrDefault(); playArea = firstMove.FromLocation; } if (playArea.IsInPlay && NumRelaysAt(playArea) > 0) { IEnumerator projectileCoroutine = base.GameController.SelectTargetsAndDealDamage(base.HeroTurnTakerController, new DamageSource(base.GameController, base.CharacterCard), 2, DamageType.Psychic, new int?(1), false, new int?(1), isIrreducible: true, additionalCriteria: (Card c) => c.Location == playArea && c != firstTarget, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(projectileCoroutine)); } else { base.GameController.ExhaustCoroutine(projectileCoroutine); } } } yield break; }
public IEnumerator PutIntoPlayIfDiscarded(MoveCardAction mca) { // "When this card is discarded from the environment deck, put it into play." if (mca.IsDiscard) { MoveCardJournalEntry entry = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == base.Card && mc.ToLocation.IsTrash select mc).LastOrDefault(); bool accepted = false; if (entry != null && entry.FromLocation.IsEnvironment) { if (entry.FromLocation.IsDeck) { accepted = true; } else if (entry.FromLocation.IsRevealed) { MoveCardJournalEntry revealEntry = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == base.Card && mc.ToLocation.IsRevealed select mc).LastOrDefault(); if (revealEntry != null && revealEntry.FromLocation.IsDeck) { accepted = true; } } } if (accepted) { IEnumerator moveCoroutine = base.GameController.MoveCard(base.TurnTakerController, base.Card, base.TurnTaker.PlayArea, isPutIntoPlay: true, showMessage: false, responsibleTurnTaker: base.TurnTaker, actionSource: mca, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(moveCoroutine)); } else { base.GameController.ExhaustCoroutine(moveCoroutine); } } } yield break; }
public IEnumerator CheckForBulkDiscardedPodResponse(BulkMoveCardsAction bmca) { // "... put that Pod into play." //Log.Debug("TheShelledOneCharacterCardController.CheckForBulkDiscardedPodResponse activated"); //Log.Debug("CheckForBulkDiscardedPodResponse: bmca.IsDiscard: " + bmca.IsDiscard.ToString()); //Log.Debug("CheckForBulkDiscardedPodResponse: bmca.CardsToMove.Any((Card c) => c.DoKeywordsContain(\"pod\", true, true)): " + bmca.CardsToMove.Any((Card c) => c.DoKeywordsContain("pod", true, true)).ToString()); if (bmca.IsDiscard && bmca.CardsToMove.Any((Card c) => c.DoKeywordsContain("pod", true, true))) { Card discardedPod = bmca.CardsToMove.Where((Card c) => c.DoKeywordsContain("pod", true, true)).FirstOrDefault(); // Make sure the Pod was discarded from the villain deck or the villain revealed zone bool flag = false; MoveCardJournalEntry mostRecent = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == discardedPod && mc.ToLocation.IsTrash select mc).LastOrDefault(); /*Log.Debug("CheckForBulkDiscardedPodResponse: mostRecent == null: " + (mostRecent == null).ToString()); * if (mostRecent != null) * { * Log.Debug("CheckForBulkDiscardedPodResponse: mostRecent.FromLocation.IsVillain: " + mostRecent.FromLocation.IsVillain.ToString()); * }*/ if (mostRecent != null && mostRecent.FromLocation.IsVillain) { //Log.Debug("CheckForBulkDiscardedPodResponse: mostRecent.FromLocation.IsDeck: " + mostRecent.FromLocation.IsDeck.ToString()); //Log.Debug("CheckForBulkDiscardedPodResponse: mostRecent.FromLocation.IsRevealed: " + mostRecent.FromLocation.IsRevealed.ToString()); if (mostRecent.FromLocation.IsDeck) { flag = true; } else if (mostRecent.FromLocation.IsRevealed) { MoveCardJournalEntry mostRecentReveal = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == discardedPod && mc.ToLocation.IsRevealed select mc).LastOrDefault(); /*Log.Debug("CheckForBulkDiscardedPodResponse: mostRecentReveal == null: " + (mostRecentReveal == null).ToString()); * if (mostRecentReveal != null) * { * Log.Debug("CheckForBulkDiscardedPodResponse: mostRecentReveal.FromLocation.IsDeck: " + mostRecentReveal.FromLocation.IsDeck.ToString()); * }*/ if (mostRecentReveal != null && mostRecentReveal.FromLocation.IsDeck) { flag = true; } } } //Log.Debug("CheckForBulkDiscardedPodResponse: flag: " + flag.ToString()); //Log.Debug("CheckForBulkDiscardedPodResponse: discarded.DoKeyWordsContain(\"pod\", true, true): " + discardedPod.DoKeywordsContain("pod", true, true).ToString()); // If so, set the "did this already this turn" CardProperty and put it into play if (flag && discardedPod.DoKeywordsContain("pod", true, true)) { SetCardPropertyToTrueIfRealAction(OnePodPerTurn); IEnumerator messageCoroutine = base.GameController.SendMessageAction(base.Card.Title + " plays the first discarded Pod!", Priority.Medium, GetCardSource(), associatedCards: discardedPod.ToEnumerable(), showCardSource: true); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(messageCoroutine)); } else { base.GameController.ExhaustCoroutine(messageCoroutine); } IEnumerator putCoroutine = base.GameController.PlayCard(base.TurnTakerController, discardedPod, isPutIntoPlay: true, responsibleTurnTaker: base.TurnTaker, actionSource: bmca, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(putCoroutine)); } else { base.GameController.ExhaustCoroutine(putCoroutine); } } } yield break; }