Просмотр исходного кода

Update move condition check to activate condition, reduce clicks

hooperk 3 месяцев назад
Родитель
Сommit
2006a53746

+ 28 - 32
Assets/Scripts/CardEffect/BT25/Blue/BT25_024.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 // Lekismon
 namespace DCGO.CardEffects.BT25
@@ -54,7 +55,8 @@ namespace DCGO.CardEffects.BT25
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Digivolve into [Crescemon] in trash for 1 less", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
+                activateClass.SetIsSkippable(true);
                 cardEffects.Add(activateClass);
 
                 string EffectDescription() => "[Your Turn] When your Digimon are played or digivolve, if any of them are red, this Digimon may digivolve into [Crescemon] in the trash with the cost reduced by 1.";
@@ -70,7 +72,20 @@ namespace DCGO.CardEffects.BT25
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card)
-                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)
+                        && HasValidColor(hashtable);
+                }
+
+                bool HasValidColor(Hashtable hashtable)
+                {
+                    List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
+                    return hashtables.Map(CardEffectCommons.GetPermanentFromHashtable).Any(HasCorrectColorPermanent);
+                }
+
+                bool HasCorrectColorPermanent(Permanent permanent)
+                {
+                    return PermanentCondition(permanent)
+                        && permanent.TopCard.CardColors.Contains(CardColor.Red);
                 }
 
                 bool PermanentCondition(Permanent permanent)
@@ -80,40 +95,21 @@ namespace DCGO.CardEffects.BT25
 
                 bool CanSelectCardCondition(CardSource cardSource)
                 {
-                    return cardSource.EqualsCardName("Crescemon")
-                        && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
+                    return cardSource.EqualsCardName("Crescemon");
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    List<Permanent> playedPermanents = new List<Permanent>();
-
-                    foreach (Hashtable hash in CardEffectCommons.GetHashtablesFromHashtable(hashtable))
-                    {
-                        playedPermanents.Add(CardEffectCommons.GetPermanentFromHashtable(hash));
-                    }
-
-                    bool PermanentCondition1(Permanent permanent)
-                    {
-                        return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
-                            && permanent.TopCard.CardColors.Contains(CardColor.Red);
-                    }
-
-                    List<Permanent> targetPermanents = playedPermanents.Filter(PermanentCondition1);
-
-                    if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, targetPermanents.Contains))
-                    {
-                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
-                            targetPermanent: card.PermanentOfThisCard(),
-                            cardCondition: CanSelectCardCondition,
-                            payCost: true,
-                            reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
-                            fixedCostTuple: null,
-                            ignoreDigivolutionRequirementFixedCost: -1,
-                            isHand: false,
-                            activateClass: activateClass,
-                            successProcess: null));
-                    }
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
+                        targetPermanent: card.PermanentOfThisCard(),
+                        cardCondition: CanSelectCardCondition,
+                        payCost: true,
+                        reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
+                        fixedCostTuple: null,
+                        ignoreDigivolutionRequirementFixedCost: -1,
+                        isHand: false,
+                        activateClass: activateClass,
+                        successProcess: null));
                 }
             }
             #endregion

+ 28 - 32
Assets/Scripts/CardEffect/BT25/Blue/BT25_026.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 // Crescemon
 namespace DCGO.CardEffects.BT25
@@ -122,7 +123,8 @@ namespace DCGO.CardEffects.BT25
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Digivolve into [Dianamon] in trash for 2 less", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
+                activateClass.SetIsSkippable(true);
                 cardEffects.Add(activateClass);
 
                 string EffectDescription() => "[Your Turn] When your Digimon are played or digivolve, if any of them are red, this Digimon may digivolve into [Dianamon] in the trash with the cost reduced by 2.";
@@ -138,7 +140,20 @@ namespace DCGO.CardEffects.BT25
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card)
-                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)
+                        && HasValidColor(hashtable);
+                }
+
+                bool HasValidColor(Hashtable hashtable)
+                {
+                    List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
+                    return hashtables.Map(CardEffectCommons.GetPermanentFromHashtable).Any(HasCorrectColorPermanent);
+                }
+
+                bool HasCorrectColorPermanent(Permanent permanent)
+                {
+                    return PermanentCondition(permanent)
+                        && permanent.TopCard.CardColors.Contains(CardColor.Red);
                 }
 
                 bool PermanentCondition(Permanent permanent)
