Jelajahi Sumber

Update BT12_096.cs

x89rt2 2 bulan lalu
induk
melakukan
7deeb7b6bb
1 mengubah file dengan 169 tambahan dan 229 penghapusan
  1. 169 229
      Assets/Scripts/CardEffect/BT12/Purple/BT12_096.cs

+ 169 - 229
Assets/Scripts/CardEffect/BT12/Purple/BT12_096.cs

@@ -2,6 +2,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 
+// Tagiru Akashi
 namespace DCGO.CardEffects.BT12
 {
     public class BT12_096 : CEntity_Effect
@@ -10,306 +11,245 @@ namespace DCGO.CardEffects.BT12
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Start of Your Turn
             if (timing == EffectTiming.OnStartTurn)
             {
                 cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
             }
+            #endregion
 
+            #region Your Turn
             if (timing == EffectTiming.BeforePayCost)
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
                 activateClass.SetHashString("DigivolutionCost-1_BT12_094");
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
                     return "[Your Turn] If one of your Digimon digivolves into a Digimon card with <Save> in its text, by suspending this Tamer and placing 1 card from under one of your Tamers under that Digimon as one of its digivolution cards, reduce the digivolution cost by 1.";
                 }
 
-                bool CanSelectCardCondition(CardSource cardSource)
+                bool CanUseCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
+                        && CardEffectCommons.IsOwnerTurn(card)
+                        && CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition);
                 }
 
-                bool CanSelectPermanentCondition(Permanent permanent)
+                bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
-                    {
-                        if (permanent.IsTamer)
-                        {
-                            if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
-                            {
-                                return true;
-                            }
-                        }
-                    }
+                    return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
+                        && CardEffectCommons.CanActivateSuspendCostEffect(card)
+                        && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
+                }
 
-                    return false;
+                bool CanSelectPermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
+                        && permanent.DigivolutionCards.Any();
                 }
 
                 bool PermanentCondition(Permanent permanent)
                 {
-                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card);
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
                 }
 
                 bool CardCondition(CardSource cardSource)
                 {
-                    if (cardSource.IsDigimon)
-                    {
-                        if (cardSource.HasSaveText)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return cardSource.IsDigimon
+                        && cardSource.HasSaveText;
                 }
 
-                bool CanUseCondition(Hashtable hashtable)
+                IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.IsOwnerTurn(card))
-                        {
-                            if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition))
-                            {
-                                return true;
-                            }
-                        }
-                    }
+                    yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
 
-                    return false;
-                }
+                    Permanent giveDigivolutionCardsTamer = null;
+                    List<CardSource> selectedDigivolutionCards = new List<CardSource>();
+                    Permanent getDigivolutionCardsDigimon = null;
 
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.CanActivateSuspendCostEffect(card))
-                        {
-                            if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
-                            {
-                                return true;
-                            }
-                        }
-                    }
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
 
-                    return false;
-                }
+                    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);
 
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
+                    selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that has digivolution cards.", "The opponent is selecting 1 Tamer that has digivolution cards.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
                     {
-                        yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
+                        giveDigivolutionCardsTamer = permanent;
 
-                        Permanent giveDigivolutionCardsTamer = null;
-                        List<CardSource> selectedDigivolutionCards = new List<CardSource>();
-                        Permanent getDigivolutionCardsDigimon = null;
+                        yield return null;
+                    }
 
