Przeglądaj źródła

Update ST23_04.cs

x89rt2 4 miesięcy temu
rodzic
commit
25ae939886
1 zmienionych plików z 57 dodań i 133 usunięć
  1. 57 133
      Assets/Scripts/CardEffect/ST23/Yellow/ST23_04.cs

+ 57 - 133
Assets/Scripts/CardEffect/ST23/Yellow/ST23_04.cs

@@ -162,164 +162,88 @@ namespace DCGO.CardEffects.ST23
 
                         if (selectCard != null)
                         {
-                            if (selectCard.IsOption)
+                            #region reduce use cost
+                            ChangeCostClass changeCostClass = new ChangeCostClass();
+                            changeCostClass.SetUpICardEffect($"Play/Use Cost -3", CanUseCondition1, card);
+                            changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: PlayOrUseCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
+                            Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
+                            card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
+
+                            ICardEffect GetCardEffect(EffectTiming _timing)
                             {
-                                #region reduce use cost
-                                ChangeCostClass changeCostClass = new ChangeCostClass();
-                                changeCostClass.SetUpICardEffect($"Use Cost -3", CanUseCondition1, card);
-                                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: OptionCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                                Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
-                                card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
-
-                                ICardEffect GetCardEffect(EffectTiming _timing)
+                                if (_timing == EffectTiming.None)
                                 {
-                                    if (_timing == EffectTiming.None)
-                                    {
-                                        return changeCostClass;
-                                    }
-
-                                    return null;
+                                    return changeCostClass;
                                 }
 
-                                bool CanUseCondition1(Hashtable hashtable)
-                                {
-                                    return true;
-                                }
-
-                                bool OptionCondition(CardSource cardSource)
-                                {
-                                    return true;
-                                }
+                                return null;
+                            }
 
-                                int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-                                {
-                                    if (OptionCondition(cardSource))
-                                    {
-                                        if (RootCondition(root))
-                                        {
-                                            if (PermanentsCondition(targetPermanents))
-                                            {
-                                                Cost -= 3;
-                                            }
-                                        }
-                                    }
+                            bool CanUseCondition1(Hashtable hashtable)
+                            {
+                                return true;
+                            }
 
-                                    return Cost;
-                                }
+                            bool PlayOrUseCondition(CardSource cardSource)
+                            {
+                                return true;
+                            }
 
-                                bool PermanentsCondition(List<Permanent> targetPermanents)
+                            int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
+                            {
+                                if (PlayOrUseCondition(cardSource))
                                 {
-                                    if (targetPermanents == null)
-                                    {
-                                        return true;
-                                    }
-
-                                    else
+                                    if (RootCondition(root))
                                     {
-                                        if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
+                                        if (PermanentsCondition(targetPermanents))
                                         {
-                                            return true;
+                                            Cost -= 3;
                                         }
                                     }
-
-                                    return false;
                                 }
 
-                                bool RootCondition(SelectCardEffect.Root root)
-                                {
-                                    return true;
-                                }
-
-                                bool isUpDown()
-                                {
-                                    return true;
-                                }
-                                #endregion
-
-                                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayOptionCards(
-                                    cardSources: selectedCards,
-                                    activateClass: activateClass,
-                                    payCost: true,
-                                    root: SelectCardEffect.Root.Hand));
-
-                                #region release effect
-                                card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
-                                #endregion
+                                return Cost;
                             }
-                            else
-                            {
-                                #region reduce play cost
-                                ChangeCostClass changeCostClass = new ChangeCostClass();
-                                changeCostClass.SetUpICardEffect($"Play Cost -3", CanUseCondition1, card);
-                                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                                Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
-                                card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
-
-                                ICardEffect GetCardEffect(EffectTiming _timing)
-                                {
-                                    if (_timing == EffectTiming.None)
-                                    {
-                                        return changeCostClass;
-                                    }
 
-                                    return null;
-                                }
-
-                                bool CanUseCondition1(Hashtable hashtable)
+                            bool PermanentsCondition(List<Permanent> targetPermanents)
+                            {
+                                if (targetPermanents == null)
                                 {
                                     return true;
                                 }
 
-                                int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-                                {
-                                    if (CardSourceCondition(cardSource))
-                                    {
-                                        if (RootCondition(root))
-                                        {
-                                            if (PermanentsCondition(targetPermanents))
-                                            {
-                                                Cost -= 3;
-                                            }
-                                        }
-                                    }
-
-                                    return Cost;
-                                }
-
-                                bool PermanentsCondition(List<Permanent> targetPermanents)
+                                else
                                 {
-                                    if (targetPermanents == null)
+                                    if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
                                     {
                                         return true;
                                     }
-
-                                    else
-                                    {
-                                        if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
-                                        {
-                                            return true;
-                                        }
-                                    }
-
-                                    return false;
                                 }
 
-                                bool CardSourceCondition(CardSource cardSource)
-                                {
-                                    return true;
-                                }
+                                return false;
+                            }
 
-                                bool RootCondition(SelectCardEffect.Root root)
-                                {
-                                    return true;
-                                }
+                            bool RootCondition(SelectCardEffect.Root root)
+                            {
+                                return true;
+                            }
 
-                                bool isUpDown()
-                                {
-                                    return true;
-                                }
-                                #endregion
+                            bool isUpDown()
+                            {
+                                return true;
+                            }
+                            #endregion
 
+                            if (selectCard.IsOption)
+                            {                       
+                                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayOptionCards(
+                                    cardSources: selectedCards,
+                                    activateClass: activateClass,
+                                    payCost: true,
+                                    root: SelectCardEffect.Root.Hand));                            
+                            }
+                            else
+                            {                            
                                 yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
                                     new List<CardSource>() { selectCard },
                                     activateClass: activateClass,
@@ -327,11 +251,11 @@ namespace DCGO.CardEffects.ST23
                                     isTapped: false,
                                     root: SelectCardEffect.Root.Hand,
                                     activateETB: true));
-
-                                #region release effect reducing play cost 
-                                card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
-                                #endregion
                             }
+
+                            #region release effect
+                            card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
+                            #endregion
                         }
                     }
                 }