Przeglądaj źródła

Implement MandatorySelfPlayCostReduction CEF method

hooperk 3 miesięcy temu
rodzic
commit
3623d09bb3

+ 2 - 39
Assets/Scripts/CardEffect/AD1/Purple/AD1_018.cs

@@ -15,13 +15,7 @@ namespace DCGO.CardEffects.AD1
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return CardEffectCommons.HasMatchConditionOwnersPermanent(card, WouldPlayCondition);
                 }
@@ -32,38 +26,7 @@ namespace DCGO.CardEffects.AD1
                             && (permanent.TopCard.ContainsCardName("Knightmon") || permanent.TopCard.ContainsCardName("Lucemon"));
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 2 - 39
Assets/Scripts/CardEffect/AD1/Yellow/AD1_017.cs

@@ -14,13 +14,7 @@ namespace DCGO.CardEffects.AD1
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, WouldPlayCondition) >= 4;
                 }
@@ -31,38 +25,7 @@ namespace DCGO.CardEffects.AD1
                             || cardSource.HasText("Witchelny");
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 6 - 199
Assets/Scripts/CardEffect/BT20/Green/BT20_043.cs

@@ -27,214 +27,21 @@ namespace DCGO.CardEffects.BT20
             #endregion
 
             #region Reduce Play Cost