-                        int maxCount = 1;
+                    if (giveDigivolutionCardsTamer != null)
+                    {
+                        bool isFaceDown = false;
 
-                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+                        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
 
-                        selectPermanentEffect.SetUp(
-                            selectPlayer: card.Owner,
-                            canTargetCondition: CanSelectPermanentCondition,
+                        selectCardEffect.SetUp(
+                            canTargetCondition: (cardSource) => true,
                             canTargetCondition_ByPreSelecetedList: null,
                             canEndSelectCondition: null,
-                            maxCount: maxCount,
-                            canNoSelect: false,
+                            canNoSelect: () => false,
+                            selectCardCoroutine: SelectCardCoroutine,
+                            afterSelectCardCoroutine: null,
+                            message: "Select 1 digivolution card.",
+                            maxCount: 1,
                             canEndNotMax: false,
-                            selectPermanentCoroutine: SelectPermanentCoroutine,
-                            afterSelectPermanentCoroutine: null,
-                            mode: SelectPermanentEffect.Mode.Custom,
+                            isShowOpponent: true,
+                            mode: SelectCardEffect.Mode.Custom,
+                            root: SelectCardEffect.Root.Custom,
+                            customRootCardList: giveDigivolutionCardsTamer.DigivolutionCards,
+                            canLookReverseCard: true,
+                            selectPlayer: card.Owner,
                             cardEffect: activateClass);
 
-                        selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that has digivolution cards.", "The opponent is selecting 1 Tamer that has digivolution cards.");
+                        selectCardEffect.SetUseFaceDown();
 
-                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                        selectCardEffect.SetUpCustomMessage("Select 1 digivolution card.", "The opponent is selecting 1 digivolution card.");
+                        selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
 
-                        IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                        yield return StartCoroutine(selectCardEffect.Activate());
+
+                        IEnumerator SelectCardCoroutine(CardSource cardSource)
                         {
-                            giveDigivolutionCardsTamer = permanent;
+                            selectedDigivolutionCards.Add(cardSource);
+
+                            if(selectedDigivolutionCards[0].IsFaceDown)
+                            {
+                                isFaceDown = true;
+                            }
 
                             yield return null;
                         }
 
-                        if (giveDigivolutionCardsTamer != null)
+                        bool CanSelectPermanentCondition1(Permanent permanent)
+                        {
+                            List<Permanent> Permanents = CardEffectCommons.GetPermanentsFromHashtable(_hashtable);
+
+                            return Permanents != null
+                                && Permanents.Contains(permanent)
+                                && CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
+                                && !permanent.IsToken;
+                        }
+
+                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
                         {
-                            if (giveDigivolutionCardsTamer.DigivolutionCards.Count((cardSource) => CanSelectCardCondition(cardSource)) >= 1)
+                            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)
                             {
-                                maxCount = 1;
-
-                                SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
-
-                                selectCardEffect.SetUp(
-                                            canTargetCondition: CanSelectCardCondition,
-                                            canTargetCondition_ByPreSelecetedList: null,
-                                            canEndSelectCondition: null,
-                                            canNoSelect: () => false,
-                                            selectCardCoroutine: SelectCardCoroutine,
-                                            afterSelectCardCoroutine: null,
-                                            message: "Select 1 digivolution card.",
-                                            maxCount: maxCount,
-                                            canEndNotMax: false,
-                                            isShowOpponent: true,
-                                            mode: SelectCardEffect.Mode.Custom,
-                                            root: SelectCardEffect.Root.Custom,
-                                            customRootCardList: giveDigivolutionCardsTamer.DigivolutionCards,
-                                            canLookReverseCard: true,
-                                            selectPlayer: card.Owner,
-                                            cardEffect: activateClass);
-
-                                selectCardEffect.SetUpCustomMessage("Select 1 digivolution card.", "The opponent is selecting 1 digivolution card.");
-                                selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
-
-                                yield return StartCoroutine(selectCardEffect.Activate());
-
-                                IEnumerator SelectCardCoroutine(CardSource cardSource)
-                                {
-                                    selectedDigivolutionCards.Add(cardSource);
+                                getDigivolutionCardsDigimon = permanent;
 
-                                    yield return null;
-                                }
+                                yield return null;
+                            }
+                        }
 
-                                bool CanSelectPermanentCondition1(Permanent permanent)
-                                {
-                                    List<Permanent> Permanents = CardEffectCommons.GetPermanentsFromHashtable(_hashtable);
-
-                                    if (Permanents != null)
-                                    {
-                                        if (Permanents.Contains(permanent))
-                                        {
-                                            if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
-                                            {
-                                                if (!permanent.IsToken)
-                                                {
-                                                    return true;
-                                                }
-                                            }
-                                        }
-                                    }
-
-                                    return false;
-                                }
+                        if (getDigivolutionCardsDigimon != null
+                        && selectedDigivolutionCards.Count >= 1)
+                        {
+                            foreach (CardSource selectedCard in selectedDigivolutionCards)
+                            {
+                                yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(selectedCard, giveDigivolutionCardsTamer));
+                            }
 
-                                if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1) >= 1)
-                                {
-                                    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)
-                                    {
-                                        getDigivolutionCardsDigimon = permanent;
-
-                                        yield return null;
-                                    }
-                                }
+                            yield return ContinuousController.instance.StartCoroutine(getDigivolutionCardsDigimon.AddDigivolutionCardsBottom(selectedDigivolutionCards, activateClass, false, isFaceDown));
+
+                            ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
+
+                            ChangeCostClass changeCostClass = new ChangeCostClass();
+                            changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
+                            changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
+                            card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
 
