x89rt2 2 месяцев назад
Родитель
Сommit
f14afc7058

+ 169 - 498
Assets/Scripts/CardEffect/BT11/Purple/BT11_088.cs

@@ -11,563 +11,234 @@ namespace DCGO.CardEffects.BT11
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            if (timing == EffectTiming.OnEnterFieldAnyone)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Look at opponent's hand or place 1 Digimon under other Digimon as its bottom digivolution card.", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
-                cardEffects.Add(activateClass);
+            #region Shared OP/WD
+            string SharedEffectName = "Depending on enemy Digimon count, look at opponent's hand and trash 1 or place 1 enemy Digimon under 1 other Digimon";
 
-                string EffectDiscription()
-                {
-                    return "[On Play] If your opponent has 1 or fewer Digimon in play, look at your opponent's hand and trash 1 card in it. If your opponent has 2 or more Digimon in play, place 1 of your opponent's Digimon under 1 of your opponent's other Digimon as its bottom digivolution card.";
-                }
+            CardEffectFactory.ActivateClassesForSharedEffects
+                (ref cardEffects, timing, card,
+                    SharedEffectName,
+                    SharedActivateCoroutine,
+                    SharedEffectDescription,
+                    optional: false,
+                    onPlay: true,
+                    whenDigivolving: true);
 
-                bool CanSelectPermanentCondition(Permanent permanent)
-                {
-                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
-                }
+            string SharedEffectDescription(string tag) => $"[{tag}] If your opponent has 1 or fewer Digimon in play, look at your opponent's hand and trash 1 card in it. If your opponent has 2 or more Digimon in play, place 1 of your opponent's Digimon under 1 of your opponent's other Digimon as its bottom digivolution card.";
 
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
-                }
+            bool CanSelectPermanentCondition(Permanent permanent)
+            {
+                return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
+            }
 
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
+            IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                if (card.Owner.Enemy.GetBattleAreaDigimons().Count <= 1
+                && card.Owner.Enemy.HandCards.Count >= 1)
+                {
+                    SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                    selectCardEffect.SetUp(
+                        canTargetCondition: (cardSource) => true,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        canNoSelect: () => false,
+                        selectCardCoroutine: null,
+                        afterSelectCardCoroutine: null,
+                        message: "Select 1 card to discard from opponent's hand.",
+                        maxCount: 1,
+                        canEndNotMax: false,
+                        isShowOpponent: true,
+                        mode: SelectCardEffect.Mode.Discard,
+                        root: SelectCardEffect.Root.Custom,
+                        customRootCardList: card.Owner.Enemy.HandCards,
+                        canLookReverseCard: true,
+                        selectPlayer: card.Owner,
+                        cardEffect: null);
+
+                    selectCardEffect.SetUpCustomMessage("Select 1 card to discard from opponent's hand.", "The opponent is selecting 1 card to discard from your hand.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                }
+
+                if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2)
+                {
+                    Permanent selectedPermanent = null;
+
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                    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.Custom,
+                        cardEffect: activateClass);
+
+                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that place under other Digimon's digivolution cards.", "The opponent is selecting 1 Digimon that place under other Digimon's digivolution cards.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
                     {
-                        if (card.Owner.Enemy.GetBattleAreaDigimons().Count <= 1)
-                        {
-                            if (card.Owner.Enemy.HandCards.Count >= 1)
-                            {
-                                return true;
-                            }
-                        }
+                        selectedPermanent = permanent;
 
-                        if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2)
-                        {
-                            if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                            {
-                                return true;
-                            }
-                        }
+                        yield return null;
                     }
 
-                    return false;
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.Enemy.GetBattleAreaDigimons().Count <= 1)
+                    if (selectedPermanent != null)
                     {
-                        if (card.Owner.Enemy.HandCards.Count >= 1)
+                        bool CanSelectPermanentCondition1(Permanent permanent)
                         {
-                            SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
-
-                            selectCardEffect.SetUp(
-                                        canTargetCondition: (cardSource) => true,
-                                        canTargetCondition_ByPreSelecetedList: null,
-                                        canEndSelectCondition: null,
-                                        canNoSelect: () => false,
-                                        selectCardCoroutine: null,
-                                        afterSelectCardCoroutine: null,
-                                        message: "Select 1 card to discard from opponent's hand.",
-                                        maxCount: 1,
-                                        canEndNotMax: false,
-                                        isShowOpponent: true,
-                                        mode: SelectCardEffect.Mode.Discard,
-                                        root: SelectCardEffect.Root.Custom,
-                                        customRootCardList: card.Owner.Enemy.HandCards,
-                                        canLookReverseCard: true,
-                                        selectPlayer: card.Owner,
-                                        cardEffect: null);
-
-                            selectCardEffect.SetUpCustomMessage("Select 1 card to discard from opponent's hand.", "The opponent is selecting 1 card to discard from your hand.");
-
-                            yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                            return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
+                                && permanent != selectedPermanent
+                                && !permanent.IsToken;
                         }
-                    }
 