-            bool HasAccelTraitInPlay(Permanent permanent)
-            {
-                if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
-                {
-                    if (permanent.TopCard.EqualsTraits("ACCEL"))
-                    {
-                        return true;
-                    }
-                }
-
-                return false;
-            }
-
-            #region Before Pay Cost - Condition Effect
-
-            if (timing == EffectTiming.BeforePayCost)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Reduce the play cost by 5", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
-                activateClass.SetHashString("PlayCost-5_BT20_043");
-                cardEffects.Add(activateClass);
-
-                string EffectDescription()
-                {
-                    return "When this card would be played, if you have a Digimon with the [ACCEL] trait, reduce the play cost by 5.";
-                }
-
-                bool CardCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition);
-                }
-
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                     return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.CanReduceCost(null, card))
-                    {
-                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-                    }
-
-                    ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition1, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                    card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
-
-                    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))
-                                {
-                                    int targetCost = 0;
-
-                                    if (CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay))
-                                        targetCost += 5;
-
-                                    Cost -= targetCost;
-                                }
-                            }
-                        }
-
-                        return Cost;
-                    }
-
-                    bool PermanentsCondition(List<Permanent> targetPermanents)
-                    {
-                        if (targetPermanents == null)
-                        {
-                            return true;
-                        }
-                        else
-                        {
-                            if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
-                            {
-                                return true;
-                            }
-                        }
-
-                        return false;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        return cardSource == card;
-                    }
-
-                    bool RootCondition(SelectCardEffect.Root root)
-                    {
-                        return true;
-                    }
-
-                    bool isUpDown()
-                    {
-                        return true;
-                    }
-
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
-                }
-            }
-
-            #endregion
-
-            #region Reduce Play Cost - Not Shown
-
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
-                    if (card.Owner.HandCards.Contains(card))
-                    {
-                        ICardEffect activateClass = card.EffectList(EffectTiming.BeforePayCost).Find(cardEffect => cardEffect.EffectName == "Reduce the play cost by 5");
-
-                        if (activateClass != null)
-                        {
-                            return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
                 }
 
-                int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
+                bool HasAccelTraitInPlay(Permanent permanent)
                 {
-                    if (CardSourceCondition(cardSource))
-                    {
-                        if (RootCondition(root))
-                        {
-                            if (PermanentsCondition(targetPermanents))
-                            {
-                                int targetCount = 0;
-
-                                if (CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay))
-                                    targetCount += 5;
-
-                                Cost -= targetCount;
-                            }
-                        }
-                    }
-
-                    return Cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    if (targetPermanents == null)
-                    {
-                        return true;
-                    }
-                    else
-                    {
-                        if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    if (cardSource != null)
-                    {
-                        if (cardSource == card)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
+                        && permanent.TopCard.EqualsTraits("ACCEL");
                 }
 
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
-
-            #endregion
-
             #endregion
 
             #region On Play

+ 6 - 199
Assets/Scripts/CardEffect/BT20/Yellow/BT20_036.cs

@@ -26,214 +26,21 @@ namespace DCGO.CardEffects.BT20
             #endregion
 
             #region Reduce Play Cost
-            bool HasAccelTraitInPlay(Permanent permanent)
-            {
-                if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
-                {
-                    if (permanent.TopCard.EqualsTraits("ACCEL"))
-                    {
-                        return true;
-                    }
-                }
-
-                return false;
-            }
-
-            #region Before Pay Cost - Condition Effect
-
-            if (timing == EffectTiming.BeforePayCost)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Reduce the play cost by 5", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
-                activateClass.SetHashString("PlayCost-5_BT20_036");
-                cardEffects.Add(activateClass);
-
-                string EffectDescription()
-                {
-                    return "When this card would be played, if you have a Digimon with the [ACCEL] trait, reduce the play cost by 5.";
-                }
-
-                bool CardCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition);
-                }
-
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.CanReduceCost(null, card))
-                    {
-                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-                    }
-
-                    ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition1, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                    card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
-
-                    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))
-                                {
-                                    int targetCost = 0;
-
-                                    if (CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay))
-                                        targetCost += 5;
-
-                                    Cost -= targetCost;
-                                }
-                            }
-                        }
-
-                        return Cost;
-                    }
-
-                    bool PermanentsCondition(List<Permanent> targetPermanents)
-                    {
-                        if (targetPermanents == null)
-                        {
-                            return true;
-                        }
-                        else
-                        {
-                            if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
-                            {
-                                return true;
-                            }
-                        }
-
-                        return false;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        return cardSource == card;
-                    }
-
-                    bool RootCondition(SelectCardEffect.Root root)
-                    {
-                        return true;
-                    }
-
-                    bool isUpDown()
-                    {
-                        return true;
-                    }
-
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
-                }
-            }
-
-            #endregion
-
-            #region Reduce Play Cost - Not Shown
-
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    if (card.Owner.HandCards.Contains(card))
-                    {
-                        ICardEffect activateClass = card.EffectList(EffectTiming.BeforePayCost).Find(cardEffect => cardEffect.EffectName == "Reduce the play cost by 5");
-
-                        if (activateClass != null)
-                        {
-                            return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
-                        }
-                    }
-
-                    return false;
-                }
-
-                int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource))
-                    {
-                        if (RootCondition(root))
-                        {
-                            if (PermanentsCondition(targetPermanents))
-                            {
-                                int targetCount = 0;
-
-                                if (CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay))
-                                    targetCount += 5;
-
-                                Cost -= targetCount;
-                            }
-                        }
-                    }
-
-                    return Cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
+                bool Condition()
                 {
-                    if (targetPermanents == null)
-                    {
-                        return true;
-                    }
-                    else
-                    {
-                        if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    if (cardSource != null)
-                    {
-                        if (cardSource == card)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
                 }
 
-                bool RootCondition(SelectCardEffect.Root root)
+                bool HasAccelTraitInPlay(Permanent permanent)
                 {
-                    return true;
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
+                        && permanent.TopCard.EqualsTraits("ACCEL");
                 }
 
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
-
-            #endregion
-
             #endregion
 
             #region On Play

+ 3 - 127
Assets/Scripts/CardEffect/BT24/Blue/BT24_030.cs

@@ -29,139 +29,15 @@ namespace DCGO.CardEffects.BT24
             #endregion
 
             #region Reduce Play Cost
-
-            if (timing == EffectTiming.BeforePayCost)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Reduce play cost (5)", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
-                cardEffects.Add(activateClass);
-
-                string EffectDescription()
-                {
-                    return "When this card would be played, if your opponent has 2 or more Digimon, reduce the play cost by 5.";
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, cardSource => cardSource == card);
-                }
-
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.MatchConditionOpponentsPermanentCount(card, EnemyDigimon) >= 2;
-                }
-
-                bool EnemyDigimon(Permanent permanent)
-                {
-                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.CanReduceCost(null, card))
-                    {
-                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-                    }
-
-                    ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -5", hashtable => true, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                    card.Owner.UntilCalculateFixedCostEffect.Add(_ => changeCostClass);
-
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
-
-                    int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                    {
-                        if (CardSourceCondition(cardSource) &&
-                            RootCondition(root) &&
-                            PermanentsCondition(targetPermanents))
-                        {
-                            cost -= 5;
-                        }
-
-                        return cost;
-                    }
-
-                    bool PermanentsCondition(List<Permanent> targetPermanents)
-                    {
-                        return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        return cardSource == card;
-                    }
-
-                    bool RootCondition(SelectCardEffect.Root root)
-                    {
-                        return true;
-                    }
-
-                    bool isUpDown()
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            #endregion
-
-            #region Reduce Play Cost - Not Shown
-
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
-                    return CardEffectCommons.MatchConditionOpponentsPermanentCount(card, EnemyDigimon) >= 2;
+                    return card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2;
                 }
 