-                                if (getDigivolutionCardsDigimon != null)
+                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
+
+                            bool CanUseCondition1(Hashtable hashtable)
+                            {
+                                return true;
+                            }
+
+                            int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
+                            {
+                                if (CardSourceCondition(cardSource)
+                                && RootCondition(root)
+                                && PermanentsCondition(targetPermanents))
                                 {
-                                    if (selectedDigivolutionCards.Count >= 1)
-                                    {
-                                        foreach (CardSource selectedCard in selectedDigivolutionCards)
-                                        {
-                                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(selectedCard, giveDigivolutionCardsTamer));
-                                        }
-
-                                        yield return ContinuousController.instance.StartCoroutine(getDigivolutionCardsDigimon.AddDigivolutionCardsBottom(selectedDigivolutionCards, activateClass));
-
-                                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-
-                                        ChangeCostClass changeCostClass = new ChangeCostClass();
-                                        changeCostClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition1, card);
-                                        changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                                        card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
-
-                                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
-
-                                        bool CanUseCondition1(Hashtable hashtable)
-                                        {
-                                            return true;
-                                        }
-
-                                        int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-                                        {
-                                            if (CardSourceCondition(cardSource))
-                                            {
-                                                if (RootCondition(root))
-                                                {
-                                                    if (PermanentsCondition(targetPermanents))
-                                                    {
-                                                        Cost -= 1;
-                                                    }
-                                                }
-                                            }
-
-                                            return Cost;
-                                        }
-
-                                        bool PermanentsCondition(List<Permanent> targetPermanents)
-                                        {
-                                            if (targetPermanents != null)
-                                            {
-                                                if (targetPermanents.Count(PermanentCondition) >= 1)
-                                                {
-                                                    return true;
-                                                }
-                                            }
-
-                                            return false;
-                                        }
-
-                                        bool PermanentCondition(Permanent targetPermanent)
-                                        {
-                                            return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card);
-                                        }
-
-                                        bool CardSourceCondition(CardSource cardSource)
-                                        {
-                                            return cardSource.HasSaveText;
-                                        }
-
-                                        bool RootCondition(SelectCardEffect.Root root)
-                                        {
-                                            return true;
-                                        }
-
-                                        bool isUpDown()
-                                        {
-                                            return true;
-                                        }
-                                    }
+                                    Cost -= 1;
                                 }
+
+                                return Cost;
+                            }
+
+                            bool PermanentsCondition(List<Permanent> targetPermanents)
+                            {
+                                return targetPermanents != null
+                                    && targetPermanents.Count(PermanentCondition) >= 1;
+                            }
+
+                            bool PermanentCondition(Permanent targetPermanent)
+                            {
+                                return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card);
+                            }
+
+                            bool CardSourceCondition(CardSource cardSource)
+                            {
+                                return cardSource.HasSaveText;
+                            }
+
+                            bool RootCondition(SelectCardEffect.Root root)
+                            {
+                                return true;
+                            }
+
+                            bool isUpDown()
+                            {
+                                return true;
                             }
                         }
                     }
                 }
             }
+            #endregion
 
+            #region Security
             if (timing == EffectTiming.SecuritySkill)
             {
                 cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
             }
+            #endregion
 
             return cardEffects;
         }