-                    if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2)
-                    {
-                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectPermanentCondition1,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: 1,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            selectPermanentCoroutine: SelectPermanentCoroutine1,
+                            afterSelectPermanentCoroutine: null,
+                            mode: SelectPermanentEffect.Mode.Custom,
+                            cardEffect: activateClass);
+
+                        selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get digivolution cards.", "The opponent is selecting 1 Digimon that will get digivolution cards.");
+
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                        IEnumerator SelectPermanentCoroutine1(Permanent permanent)
                         {
-                            Permanent selectedPermanent = null;
-
-                            int maxCount = 1;
-
-                            SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
-                            selectPermanentEffect.SetUp(
-                                selectPlayer: card.Owner,
-                                canTargetCondition: CanSelectPermanentCondition,
-                                canTargetCondition_ByPreSelecetedList: null,
-                                canEndSelectCondition: null,
-                                maxCount: maxCount,
-                                canNoSelect: false,
-                                canEndNotMax: false,
-                                selectPermanentCoroutine: SelectPermanentCoroutine,
-                                afterSelectPermanentCoroutine: null,
-                                mode: SelectPermanentEffect.Mode.Custom,
-                                cardEffect: activateClass);
-
-                            selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that place under other Digimon's digivolution cards.", "The opponent is selecting 1 Digimon that place under other Digimon's digivolution cards.");
-
-                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                            IEnumerator SelectPermanentCoroutine(Permanent permanent)
-                            {
-                                selectedPermanent = permanent;
-
-                                yield return null;
-                            }
-
-                            if (selectedPermanent != null)
-                            {
-                                bool CanSelectPermanentCondition1(Permanent permanent)
-                                {
-                                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
-                                    {
-                                        if (permanent != selectedPermanent)
-                                        {
-                                            if (!permanent.IsToken)
-                                            {
-                                                return true;
-                                            }
-                                        }
-                                    }
-
-                                    return false;
-                                }
-
-                                maxCount = 1;
-
-                                selectPermanentEffect.SetUp(
-                                    selectPlayer: card.Owner,
-                                    canTargetCondition: CanSelectPermanentCondition1,
-                                    canTargetCondition_ByPreSelecetedList: null,
-                                    canEndSelectCondition: null,
-                                    maxCount: maxCount,
-                                    canNoSelect: false,
-                                    canEndNotMax: false,
-                                    selectPermanentCoroutine: SelectPermanentCoroutine1,
-                                    afterSelectPermanentCoroutine: null,
-                                    mode: SelectPermanentEffect.Mode.Custom,
-                                    cardEffect: activateClass);
-
-                                selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get digivolution cards.", "The opponent is selecting 1 Digimon that will get digivolution cards.");
-
-                                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                                IEnumerator SelectPermanentCoroutine1(Permanent permanent)
-                                {
-                                    yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, permanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
-                                }
-                            }
+                            yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, permanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
                         }
                     }
                 }
             }
+            #endregion
 
-            if (timing == EffectTiming.OnEnterFieldAnyone)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Look at opponent's hand or place 1 Digimon under other Digimon as its bottom digivolution card.", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
-                cardEffects.Add(activateClass);
+            #region Shared All Turns
+            string SharedEffectName2() => "Place [Shuu Yulin] under to prevent De-Digivolve on 1 Digimon.";
 
-                string EffectDiscription()
-                {
-                    return "[When Digivolving] If your opponent has 1 or fewer Digimon in play, look at your opponent's hand and trash 1 card in it. If your opponent has 2 or more Digimon in play, place 1 of your opponent's Digimon under 1 of your opponent's other Digimon as its bottom digivolution card.";
-                }
-
-                bool CanSelectPermanentCondition(Permanent permanent)
-                {
-                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
-                }
+            string SharedEffectDescription2() => "[All Turns][Once Per Turn] When an opponent's Digimon digivolves or an effect adds cards to the digivolution cards of an opponent's Digimon, by trashing 1 card in this Digimon's digivolution cards, trash the top card of your opponent's security stack.";
 
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (card.Owner.Enemy.GetBattleAreaDigimons().Count <= 1)
-                        {
-                            if (card.Owner.Enemy.HandCards.Count >= 1)
-                            {
-                                return true;
-                            }
-                        }
+            string SharedHashString2 = "BT11_088_AT";
 