-                bool EnemyDigimon(Permanent permanent)
-                {
-                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
-                }
-
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
-
             #endregion
 
             #endregion

+ 2 - 116
Assets/Scripts/CardEffect/BT24/Green/BT24_051.cs

@@ -31,129 +31,15 @@ namespace DCGO.CardEffects.BT24
             #endregion
 
             #region Reduce Play Cost
-
-            if (timing == EffectTiming.BeforePayCost)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Reduce play cost (5)", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
-                cardEffects.Add(activateClass);
-
-                string EffectDescription()
-                {
-                    return "When this card would be played, if there are 3 or more Digimon, reduce the play cost by 5.";
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, cardSource => cardSource == card);
-                }
-
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return card.Owner.GetBattleAreaDigimons().Count + card.Owner.Enemy.GetBattleAreaDigimons().Count >= 3;
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.CanReduceCost(null, card))
-                    {
-                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-                    }
-
-                    ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -5", hashtable => true, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                    card.Owner.UntilCalculateFixedCostEffect.Add(_ => changeCostClass);
-
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
-
-                    int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                    {
-                        if (CardSourceCondition(cardSource) &&
-                            RootCondition(root) &&
-                            PermanentsCondition(targetPermanents))
-                        {
-                            cost -= 5;
-                        }
-
-                        return cost;
-                    }
-
-                    bool PermanentsCondition(List<Permanent> targetPermanents)
-                    {
-                        return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        return cardSource == card;
-                    }
-
-                    bool RootCondition(SelectCardEffect.Root root)
-                    {
-                        return true;
-                    }
-
-                    bool isUpDown()
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            #endregion
-
-            #region Reduce Play Cost - Not Shown
-
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return card.Owner.GetBattleAreaDigimons().Count + card.Owner.Enemy.GetBattleAreaDigimons().Count >= 3;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
-
             #endregion
 
             #endregion

+ 2 - 116
Assets/Scripts/CardEffect/BT24/Yellow/BT24_040.cs

@@ -27,129 +27,15 @@ namespace DCGO.CardEffects.BT24
             #endregion
 
             #region Reduce Play Cost
-
-            if (timing == EffectTiming.BeforePayCost)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Reduce play cost (5)", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
-                cardEffects.Add(activateClass);
-
-                string EffectDescription()
-                {
-                    return "When this card would be played, if you have 3 or fewer security cards, reduce the play cost by 5.";
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, cardSource => cardSource == card);
-                }
-
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return card.Owner.SecurityCards.Count <= 3;
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.CanReduceCost(null, card))
-                    {
-                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-                    }
-
-                    ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -5", hashtable => true, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                    card.Owner.UntilCalculateFixedCostEffect.Add(_ => changeCostClass);
-
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
-
-                    int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                    {
-                        if (CardSourceCondition(cardSource) &&
-                            RootCondition(root) &&
-                            PermanentsCondition(targetPermanents))
-                        {
-                            cost -= 5;
-                        }
-
-                        return cost;
-                    }
-
-                    bool PermanentsCondition(List<Permanent> targetPermanents)
-                    {
-                        return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        return cardSource == card;
-                    }
-
-                    bool RootCondition(SelectCardEffect.Root root)
-                    {
-                        return true;
-                    }
-
-                    bool isUpDown()
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            #endregion
-
-            #region Reduce Play Cost - Not Shown
-
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return card.Owner.SecurityCards.Count <= 3;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
-
             #endregion
 
             #region On Play / When Digivolving Shared

+ 2 - 124
Assets/Scripts/CardEffect/BT24/Yellow/BT24_041.cs

@@ -30,99 +30,9 @@ namespace DCGO.CardEffects.BT24
             #endregion
 
             #region Reduce Play Cost
