using System.Collections; using System.Collections.Generic; using System.Linq; using System; namespace DCGO.CardEffects.EX10 { public class EX10_019 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasSuperAppTraits; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region App Fusion (Mienumon & Sakusimon) if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List() { "Mienumon", "Sakusimon" }, card)); } #endregion #region Link Condition if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.HasAppmonTraits; } cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 3, card: card)); } #endregion #region Link if (timing == EffectTiming.OnDeclaration) { cardEffects.Add(CardEffectFactory.LinkEffect(card)); } #endregion #region Fortitude if (timing == EffectTiming.OnDestroyedAnyone) { cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region On Play/When Digivolving shared bool CanLinkCondition(CardSource cardSource) { return cardSource.HasLevel && cardSource.Level <= 4 && cardSource.CanLinkToTargetPermanent(card.PermanentOfThisCard(), false); } bool CanActivateConditionShared(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanLinkCondition) || card.PermanentOfThisCard().DigivolutionCards.Any(CanLinkCondition)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Link from trash or sources", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[On Play] You may link 1 level 4 or lower Digimon card from your trash or this Digimon's digivolution cards to this Digimon without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanLinkCondition); bool canSelectSources = card.PermanentOfThisCard().DigivolutionCards.Any(CanLinkCondition); if (canSelectSources || canSelectTrash) { if (canSelectTrash && canSelectSources) { List> selectionElements = new List> { new(message: "From trash", value: true, spriteIndex: 0), new(message: "From sources", value: false, spriteIndex: 1), }; string selectPlayerMessage = "From which area do you select a card?"; string notSelectPlayerMessage = "The opponent is choosing from which area to select a card."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); } else { GManager.instance.userSelectionManager.SetBool(canSelectTrash); } yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool fromTrash = GManager.instance.userSelectionManager.SelectedBoolValue; List selectedCards = new List(); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (fromTrash) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanLinkCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to link.", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to link.", "The opponent is selecting 1 digivolution card to link."); selectCardEffect.SetUpCustomMessage_ShowCard("Linked Card"); yield return StartCoroutine(selectCardEffect.Activate()); } else { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanLinkCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 digivolution card to link.", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: card.PermanentOfThisCard().DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to link.", "The opponent is selecting 1 digivolution card to link."); selectCardEffect.SetUpCustomMessage_ShowCard("Linked Card"); yield return StartCoroutine(selectCardEffect.Activate()); } if (selectedCards.Count >= 1) { yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddLinkCard(selectedCards[0], activateClass)); } } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Link from trash or sources", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[When Digivolving] You may link 1 level 4 or lower Digimon card from your trash or this Digimon's digivolution cards to this Digimon without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanLinkCondition); bool canSelectSources = card.PermanentOfThisCard().DigivolutionCards.Any(CanLinkCondition); if (canSelectSources || canSelectTrash) { if (canSelectTrash && canSelectSources) { List> selectionElements = new List> { new(message: "From trash", value: true, spriteIndex: 0), new(message: "From sources", value: false, spriteIndex: 1), }; string selectPlayerMessage = "From which area do you select a card?"; string notSelectPlayerMessage = "The opponent is choosing from which area to select a card."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); } else { GManager.instance.userSelectionManager.SetBool(canSelectTrash); } yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool fromTrash = GManager.instance.userSelectionManager.SelectedBoolValue; List selectedCards = new List(); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (fromTrash) { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanLinkCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to link.", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to link.", "The opponent is selecting 1 digivolution card to link."); selectCardEffect.SetUpCustomMessage_ShowCard("Linked Card"); yield return StartCoroutine(selectCardEffect.Activate()); } else { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanLinkCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 digivolution card to link.", maxCount: 1, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: card.PermanentOfThisCard().DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to link.", "The opponent is selecting 1 digivolution card to link."); selectCardEffect.SetUpCustomMessage_ShowCard("Linked Card"); yield return StartCoroutine(selectCardEffect.Activate()); } if (selectedCards.Count >= 1) { yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddLinkCard(selectedCards[0], activateClass)); } } } } #endregion #region All Turns - OPT if (timing == EffectTiming.WhenLinked) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Suspend 1 Digimon/Tamer, Can't Unsuspend", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("AT_EX10-019"); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When this Digimon gets linked, you may suspend 1 of your opponent's Digimon or Tamers. It can't unsuspend in their next unsuspend phase."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenLinked(hashtable, perm => perm == card.PermanentOfThisCard(), null); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && (permanent.IsDigimon || permanent.IsTamer); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { Permanent selectedPermanent = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Tap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { bool PermanentCondition(Permanent permanent) { return permanent == selectedPermanent; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect( permanentCondition: PermanentCondition, effectDuration: EffectDuration.UntilOwnerActivePhase, activateClass: activateClass, isOnlyActivePhase: true, effectName: "Your Digimon can't unsuspend")); } } } } #endregion #region Link Effect if (timing == EffectTiming.OnTappedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("By trashing 1 link card, trash opponents security", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsLinkedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] When any of your opponent's Digimon suspend, by trashing 1 of this Digimon's link cards, trash your opponent's top security card."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, OpponentsDigimon); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && !card.PermanentOfThisCard().HasNoLinkCards; } bool OpponentsDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { Permanent thisCardPermament = card.PermanentOfThisCard(); CardSource selectedCard = null; #region Select Link Card int maxCount = Math.Min(1, thisCardPermament.LinkedCards.Count); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: _ => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 linked card to trash.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: thisCardPermament.LinkedCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } selectCardEffect.SetUpCustomMessage("Select 1 linked card to trash.", "The opponent is selecting 1 linked card to trash."); yield return StartCoroutine(selectCardEffect.Activate()); #endregion if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashLinkCardsAndProcessAccordingToResult( targetPermanent: thisCardPermament, targetLinkCards: new List() { selectedCard }, activateClass: activateClass, successProcess: SuccessProcess, failureProcess: null)); IEnumerator SuccessProcess(List trashedLinkCards) { if (card.Owner.Enemy.SecurityCards.Count >= 1) { yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity( player: card.Owner.Enemy, destroySecurityCount: 1, cardEffect: activateClass, fromTop: true).DestroySecurity()); } } } } #endregion return cardEffects; } } }