-                        if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2)
-                        {
-                            if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                            {
-                                return true;
-                            }
-                        }
-                    }
-
-                    return false;
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.Enemy.GetBattleAreaDigimons().Count <= 1)
-                    {
-                        if (card.Owner.Enemy.HandCards.Count >= 1)
-                        {
-                            SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
-
-                            selectCardEffect.SetUp(
-                                        canTargetCondition: (cardSource) => true,
-                                        canTargetCondition_ByPreSelecetedList: null,
-                                        canEndSelectCondition: null,
-                                        canNoSelect: () => false,
-                                        selectCardCoroutine: null,
-                                        afterSelectCardCoroutine: null,
-                                        message: "Select 1 card to discard from opponent's hand.",
-                                        maxCount: 1,
-                                        canEndNotMax: false,
-                                        isShowOpponent: true,
-                                        mode: SelectCardEffect.Mode.Discard,
-                                        root: SelectCardEffect.Root.Custom,
-                                        customRootCardList: card.Owner.Enemy.HandCards,
-                                        canLookReverseCard: true,
-                                        selectPlayer: card.Owner,
-                                        cardEffect: null);
-
-                            selectCardEffect.SetUpCustomMessage("Select 1 card to discard from opponent's hand.", "The opponent is selecting 1 card to discard from your hand.");
-
-                            yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
-                        }
-                    }
+            bool SharedCanActivateCondition2(Hashtable hashtable, ActivateClass activateClass)
+            {
+                return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
+                    && card.PermanentOfThisCard().DigivolutionCards.Count(cardSource => CanSelectCardCondition2(cardSource, activateClass)) >= 1;
+            }
 
-                    if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2)
-                    {
-                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                        {
-                            Permanent selectedPermanent = null;
-
-                            int maxCount = 1;
-
-                            SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
-                            selectPermanentEffect.SetUp(
-                                selectPlayer: card.Owner,
-                                canTargetCondition: CanSelectPermanentCondition,
-                                canTargetCondition_ByPreSelecetedList: null,
-                                canEndSelectCondition: null,
-                                maxCount: maxCount,
-                                canNoSelect: false,
-                                canEndNotMax: false,
-                                selectPermanentCoroutine: SelectPermanentCoroutine,
-                                afterSelectPermanentCoroutine: null,
-                                mode: SelectPermanentEffect.Mode.Custom,
-                                cardEffect: activateClass);
-
-                            selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that place under other Digimon's digivolution cards.", "The opponent is selecting 1 Digimon that place under other Digimon's digivolution cards.");
-
-                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                            IEnumerator SelectPermanentCoroutine(Permanent permanent)
-                            {
-                                selectedPermanent = permanent;
-
-                                yield return null;
-                            }
-
-                            if (selectedPermanent != null)
-                            {
-                                bool CanSelectPermanentCondition1(Permanent permanent)
-                                {
-                                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
-                                    {
-                                        if (permanent != selectedPermanent)
-                                        {
-                                            if (!permanent.IsToken)
-                                            {
-                                                return true;
-                                            }
-                                        }
-                                    }
-
-                                    return false;
-                                }
-
-                                maxCount = 1;
-
-                                selectPermanentEffect.SetUp(
-                                    selectPlayer: card.Owner,
-                                    canTargetCondition: CanSelectPermanentCondition1,
-                                    canTargetCondition_ByPreSelecetedList: null,
-                                    canEndSelectCondition: null,
-                                    maxCount: maxCount,
-                                    canNoSelect: false,
-                                    canEndNotMax: false,
-                                    selectPermanentCoroutine: SelectPermanentCoroutine1,
-                                    afterSelectPermanentCoroutine: null,
-                                    mode: SelectPermanentEffect.Mode.Custom,
-                                    cardEffect: activateClass);
-
-                                selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get digivolution cards.", "The opponent is selecting 1 Digimon that will get digivolution cards.");
-
-                                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                                IEnumerator SelectPermanentCoroutine1(Permanent permanent)
-                                {
-                                    yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, permanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
-                                }
-                            }
-                        }
-                    }
-                }
+            bool CanSelectCardCondition2(CardSource cardSource, ActivateClass activateClass)
+            {
+                return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
             }
 