@@ -148,40 +163,21 @@ namespace DCGO.CardEffects.BT25
 
                 bool CanSelectCardCondition(CardSource cardSource)
                 {
-                    return cardSource.EqualsCardName("Dianamon")
-                        && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
+                    return cardSource.EqualsCardName("Dianamon");
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    List<Permanent> playedPermanents = new List<Permanent>();
-
-                    foreach (Hashtable hash in CardEffectCommons.GetHashtablesFromHashtable(hashtable))
-                    {
-                        playedPermanents.Add(CardEffectCommons.GetPermanentFromHashtable(hash));
-                    }
-
-                    bool PermanentCondition1(Permanent permanent)
-                    {
-                        return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
-                            && permanent.TopCard.CardColors.Contains(CardColor.Red);
-                    }
-
-                    List<Permanent> targetPermanents = playedPermanents.Filter(PermanentCondition1);
-
-                    if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, targetPermanents.Contains))
-                    {
-                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
-                            targetPermanent: card.PermanentOfThisCard(),
-                            cardCondition: CanSelectCardCondition,
-                            payCost: true,
-                            reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
-                            fixedCostTuple: null,
-                            ignoreDigivolutionRequirementFixedCost: -1,
-                            isHand: false,
-                            activateClass: activateClass,
-                            successProcess: null));
-                    }
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
+                        targetPermanent: card.PermanentOfThisCard(),
+                        cardCondition: CanSelectCardCondition,
+                        payCost: true,
+                        reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
+                        fixedCostTuple: null,
+                        ignoreDigivolutionRequirementFixedCost: -1,
+                        isHand: false,
+                        activateClass: activateClass,
+                        successProcess: null));
                 }
             }
             #endregion

+ 28 - 33
Assets/Scripts/CardEffect/BT25/Red/BT25_013.cs

@@ -109,8 +109,9 @@ namespace DCGO.CardEffects.BT25
             if (timing == EffectTiming.OnEnterFieldAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Digivolve into [Apollomon] in hand for 2 less", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                activateClass.SetUpICardEffect("Digivolve into [Flaremon] in hand for 1 less", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
+                activateClass.SetIsSkippable(true);
                 cardEffects.Add(activateClass);
 
                 string EffectDescription() => "[Your Turn] When your Digimon are played or digivolve, if any of them are blue, this Digimon may digivolve into [Flaremon] in the hand with the cost reduced by 1.";
@@ -125,7 +126,20 @@ namespace DCGO.CardEffects.BT25
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card)
-                        && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
+                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)
+                        && HasValidColor(hashtable);
+                }
+
+                bool HasValidColor(Hashtable hashtable)
+                {
+                    List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
+                    return hashtables.Map(CardEffectCommons.GetPermanentFromHashtable).Any(HasCorrectColorPermanent);
+                }
+
+                bool HasCorrectColorPermanent(Permanent permanent)
+                {
+                    return PermanentCondition(permanent)
+                        && permanent.TopCard.CardColors.Contains(CardColor.Blue);
                 }
 
                 bool PermanentCondition(Permanent permanent)
