using System; using System.Collections; using System.Collections.Generic; using System.Linq; // Xeno namespace DCGO.CardEffects.EX11 { public class EX11_066 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Name Rule if (timing == EffectTiming.None) { ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass(); changeCardNamesClass.SetUpICardEffect("Also treated as [Zenith]", CanUseCondition, card); changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames); cardEffects.Add(changeCardNamesClass); bool CanUseCondition(Hashtable hashtable) { return true; } List changeCardNames(CardSource cardSource, List CardNames) { if (cardSource == card) { CardNames.Add("Zenith"); } return CardNames; } } #endregion #region Shared OP / SOYMP string SharedEffectName = "Trash 1 [Vemmon] in text to and gain 1 memory"; CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, SharedEffectName, SharedActivateCoroutine, SharedEffectDescription, additionalActivateCondition: AdditionalActivateCondition, optional: false, isSkippable: true, maxCountPerTurn: -1, onPlay: true, startOfYourMainPhase: true); string SharedEffectDescription(string tag) => $"[{tag}] By trashing 1 card with [Vemmon] in its text from your hand, and gain 1 memory."; bool AdditionalActivateCondition(Hashtable hashtable, ActivateClass activateClass) { return card.Owner.HandCards.Count(HasVemmonArchetype) >= 1; } bool HasVemmonArchetype(CardSource cardSource) => cardSource.HasText("Vemmon"); IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: HasVemmonArchetype, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, mode: SelectHandEffect.Mode.Discard, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 Card to trash.", "The opponent is selecting 1 card to trash from their hand."); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Count >= 1) { yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw()); yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass)); } } } #endregion #region All Turns if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Reveal 2. Place all [Vemmon] under played or digivolved digimon, trash the rest.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() => "[All Turns] When your Digimon are played or digivolve, if any of them have [Vemmon] in their texts, by suspending this Tamer, reveal the top 2 cards of your deck. Place all [Vemmon] among them as any of those Digimon's bottom digivolution card. Trash the rest."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition) || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition)); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanActivateSuspendCostEffect(card); } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.HasText("Vemmon"); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List { card.PermanentOfThisCard() }, hashtable).Tap()); if (card.Owner.LibraryCards.Count >= 1) { List playedPermanents = new List(); foreach (Hashtable hash in CardEffectCommons.GetHashtablesFromHashtable(hashtable)) { playedPermanents.Add(CardEffectCommons.GetPermanentFromHashtable(hash)); } List targetPermanents = playedPermanents.Filter(PermanentCondition); List selectedCards = new List(); if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, targetPermanents.Contains)) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll( revealCount: 2, simplifiedSelectCardCondition: new SimplifiedSelectCardConditionClass( canTargetCondition: cardSource => cardSource.EqualsCardName("Vemmon"), message: "", mode: SelectCardEffect.Mode.Custom, maxCount: -1, selectCardCoroutine: SelectCardCoroutine), remainingCardsPlace: RemainingCardsPlace.Trash, activateClass: activateClass )); IEnumerator SelectCardCoroutine(CardSource cardSource) { if (cardSource != null) selectedCards.Add(cardSource); yield return null; } if (selectedCards.Count > 0) { while (selectedCards.Any()) { Permanent selectedPermament = null; if (targetPermanents.Count > 1) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, targetPermanents.Contains)); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: permanent => targetPermanents.Contains(permanent), canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermament = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get the digivolution cards.", "The opponent is selecting 1 Digimon that will get the digivolution cards."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } else selectedPermament = targetPermanents[0]; if (selectedPermament != null) { List digivolutionCards_fixed = new List(); if (selectedCards.Count > 1) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: (cardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: CanEndSelectCondition, canNoSelect: () => false, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, message: "Specify the order to place the cards in the digivolution cards\n(cards will be placed so that cards with lower numbers are on top).", maxCount: selectedCards.Count, canEndNotMax: true, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: selectedCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUseFaceDown(); // This seems to have fixed soft lock issue where sometimes some revealed vemmon were not selectable selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards"); bool CanEndSelectCondition(List cardSources) { return !CardEffectCommons.HasNoElement(cardSources); } yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { digivolutionCards_fixed.AddRange(cardSources); selectedCards.RemoveAll(cardSources.Contains); yield return null; } yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect2(digivolutionCards_fixed, "Digivolution Cards", true, true)); yield return ContinuousController.instance.StartCoroutine(selectedPermament.AddDigivolutionCardsBottom(digivolutionCards_fixed, activateClass)); } else { digivolutionCards_fixed.AddRange(selectedCards); selectedCards.Clear(); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect2(digivolutionCards_fixed, "Digivolution Cards", true, true)); yield return ContinuousController.instance.StartCoroutine(selectedPermament.AddDigivolutionCardsBottom(digivolutionCards_fixed, activateClass)); } } } } } else { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll( revealCount: 2, simplifiedSelectCardCondition: new SimplifiedSelectCardConditionClass( canTargetCondition: _ => false, message: "", mode: SelectCardEffect.Mode.Custom, maxCount: -1, selectCardCoroutine: null), remainingCardsPlace: RemainingCardsPlace.Trash, activateClass: activateClass )); } } } } #endregion #region Security if (timing == EffectTiming.SecuritySkill) { cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card)); } #endregion return cardEffects; } } }