-            if (timing == EffectTiming.OnEnterFieldAnyone)
+            IEnumerator SharedActivateCoroutine2(Hashtable hashtable, ActivateClass activateClass)
             {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
-                activateClass.SetHashString("TrashSecurity_BT11_088");
-                cardEffects.Add(activateClass);
+                List<CardSource> selectedCards = new List<CardSource>();
 
-                string EffectDiscription()
-                {
-                    return "[All Turns][Once Per Turn] When an opponent's Digimon digivolves or an effect adds cards to the digivolution cards of an opponent's Digimon, by trashing 1 card in this Digimon's digivolution cards, trash the top card of your opponent's security stack.";
-                }
+                SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
 
-                bool CanSelectCardCondition(CardSource cardSource)
-                {
-                    return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
-                }
+                selectCardEffect.SetUp(
+                    canTargetCondition: (cardSource) => CanSelectCardCondition2(cardSource, activateClass),
+                    canTargetCondition_ByPreSelecetedList: null,
+                    canEndSelectCondition: CanEndSelectCondition,
+                    canNoSelect: () => false,
+                    selectCardCoroutine: SelectCardCoroutine,
+                    afterSelectCardCoroutine: null,
+                    message: "Select 1 digivolution card to discard.",
+                    maxCount: 1,
+                    canEndNotMax: false,
+                    isShowOpponent: true,
+                    mode: SelectCardEffect.Mode.Custom,
+                    root: SelectCardEffect.Root.DigivolutionCards,
+                    customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
+                    canLookReverseCard: true,
+                    selectPlayer: card.Owner,
+                    cardEffect: null);
 
-                bool PermanentCondition(Permanent permanent)
-                {
-                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
-                }
+                selectCardEffect.SetUseFaceDown();
+                selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to discard.", "The opponent is selecting 1 digivolution card to discard.");
 
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
-                        {
-                            return true;
-                        }
-                    }
+                yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
 
-                    return false;
+                bool CanEndSelectCondition(List<CardSource> cardSources)
+                {
+                    return CardEffectCommons.HasNoElement(cardSources);
                 }
 
-                bool CanActivateCondition(Hashtable hashtable)
+                IEnumerator SelectCardCoroutine(CardSource cardSource)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
-                        {
-                            return true;
-                        }
-                    }
+                    selectedCards.Add(cardSource);
 
-                    return false;
+                    yield return null;
                 }
 
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
+                if (selectedCards.Count >= 1)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
-                        {
-                            bool trashed = false;
-
-                            List<CardSource> selectedCards = new List<CardSource>();
-
-                            SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
-
-                            selectCardEffect.SetUp(
-                                canTargetCondition: CanSelectCardCondition,
-                                canTargetCondition_ByPreSelecetedList: null,
-                                canEndSelectCondition: CanEndSelectCondition,
-                                canNoSelect: () => false,
-                                selectCardCoroutine: SelectCardCoroutine,
-                                afterSelectCardCoroutine: null,
-                                message: "Select 1 digivolution card to discard.",
-                                maxCount: 1,
-                                canEndNotMax: false,
-                                isShowOpponent: true,
-                                mode: SelectCardEffect.Mode.Custom,
-                                root: SelectCardEffect.Root.DigivolutionCards,
-                                customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
-                                canLookReverseCard: true,
-                                selectPlayer: card.Owner,
-                                cardEffect: null);
-
-                            selectCardEffect.SetUseFaceDown();
-                            selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to discard.", "The opponent is selecting 1 digivolution card to discard.");
-
-                            yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
-
-                            bool CanEndSelectCondition(List<CardSource> cardSources)
-                            {
-                                if (CardEffectCommons.HasNoElement(cardSources))
-                                {
-                                    return false;
-                                }
-
-                                return true;
-                            }
-
-                            IEnumerator SelectCardCoroutine(CardSource cardSource)
-                            {
-                                selectedCards.Add(cardSource);
-
-                                yield return null;
-                            }
-
-                            if (selectedCards.Count >= 1)
-                            {
-                                yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(card.PermanentOfThisCard(), selectedCards, activateClass).TrashDigivolutionCards());
-
-                                trashed = true;
-                            }
-
-                            if (trashed)
-                            {
-                                yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                    yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(card.PermanentOfThisCard(), selectedCards, activateClass).TrashDigivolutionCards());
+
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
                         player: card.Owner.Enemy,
                         destroySecurityCount: 1,
                         cardEffect: activateClass,
                         fromTop: true).DestroySecurity());