-
-            if (timing == EffectTiming.BeforePayCost)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Reduce play cost (5)", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
-                cardEffects.Add(activateClass);
-
-                string EffectDescription()
-                {
-                    return "When this card would be played, if you have an [Iliad] trait Digimon or Tamer, reduce the play cost by 5.";
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, cardSource => cardSource == card);
-                }
-
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.HasMatchConditionPermanent(IsIliad);
-                }
-
-                bool IsIliad(Permanent permanent)
-                {
-                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
-                        && permanent.TopCard.EqualsTraits("Iliad")
-                        && (permanent.IsDigimon
-                            || permanent.IsTamer);
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    if (card.Owner.CanReduceCost(null, card))
-                    {
-                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-                    }
-
-                    ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -5", hashtable => true, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                    card.Owner.UntilCalculateFixedCostEffect.Add(_ => changeCostClass);
-
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
-
-                    int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                    {
-                        if (CardSourceCondition(cardSource) &&
-                            RootCondition(root) &&
-                            PermanentsCondition(targetPermanents))
-                        {
-                            cost -= 5;
-                        }
-
-                        return cost;
-                    }
-
-                    bool PermanentsCondition(List<Permanent> targetPermanents)
-                    {
-                        return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        return cardSource == card;
-                    }
-
-                    bool RootCondition(SelectCardEffect.Root root)
-                    {
-                        return true;
-                    }
-
-                    bool isUpDown()
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            #endregion
-
-            #region Reduce Play Cost - Not Shown
-
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return CardEffectCommons.HasMatchConditionPermanent(IsIliad);
                 }
@@ -135,40 +45,8 @@ namespace DCGO.CardEffects.BT24
                             || permanent.IsTamer);
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
-
             #endregion
 
             #region Shared OP / WD/ OD

+ 2 - 39
Assets/Scripts/CardEffect/BT25/Black/BT25_075.cs

@@ -27,49 +27,12 @@ namespace DCGO.CardEffects.BT25
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return card.Owner.GetBattleAreaDigimons().Count < card.Owner.Enemy.GetBattleAreaDigimons().Count;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 2 - 39
Assets/Scripts/CardEffect/BT25/Black/BT25_077.cs

@@ -26,13 +26,7 @@ namespace DCGO.CardEffects.BT25
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     int totalLevels = GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer
                         .Map(player => player.GetBattleAreaPermanents())
@@ -53,38 +47,7 @@ namespace DCGO.CardEffects.BT25
                     return 0;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 2 - 39
Assets/Scripts/CardEffect/BT25/Blue/BT25_028.cs

@@ -27,13 +27,7 @@ namespace DCGO.CardEffects.BT25
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return CardEffectCommons.HasMatchConditionPermanent(Level6EnemyDigimon);
                 }
@@ -45,38 +39,7 @@ namespace DCGO.CardEffects.BT25
                         && permanent.Level >= 6;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 2 - 39
Assets/Scripts/CardEffect/BT25/Green/BT25_059.cs

@@ -36,49 +36,12 @@ namespace DCGO.CardEffects.BT25
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return CardEffectCommons.MatchConditionPermanentCount(IsSuspendedDigimon) >= 2;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 3 - 40
Assets/Scripts/CardEffect/BT25/Red/BT25_018.cs

@@ -23,17 +23,11 @@ namespace DCGO.CardEffects.BT25
                 cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
             }
             #endregion
-
+            
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return CardEffectCommons.HasMatchConditionOpponentsPermanent(card, Level6EnemyDigimon);
                 }
@@ -45,38 +39,7 @@ namespace DCGO.CardEffects.BT25
                         && permanent.DP >= 12000;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 2 - 39
Assets/Scripts/CardEffect/BT25/Red/BT25_020.cs

@@ -26,13 +26,7 @@ namespace DCGO.CardEffects.BT25
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return CardEffectCommons.HasMatchConditionPermanent(WouldPlayCondition);
                 }
@@ -44,38 +38,7 @@ namespace DCGO.CardEffects.BT25
                         && permanent.DP >= 13000;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 2 - 39
Assets/Scripts/CardEffect/BT25/Yellow/BT25_044.cs

@@ -29,49 +29,12 @@ namespace DCGO.CardEffects.BT25
             #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                changeCostClass.SetNotShowUI(true);
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
                     return (card.Owner.SecurityCards.Count + card.Owner.Enemy.SecurityCards.Count) <= 6;
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                        List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource) &&
-                        RootCondition(root) &&
-                        PermanentsCondition(targetPermanents))
-                    {
-                        cost -= 5;
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
             }
             #endregion
 