@@ -135,40 +149,21 @@ namespace DCGO.CardEffects.BT25
 
                 bool CanSelectCardCondition(CardSource cardSource)
                 {
-                    return cardSource.EqualsCardName("Flaremon")
-                        && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
+                    return cardSource.EqualsCardName("Flaremon");
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    List<Permanent> playedPermanents = new List<Permanent>();
-
-                    foreach (Hashtable hash in CardEffectCommons.GetHashtablesFromHashtable(hashtable))
-                    {
-                        playedPermanents.Add(CardEffectCommons.GetPermanentFromHashtable(hash));
-                    }
-
-                    bool PermanentCondition1(Permanent permanent)
-                    {
-                        return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
-                            && permanent.TopCard.CardColors.Contains(CardColor.Blue);
-                    }
-
-                    List<Permanent> targetPermanents = playedPermanents.Filter(PermanentCondition1);
-
-                    if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, targetPermanents.Contains))
-                    {
-                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
-                            targetPermanent: card.PermanentOfThisCard(),
-                            cardCondition: CanSelectCardCondition,
-                            payCost: true,
-                            reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
-                            fixedCostTuple: null,
-                            ignoreDigivolutionRequirementFixedCost: -1,
-                            isHand: true,
-                            activateClass: activateClass,
-                            successProcess: null));
-                    }
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
+                        targetPermanent: card.PermanentOfThisCard(),
+                        cardCondition: CanSelectCardCondition,
+                        payCost: true,
+                        reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
+                        fixedCostTuple: null,
+                        ignoreDigivolutionRequirementFixedCost: -1,
+                        isHand: true,
+                        activateClass: activateClass,
+                        successProcess: null));
                 }
             }
             #endregion

+ 28 - 32
Assets/Scripts/CardEffect/BT25/Red/BT25_017.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 // Flaremon
 namespace DCGO.CardEffects.BT25
@@ -109,7 +110,8 @@ namespace DCGO.CardEffects.BT25
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Digivolve into [Apollomon] in hand for 2 less", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
+                activateClass.SetIsSkippable(true);
                 cardEffects.Add(activateClass);
 
                 string EffectDescription() => "[Your Turn] When your Digimon are played or digivolve, if any of them are blue, this Digimon may digivolve into [Apollomon] in the hand with the cost reduced by 2.";
@@ -124,7 +126,20 @@ namespace DCGO.CardEffects.BT25
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card)
-                        && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
+                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)
+                        && HasValidColor(hashtable);
+                }
+
+                bool HasValidColor(Hashtable hashtable)
+                {
+                    List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
+                    return hashtables.Map(CardEffectCommons.GetPermanentFromHashtable).Any(HasCorrectColorPermanent);
+                }
+
+                bool HasCorrectColorPermanent(Permanent permanent)
+                {
+                    return PermanentCondition(permanent)
+                        && permanent.TopCard.CardColors.Contains(CardColor.Blue);
                 }
 
                 bool PermanentCondition(Permanent permanent)
@@ -134,40 +149,21 @@ namespace DCGO.CardEffects.BT25
 
                 bool CanSelectCardCondition(CardSource cardSource)
                 {
-                    return cardSource.EqualsCardName("Apollomon")
-                        && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
+                    return cardSource.EqualsCardName("Apollomon");
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    List<Permanent> playedPermanents = new List<Permanent>();
-
-                    foreach (Hashtable hash in CardEffectCommons.GetHashtablesFromHashtable(hashtable))
-                    {
-                        playedPermanents.Add(CardEffectCommons.GetPermanentFromHashtable(hash));
-                    }
-
-                    bool PermanentCondition1(Permanent permanent)
-                    {
-                        return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
-                            && permanent.TopCard.CardColors.Contains(CardColor.Blue);
-                    }
-
-                    List<Permanent> targetPermanents = playedPermanents.Filter(PermanentCondition1);
-
-                    if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, targetPermanents.Contains))
-                    {
-                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
-                            targetPermanent: card.PermanentOfThisCard(),
-                            cardCondition: CanSelectCardCondition,
-                            payCost: true,
-                            reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
-                            fixedCostTuple: null,
-                            ignoreDigivolutionRequirementFixedCost: -1,
-                            isHand: true,
-                            activateClass: activateClass,
-                            successProcess: null));
-                    }
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
+                        targetPermanent: card.PermanentOfThisCard(),
+                        cardCondition: CanSelectCardCondition,
+                        payCost: true,
+                        reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
+                        fixedCostTuple: null,
+                        ignoreDigivolutionRequirementFixedCost: -1,
+                        isHand: true,
+                        activateClass: activateClass,
+                        successProcess: null));
                 }
             }
             #endregion