-                            }
-                        }
-                    }
                 }
             }
+            #endregion
 
-            if (timing == EffectTiming.OnAddDigivolutionCards)
+            #region All Turns - Digivolve
+            if (timing == EffectTiming.OnEnterFieldAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
-                activateClass.SetHashString("TrashSecurity_BT11_088");
+                activateClass.SetUpICardEffect(SharedEffectName2(), CanUseCondition, card);
+                activateClass.SetUpActivateClass(hash => SharedCanActivateCondition2(hash, activateClass), hash => SharedActivateCoroutine2(hash, activateClass), 1, true, SharedEffectDescription2());
+                activateClass.SetHashString(SharedHashString2);
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
-                {
-                    return "[All Turns][Once Per Turn] When an opponent's Digimon digivolves or an effect adds cards to the digivolution cards of an opponent's Digimon, by trashing 1 card in this Digimon's digivolution cards, trash the top card of your opponent's security stack.";
-                }
-
-                bool CanSelectCardCondition(CardSource cardSource)
+                bool PermanentCondition(Permanent permanent)
                 {
-                    return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
+                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
-                                hashtable: hashtable,
-                                permanentCondition: permanent => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card),
-                                cardEffectCondition: cardEffect => cardEffect != null,
-                                cardCondition: null))
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
+                        && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition);
                 }
+            }
+            #endregion
 
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
-                }
+            #region All Turns - Add Digivolution Card
+            if (timing == EffectTiming.OnAddDigivolutionCards)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect(SharedEffectName2(), CanUseCondition, card);
+                activateClass.SetUpActivateClass(hash => SharedCanActivateCondition2(hash, activateClass), hash => SharedActivateCoroutine2(hash, activateClass), 1, true, SharedEffectDescription2());
+                activateClass.SetHashString(SharedHashString2);
+                cardEffects.Add(activateClass);
 
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
+                bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
-                        {
-                            bool trashed = false;
-
-                            List<CardSource> selectedCards = new List<CardSource>();
-
-                            SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
-
-                            selectCardEffect.SetUp(
-                                        canTargetCondition: CanSelectCardCondition,
-                                        canTargetCondition_ByPreSelecetedList: null,
-                                        canEndSelectCondition: CanEndSelectCondition,
-                                        canNoSelect: () => false,
-                                        selectCardCoroutine: SelectCardCoroutine,
-                                        afterSelectCardCoroutine: null,
-                                        message: "Select 1 digivolution card to discard.",
-                                        maxCount: 1,
-                                        canEndNotMax: false,
-                                        isShowOpponent: true,
-                                        mode: SelectCardEffect.Mode.Custom,
-                                        root: SelectCardEffect.Root.Custom,
-                                        customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
-                                        canLookReverseCard: true,
-                                        selectPlayer: card.Owner,
-                                        cardEffect: null);
-
-                            selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to discard.", "The opponent is selecting 1 digivolution card to discard.");
-
-                            yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
-
-                            bool CanEndSelectCondition(List<CardSource> cardSources)
-                            {
-                                if (CardEffectCommons.HasNoElement(cardSources))
-                                {
-                                    return false;
-                                }
-
-                                return true;
-                            }
-
-                            IEnumerator SelectCardCoroutine(CardSource cardSource)
-                            {
-                                selectedCards.Add(cardSource);
-
-                                yield return null;
-                            }
-
-                            if (selectedCards.Count >= 1)
-                            {
-                                yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(card.PermanentOfThisCard(), selectedCards, activateClass).TrashDigivolutionCards());
-
-                                trashed = true;
-                            }
-
-                            if (trashed)
-                            {
-                                yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
-                        player: card.Owner.Enemy,
-                        destroySecurityCount: 1,
-                        cardEffect: activateClass,
-                        fromTop: true).DestroySecurity());
-                            }
-                        }
-                    }
+                    return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
+                        && CardEffectCommons.CanTriggerOnAddDigivolutionCard(
+                            hashtable: hashtable,
+                            permanentCondition: permanent => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card),
+                            cardEffectCondition: cardEffect => cardEffect != null,
+                            cardCondition: null);
                 }
             }
+            #endregion
 
             return cardEffects;
         }

+ 11 - 0
Assets/Scripts/CardEffect/EX12/Blue/EX12_030.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 423c4080ed3b0e246951e5ab0806ce90
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: