瀏覽代碼

Fix IsDigixros check to check per card

hooperk 3 月之前
父節點
當前提交
c1ba047bcf

+ 1 - 1
Assets/Scripts/CardEffect/BT10/Black/BT10_061.cs

@@ -144,7 +144,7 @@ namespace DCGO.CardEffects.BT10
                         activateClass: activateClass
                         ));
 
-                    if (CardEffectCommons.IsDijiXros(_hashtable, (count) => count == 2))
+                    if (CardEffectCommons.IsDijiXros(_hashtable, card, (count) => count == 2))
                     {
                         int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
 

+ 1 - 1
Assets/Scripts/CardEffect/BT10/Black/BT10_066.cs

@@ -95,7 +95,7 @@ namespace DCGO.CardEffects.BT10
                         }
                     }
 
-                    if (CardEffectCommons.IsDijiXros(_hashtable, (count) => count == 2))
+                    if (CardEffectCommons.IsDijiXros(_hashtable, card, (count) => count == 2))
                     {
                         if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
                         {

+ 1 - 1
Assets/Scripts/CardEffect/BT10/Blue/BT10_024.cs

@@ -72,7 +72,7 @@ namespace DCGO.CardEffects.BT10
                         effectDuration: EffectDuration.UntilEachTurnEnd,
                         activateClass: activateClass));
 
-                    if (CardEffectCommons.IsDijiXros(_hashtable, (digixrosCount) => digixrosCount >= 1))
+                    if (CardEffectCommons.IsDijiXros(_hashtable, card, (digixrosCount) => digixrosCount >= 1))
                     {
                         if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
                         {

+ 2 - 15
Assets/Scripts/CardEffect/BT11/Purple/BT11_086.cs

@@ -105,7 +105,7 @@ namespace DCGO.CardEffects.BT11
 
                         int maxCount = 1;
 
-                        if (CardEffectCommons.IsDijiXros(_hashtable, (digixrosCount) => digixrosCount >= 1))
+                        if (CardEffectCommons.IsDijiXros(_hashtable, card, (digixrosCount) => digixrosCount >= 1))
                         {
                             maxCount += 1;
                         }
@@ -221,19 +221,6 @@ namespace DCGO.CardEffects.BT11
                     {
                         List<CardSource> selectedCards = new List<CardSource>();
 
-                        int maxCount = 1;
-
-                        if (CardEffectCommons.IsDijiXros(_hashtable, (digixrosCount) => digixrosCount >= 1))
-                        {
-                            maxCount += 1;
-                        }
-
-                        maxCount = Math.Min(maxCount,
-                            card.Owner.TrashCards.Count(CanSelectCardCondition));
-
-                        maxCount = Math.Min(maxCount,
-                            card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()));
-
                         SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
 
                         selectCardEffect.SetUp(
@@ -244,7 +231,7 @@ namespace DCGO.CardEffects.BT11
                                     selectCardCoroutine: SelectCardCoroutine,
                                     afterSelectCardCoroutine: null,
                                     message: "Select cards to play.",
-                                    maxCount: maxCount,
+                                    maxCount: 1,
                                     canEndNotMax: false,
                                     isShowOpponent: true,
                                     mode: SelectCardEffect.Mode.Custom,

+ 2 - 18
Assets/Scripts/CardEffect/BT11/Red/BT11_009.cs

@@ -100,23 +100,7 @@ namespace DCGO.CardEffects.BT11
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                        {
-                            return true;
-                        }
-
-                        if (CardEffectCommons.IsDijiXros(hashtable, count => count == 2))
-                        {
-                            if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
-                            {
-                                return true;
-                            }
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsExistOnBattleArea(card);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
@@ -150,7 +134,7 @@ namespace DCGO.CardEffects.BT11
                         }
                     }
 
-                    if (CardEffectCommons.IsDijiXros(_hashtable, count => count == 2))
+                    if (CardEffectCommons.IsDijiXros(_hashtable, card, count => count == 2))
                     {
                         if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
                         {

+ 1 - 1
Assets/Scripts/CardEffect/BT15/Red/BT15_012.cs

@@ -170,7 +170,7 @@ namespace DCGO.CardEffects.BT15
 
                         IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
                         {
-                            if (CardEffectCommons.IsDijiXros(_hashtable, count => count == 2))
+                            if (CardEffectCommons.IsDijiXros(_hashtable, card, count => count == 2))
                             {
                                 foreach (Permanent selectedPermanent in permanents)
                                 {

+ 1 - 26
Assets/Scripts/CardEffect/BT19/Black/BT19_063.cs

@@ -167,7 +167,7 @@ namespace DCGO.CardEffects.BT19
                         }
                     }
 
-                    if (CardEffectCommons.IsDijiXros(_hashtable, (count) => count == 2))
+                    if (CardEffectCommons.IsDijiXros(_hashtable, card, (count) => count == 2))
                     {
                         if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
                         {
@@ -272,31 +272,6 @@ namespace DCGO.CardEffects.BT19
                             yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
                         }
                     }
-
-                    if (CardEffectCommons.IsDijiXros(_hashtable, (count) => count == 2))
-                    {
-                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
-                        {
-                            int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
-
-                            SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
-                            selectPermanentEffect.SetUp(
-                                selectPlayer: card.Owner,
-                                canTargetCondition: CanSelectPermanentCondition1,
-                                canTargetCondition_ByPreSelecetedList: null,
-                                canEndSelectCondition: null,
-                                maxCount: maxCount,
-                                canNoSelect: true,
-                                canEndNotMax: false,
-                                selectPermanentCoroutine: null,
-                                afterSelectPermanentCoroutine: null,
-                                mode: SelectPermanentEffect.Mode.Destroy,
-                                cardEffect: activateClass);
-
-                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-                        }
-                    }
                 }
             }
             #endregion

+ 1 - 1
Assets/Scripts/CardEffect/EX4/Blue/EX4_020.cs

@@ -63,7 +63,7 @@ namespace DCGO.CardEffects.EX4
                                     effectDuration: EffectDuration.UntilEachTurnEnd,
                                     activateClass: activateClass));
 
-                    if (CardEffectCommons.IsDijiXros(_hashtable, (digixrosCount) => digixrosCount >= 1))
+                    if (CardEffectCommons.IsDijiXros(_hashtable, card, (digixrosCount) => digixrosCount >= 1))
                     {
                         if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
                         {

+ 2 - 2
Assets/Scripts/CardEffect/EX6/Yellow/EX6_023.cs

@@ -130,7 +130,7 @@ namespace DCGO.CardEffects.EX6
                             return true;
                         }
                         
-                        if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                        if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                         {
                             if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
                             {
@@ -178,7 +178,7 @@ namespace DCGO.CardEffects.EX6
                         }
                     }
                     
-                    if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                    if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                     {
                         if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
                         {

+ 2 - 2
Assets/Scripts/CardEffect/EX6/Yellow/EX6_024.cs

@@ -127,7 +127,7 @@ namespace DCGO.CardEffects.EX6
                             return true;
                         }
                         
-                        if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                        if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                         {
                             if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
                             {
@@ -175,7 +175,7 @@ namespace DCGO.CardEffects.EX6
                         }
                     }
                     
-                    if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                    if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                     {
                         if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentPermanentCondition))
                         {

+ 2 - 2
Assets/Scripts/CardEffect/EX6/Yellow/EX6_025.cs

@@ -136,7 +136,7 @@ namespace DCGO.CardEffects.EX6
                             return true;
                         }
 
-                        if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                        if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                         {
                             if (card.Owner.LibraryCards.Count >= 1)
                             {
@@ -184,7 +184,7 @@ namespace DCGO.CardEffects.EX6
                         }
                     }
 
-                    if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                    if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                     {
                         yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndSelect(
                             revealCount: 4,

+ 2 - 2
Assets/Scripts/CardEffect/EX6/Yellow/EX6_026.cs

@@ -117,7 +117,7 @@ namespace DCGO.CardEffects.EX6
                             return true;
                         }
                         
-                        if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                        if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                         {
                             return true;
                         }
@@ -162,7 +162,7 @@ namespace DCGO.CardEffects.EX6
                         }
                     }
                     
-                    if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
+                    if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
                     {
                         yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
                         

+ 15 - 3
Assets/Scripts/Script/CardController.cs

@@ -1107,7 +1107,9 @@ public class OnEnterFieldHashtableParams
         List<CardSource> evoRootTops,
         SelectCardEffect.Root root,
         List<int> oldLevels,
-        bool isFromDigimonDigivolutionCards)
+        bool isFromDigimonDigivolutionCards,
+        int digiXrosCount = 0,
+        int assemblyCount = 0)
     {
         Permanent = permanent;
 
@@ -1129,6 +1131,10 @@ public class OnEnterFieldHashtableParams
         }
 
         IsFromDigimonDigivolutionCards = isFromDigimonDigivolutionCards;
+
+        DigixrosCount = digiXrosCount;
+
+        AssemblyCount = assemblyCount;
     }
 
     public Permanent Permanent { get; private set; } = null;
@@ -1137,6 +1143,8 @@ public class OnEnterFieldHashtableParams
     public SelectCardEffect.Root Root { get; private set; } = SelectCardEffect.Root.None;
     public List<int> OldLevels { get; private set; } = new List<int>();
     public bool IsFromDigimonDigivolutionCards { get; private set; } = false;
+    public int DigixrosCount { get; private set; } = 0;
+    public int AssemblyCount { get; private set; } = 0;
 }
 
 #endregion
@@ -1399,7 +1407,9 @@ public class PlayPermanentClass
                                         evoRootTops: evoRootTops,
                                         root: _root,
                                         oldLevels: oldLevels,
-                                        isFromDigimonDigivolutionCards:isFromDigimonDigivolutionCards
+                                        isFromDigimonDigivolutionCards:isFromDigimonDigivolutionCards,
+                                        digiXrosCount: _digiXrosCount,
+                                        assemblyCount: _assemblyCount
                                     )
                                 },
                                 isEvolution: isEvolution,
@@ -1638,7 +1648,9 @@ public class PlayPermanentClass
                             evoRootTops: evoRootTops,
                             root: _root,
                             oldLevels: oldLevels,
-                            isFromDigimonDigivolutionCards: isFromDigimonDigivolutionCards
+                            isFromDigimonDigivolutionCards: isFromDigimonDigivolutionCards,
+                            digiXrosCount: _digiXrosCount,
+                            assemblyCount: _assemblyCount
                             )
                     );
                 }

+ 17 - 4
Assets/Scripts/Script/CardEffectCommons/GetFromHashtable.cs

@@ -814,13 +814,26 @@ public partial class CardEffectCommons
     #endregion
 
     #region Get IsDijiXros from hashtable
-    public static bool IsDijiXros(Hashtable hashtable, Func<int, bool> digixrosCountCondition)
+    public static bool IsDijiXros(Hashtable hashtable, CardSource card, Func<int, bool> digixrosCountCondition)
     {
-        int digiXrosCount = GetDigiXrosCount(hashtable);
+        List<Hashtable> hashtables = GetHashtablesFromHashtable(hashtable);
 
-        if (digixrosCountCondition != null)
+        if (hashtables != null)
         {
-            return digixrosCountCondition(digiXrosCount);
+            foreach (Hashtable hashtable1 in hashtables)
+            {
+                Permanent permanent = GetPermanentFromHashtable(hashtable1);
+
+                if (permanent != null && permanent.cardSources.Contains(card))
+                {
+                    int digiXrosCount = GetDigiXrosCount(hashtable1);
+
+                    if (digixrosCountCondition != null)
+                    {
+                        return digixrosCountCondition(digiXrosCount);
+                    }
+                }
+            }
         }
 
         return false;

+ 2 - 0
Assets/Scripts/Script/CardEffectCommons/HashtableSetting.cs

@@ -161,6 +161,8 @@ public partial class CardEffectCommons
                     {"evoRootTops", hashtableParam.EvoRootTops.Clone()},
                     {"Root", hashtableParam.Root},
                     {"oldLevels", hashtableParam.OldLevels.Clone()},
+                    {"DigiXrosCount", hashtableParam.DigixrosCount},
+                    {"AssemblyCount", hashtableParam.AssemblyCount}
                 };
 
                 return hashtableOfPermanent;