Kaynağa Gözat

Update BT22_094.cs

x89rt2 5 ay önce
ebeveyn
işleme
2afc20fb37
1 değiştirilmiş dosya ile 129 ekleme ve 74 silme
  1. 129 74
      Assets/Scripts/CardEffect/BT22/White/BT22_094.cs

+ 129 - 74
Assets/Scripts/CardEffect/BT22/White/BT22_094.cs

@@ -1,5 +1,7 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
 
 // Yuugo Kamishiro
 namespace DCGO.CardEffects.BT22
@@ -62,106 +64,159 @@ namespace DCGO.CardEffects.BT22
 
             #region Your Turn
 
-            if (timing == EffectTiming.BeforePayCost)
+            #region Reduce Cost Effect
+
+            ActivateClass activateClass2 = new ActivateClass();
+            activateClass2.SetUpICardEffect("Reduce play cost", CanUseCondition2, card);
+            activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, 1, true, EffectDiscription2());
+
+            string EffectDiscription2()
             {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Bottom deck this tamer, reduce play cost by 2", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
-                cardEffects.Add(activateClass);
+                return "[Your Turn] When any of your Digimon or Tamers with the [CS] trait would be played, by returning this Tamer to the bottom of the deck, reduce the play cost by 2.";
+            }
 
-                string EffectDiscription()
-                {
-                    return "[Your Turn] When any of your Digimon or Tamers with the [CS] trait would be played, by returning this Tamer to the bottom of the deck, reduce the play cost by 2.";
-                }
+            bool PlayCardCondition(CardSource cardSource)
+            { 
+                return (cardSource.IsDigimon
+                        || cardSource.IsTamer)
+                    && cardSource.HasCSTraits
+                    && cardSource.Owner == card.Owner;
+            }
 
-                bool PlayCardCondition(CardSource cardSource)
-                    => (cardSource.IsDigimon || cardSource.IsTamer) && 
-                       cardSource.HasCSTraits && cardSource.Owner == card.Owner;
+            bool CanUseCondition2(Hashtable hashtable)
+            {
+                return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, PlayCardCondition)
+                    && CardEffectCommons.IsExistOnBattleArea(card);
+            }
 
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, PlayCardCondition);
-                }
+            bool CanActivateCondition2(Hashtable hashtable)
+            {
+                return CardEffectCommons.IsExistOnBattleArea(card)
+                    && CardEffectCommons.IsOwnerTurn(card);
+            }
 
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.IsExistOnField(card)
-                        && CardEffectCommons.IsOwnerTurn(card);
-                }
+            IEnumerator ActivateCoroutine2(Hashtable _hashtable)
+            {
+                Permanent bounceTargetPermanent = card.PermanentOfThisCard();
 
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
+                if (bounceTargetPermanent != null)
                 {
-                    Permanent bounceTargetPermanent = card.PermanentOfThisCard();
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
+                        targetPermanents: new List<Permanent>() { bounceTargetPermanent },
+                        activateClass: activateClass2,
+                        successProcess: SuccessProcess(),
+                        failureProcess: null));
 
-                    if (bounceTargetPermanent != null)
+                    IEnumerator SuccessProcess()
                     {
-                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
-                            targetPermanents: new List<Permanent>() { bounceTargetPermanent },
-                            activateClass: activateClass,
-                            successProcess: SuccessProcess(),
-                            failureProcess: null));
+                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
 
-                        IEnumerator SuccessProcess()
-                        {
-                            ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
+                        ChangeCostClass changeCostClass = new ChangeCostClass();
+                        changeCostClass.SetUpICardEffect("Cost -2", CanUseChangeCostCondition, card);
+                        changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
+                        card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
 
-                            ChangeCostClass changeCostClass = new ChangeCostClass();
-                            changeCostClass.SetUpICardEffect("Cost -2", CanUseChangeCostCondition, 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));
 
-                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
+                        bool CanUseChangeCostCondition(Hashtable hashtable)
+                        {
+                            return true;
+                        }
 
-                            bool CanUseChangeCostCondition(Hashtable hashtable)
+                        int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
+                        {
+                            if (CardSourceCondition(cardSource)
+                            && RootCondition(root)
+                            && PermanentsCondition(targetPermanents))
                             {
-                                return true;
+                                Cost -= 2;
                             }
 
-                            int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-                            {
-                                if (CardSourceCondition(cardSource))
-                                {
-                                    if (RootCondition(root))
-                                    {
-                                        if (PermanentsCondition(targetPermanents))
-                                        {
-                                            Cost -= 2;
-                                        }
-                                    }
-                                }
-
-                                return Cost;
-                            }
+                            return Cost;
+                        }
 
-                            bool PermanentsCondition(List<Permanent> targetPermanents)
+                        bool PermanentsCondition(List<Permanent> targetPermanents)
+                        {
+                            return targetPermanents != null;
+                        }
+
+                        bool CardSourceCondition(CardSource cardSource)
+                        {
+                            if (cardSource != null)
                             {
-                                return targetPermanents != null;
+                                return cardSource.Owner == card.Owner;
                             }
 
-                            bool CardSourceCondition(CardSource cardSource)
-                            {
-                                if (cardSource != null)
-                                {
-                                    return cardSource.Owner == card.Owner;
-                                }
+                            return false;
+                        }
 
-                                return false;
-                            }
+                        bool RootCondition(SelectCardEffect.Root root) => true;
 
-                            bool RootCondition(SelectCardEffect.Root root)
-                            {
-                                return true;
-                            }
+                        bool isUpDown() => true;
+                    }
+                }
+            }
 
-                            bool isUpDown()
-                            {
-                                return true;
-                            }
-                        }
+            #endregion
+
+            #region Before Pay Cost
+
+            if (timing == EffectTiming.BeforePayCost)
+            {
+                cardEffects.Add(activateClass2);
+            }
+
+            #endregion
+
+            #region Before Pay Cost (Not Shown)
+
+            if (timing == EffectTiming.None)
+            {
+                ChangeCostClass changeCostClass = new ChangeCostClass();
+                changeCostClass.SetUpICardEffect("Play Cost -2", CanUseChangeCostCondition, card);
+                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
+                changeCostClass.SetNotShowUI(true);
+                cardEffects.Add(changeCostClass);
+
+                bool CanUseChangeCostCondition(Hashtable hashtable)
+                {
+                    return true;
+                }
+
+                int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
+                {
+                    if (CardSourceCondition(cardSource)
+                    && RootCondition(root)
+                    && PermanentsCondition(targetPermanents))
+                    {
+                        Cost -= 2;
+                    }
+
+                    return Cost;
+                }
+
+                bool PermanentsCondition(List<Permanent> targetPermanents)
+                {
+                    return targetPermanents != null;
+                }
+
+                bool CardSourceCondition(CardSource cardSource)
+                {
+                    if (cardSource != null)
+                    {
+                        return cardSource.Owner == card.Owner;
                     }
+
+                    return false;
                 }
+
+                bool RootCondition(SelectCardEffect.Root root) => true;
+
+                bool isUpDown() => true;
             }
 
+            #endregion
+            
             #endregion
 
             #region Security
@@ -176,4 +231,4 @@ namespace DCGO.CardEffects.BT22
             return cardEffects;
         }
     }
-}
+}