+ 10 - 81
Assets/Scripts/CardEffect/P/Red/P_186.cs

@@ -62,101 +62,30 @@ namespace DCGO.CardEffects.P
 
             #endregion
 
-            #endregion
-
-            #region Play Cost Reduction
-
+            #region Reduce Play Cost
             if (timing == EffectTiming.None)
             {
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect($"Play Cost -", CanUseCondition, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost,
-                    cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: IsUpDown,
-                    isCheckAvailability: () => false, isChangePayingCost: () => true);
-
-                cardEffects.Add(changeCostClass);
-
-                bool CanUseCondition(Hashtable hashtable)
+                bool Condition()
                 {
-                    if (card.Owner.HandCards.Contains(card))
-                    {
-                        if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
                 }
 
                 bool PermanentCondition(Permanent Permanent)
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(Permanent))
-                    {
-                        if (Permanent.IsDigimon)
-                        {
-                            if (Permanent.DP >= 13000)
-                            {
-                                return true;
-                            }
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(Permanent)
+                        && Permanent.IsDigimon
+                        && Permanent.HasDP
+                        && Permanent.DP >= 13000;
                 }
 
-                int count()
+                int changeCost()
                 {
                     return 2 * ((card.Owner.TrashCards.Count + card.Owner.Enemy.TrashCards.Count) / 5);
                 }
 
-                int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
-                    List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource))
-                    {
-                        if (RootCondition(root))
-                        {
-                            if (PermanentsCondition(targetPermanents))
-                            {
-                                cost -= count();
-                            }
-                        }
-                    }
-
-                    return cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    if (targetPermanents == null)
-                    {
-                        return true;
-                    }
-
-                    if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
-                    {
-                        return true;
-                    }
-
-                    return false;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    return cardSource == card;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return (root == SelectCardEffect.Root.Hand);
-                }
-
-                bool IsUpDown()
-                {
-                    return true;
-                }
+                cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction<Func<int>>(changeCost, card, Condition));
             }
+            #endregion
 
             #endregion
 

+ 64 - 0
Assets/Scripts/Script/CardEffectFactory/ChangePlayCost.cs

@@ -112,4 +112,68 @@ public partial class CardEffectFactory
         return changeCostClass;
     }
     #endregion
+
+    #region Mandatory Self Cost Reduction
+    public static ChangeCostClass MandatorySelfPlayCostReduction<T>(
+        T changeValue,
+        CardSource card,
+        Func<bool> condition = null,
+        Func<SelectCardEffect.Root, bool> rootCondition = null
+    )
+    {
+        bool isInt = typeof(T) == typeof(int);
+        bool isIntFunc = typeof(T) == typeof(Func<int>);
+
+        if (!isInt && !isIntFunc) return null;
+
+        if (isInt && (int)(object)changeValue == 0) return null;
+        if (isIntFunc && changeValue as Func<int> == null) return null;
+
+        int _changeValue() => isInt ? (int)(object)changeValue : (changeValue as Func<int>)();
+
+        ChangeCostClass changeCostClass = new ChangeCostClass();
+        changeCostClass.SetUpICardEffect($"Play Cost -{_changeValue()}", CanUseCondition, card);
+        changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
+        changeCostClass.SetNotShowUI(true);
+        return changeCostClass;
+
+        bool CanUseCondition(Hashtable hashtable)
+        {
+            return condition == null || condition();
+        }
+
+        int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
+                List<Permanent> targetPermanents)
+        {
+            if (CardSourceCondition(cardSource) &&
+                RootCondition(root) &&
+                PermanentsCondition(targetPermanents))
+            {
+                cost -= _changeValue();
+            }
+
+            return cost;
+        }
+
+        bool PermanentsCondition(List<Permanent> targetPermanents)
+        {
+            return targetPermanents == null || targetPermanents.Count(targetPermanent => targetPermanent != null) == 0;
+        }
+
+        bool CardSourceCondition(CardSource cardSource)
+        {
+            return cardSource == card;
+        }
+
+        bool RootCondition(SelectCardEffect.Root root)
+        {
+            return rootCondition == null || rootCondition(root);
+        }
+
+        bool isUpDown()
+        {
+            return true;
+        }
+    }
+    #endregion
 }