Bläddra i källkod

Partition fix

Albert Vasconcellos 2 år sedan
förälder
incheckning
a8b4ac3231

+ 3 - 5
Assets/CardEffect/BT16/Black/Shakkoumon_BT16_063.cs

@@ -10,11 +10,9 @@ namespace DCGO.CardEffects.BT16
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            List<PartitionCondition> partitionConditions = new List<PartitionCondition>
-            {
-                new PartitionCondition(4, new List<CardColor> { CardColor.Black }),
-                new PartitionCondition(4, new List<CardColor> { CardColor.Yellow })
-            };
+            List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Black));
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Yellow));
 
             #region Rule - Trait: Also has [Angel]
             if (timing == EffectTiming.None)

+ 3 - 5
Assets/CardEffect/BT16/Blue/Paildramon_BT16_025.cs

@@ -10,11 +10,9 @@ namespace DCGO.CardEffects.BT16
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            List<PartitionCondition> partitionConditions = new List<PartitionCondition>
-            {
-                new PartitionCondition(4, new List<CardColor> { CardColor.Blue }),
-                new PartitionCondition(4, new List<CardColor> { CardColor.Green })
-            };
+            List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Blue));
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Green));
 
             #region Partition - Inherited
             if (timing == EffectTiming.WhenRemoveField)

+ 3 - 5
Assets/CardEffect/BT16/Purple/Dinobeemon_BT16_077.cs

@@ -12,11 +12,9 @@ namespace DCGO.CardEffects.BT16
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            List<PartitionCondition> partitionConditions = new List<PartitionCondition>
-            {
-                new PartitionCondition(4, new List<CardColor> { CardColor.Purple }),
-                new PartitionCondition(4, new List<CardColor> { CardColor.Red })
-            };
+            List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Purple));
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Red));
 
             #region DNA Digivolution
             if (timing == EffectTiming.None)

+ 3 - 5
Assets/CardEffect/BT16/Red/Silphymon_BT16_012.cs

@@ -14,11 +14,9 @@ namespace DCGO.CardEffects.BT16
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            List<PartitionCondition> partitionConditions = new List<PartitionCondition>
-            {
-                new PartitionCondition(4, new List<CardColor> { CardColor.Red }),
-                new PartitionCondition(4, new List<CardColor> { CardColor.Yellow })
-            };
+            List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Red));
+            partitionConditions.Add(new PartitionCondition(4, CardColor.Yellow));
 
             #region Partition
             if (timing == EffectTiming.WhenRemoveField)

+ 3 - 5
Assets/CardEffect/BT16/Yellow/Chaosmon_BT16_036.cs

@@ -118,11 +118,9 @@ namespace DCGO.CardEffects.BT16
 
             if(timing == EffectTiming.WhenRemoveField)
             {
-                List<PartitionCondition> partitionConditions = new List<PartitionCondition>
-            {
-                new PartitionCondition(6, new List<CardColor> { CardColor.Black }),
-                new PartitionCondition(6, new List<CardColor> { CardColor.Yellow })
-            };
+                List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
+                partitionConditions.Add(new PartitionCondition(6, CardColor.Black));
+                partitionConditions.Add(new PartitionCondition(6, CardColor.Yellow));
 
                 cardEffects.Add(CardEffectFactory.PartitionSelfEffect
                     (isInheritedEffect: false, 

+ 5 - 7
Assets/CardEffect/EX6/White/UltimateChaosmon_EX6_062.cs

@@ -14,11 +14,9 @@ namespace DCGO.CardEffects.EX6
             #region Partition
             if (timing == EffectTiming.WhenRemoveField)
             {
-                List<PartitionCondition> partitionConditions = new List<PartitionCondition>
-                {
-                    new PartitionCondition(6, new List<CardColor> { CardColor.Yellow, CardColor.Black }),
-                    new PartitionCondition(6, new List<CardColor> { CardColor.Green, CardColor.Purple })
-                };
+                List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
+                partitionConditions.Add(new PartitionCondition(6, CardColor.Black, CardColor.Yellow));
+                partitionConditions.Add(new PartitionCondition(6, CardColor.Yellow, CardColor.Purple));
 
                 cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
                     isInheritedEffect: false,
@@ -58,7 +56,7 @@ namespace DCGO.CardEffects.EX6
                                         {
                                             if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
                                             {
-                                                if (permanent.TopCard.CardColors.Contains(CardColor.Yellow) && permanent.TopCard.CardColors.Contains(CardColor.Black))
+                                                if (permanent.TopCard.CardColors.Contains(CardColor.Yellow) || permanent.TopCard.CardColors.Contains(CardColor.Black))
                                                 {
                                                     if (permanent.Levels_ForJogress(card).Contains(6))
                                                     {
@@ -86,7 +84,7 @@ namespace DCGO.CardEffects.EX6
                                         {
                                             if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
                                             {
-                                                if (permanent.TopCard.CardColors.Contains(CardColor.Green) && permanent.TopCard.CardColors.Contains(CardColor.Purple))
+                                                if (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Purple))
                                                 {
                                                     if (permanent.Levels_ForJogress(card).Contains(6))
                                                     {

+ 127 - 45
Assets/Scripts/CardEffectFactory/KeyWordEffects/Partition.cs

@@ -7,14 +7,24 @@ using UnityEngine;
 public class PartitionCondition
 {
     public int Level;
-    public List<CardColor> Color;
+    public CardColor Color;
+    public CardColor Color2;
+    public bool hasTwoColor = false;
 
-    public PartitionCondition(int level, List<CardColor> color)
+    public PartitionCondition(int level, CardColor color)
     {
         Level = level;
         Color = color;
     }
 
+    public PartitionCondition(int level, CardColor color, CardColor color2)
+    {
+        Level = level;
+        Color = color;
+        Color2 = color2;
+        hasTwoColor = true;
+    }
+    /*
     public bool ContainsAll(List<CardColor> sourceColors)
     {
         foreach(CardColor cardColor in Color)
@@ -25,6 +35,7 @@ public class PartitionCondition
 
         return false;
     }
+    */
 }
 
 public partial class CardEffectFactory
@@ -55,70 +66,141 @@ public partial class CardEffectFactory
         if (targetPermanent.TopCard == null) return null;
         if (card == null) return null;
 
-        List<CardSource> sourceOneCard = targetPermanent.cardSources
-            .Clone()
-            .Filter(source =>
-                partitionConditions[0].ContainsAll(source.CardColors)
-                && (source.HasLevel && source.Level == partitionConditions[0].Level));
-
-        List<CardSource> sourceTwoCard = targetPermanent.cardSources
-            .Clone()
-            .Filter(source =>
-                partitionConditions[1].ContainsAll(source.CardColors)
-                && (source.HasLevel && source.Level == partitionConditions[1].Level));
-
-        ActivateClass activateClass = new ActivateClass();
-        activateClass.SetUpICardEffect("Partition", CanUseCondition, card);
-        activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
-        activateClass.SetHashString($"Partition_{card.CardID}" + (isInheritedEffect ? "_inherited" : ""));
-        activateClass.SetIsInheritedEffect(isInheritedEffect);
-
-        string EffectDiscription()
-        {
-            return DataBase.PartitionEffectDiscription();
-        }
 
-        bool CanUseCondition(Hashtable hashtable)
+        if (partitionConditions[0].hasTwoColor == false || partitionConditions[1].hasTwoColor == false)
         {
-            if (CardEffectCommons.CanTriggerPartition(hashtable, card))
+            List<CardSource> sourceOneCard = targetPermanent.cardSources
+                .Clone()
+                .Filter(source =>
+                    source.CardColors.Contains(partitionConditions[0].Color)
+                    && (source.HasLevel && source.Level == partitionConditions[0].Level));
+
+            List<CardSource> sourceTwoCard = targetPermanent.cardSources
+                .Clone()
+                .Filter(source =>
+                    source.CardColors.Contains(partitionConditions[1].Color)
+                    && (source.HasLevel && source.Level == partitionConditions[1].Level));
+
+
+            ActivateClass activateClass = new ActivateClass();
+            activateClass.SetUpICardEffect("Partition", CanUseCondition, card);
+            activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+            activateClass.SetHashString($"Partition_{card.CardID}" + (isInheritedEffect ? "_inherited" : ""));
+            activateClass.SetIsInheritedEffect(isInheritedEffect);
+
+            string EffectDiscription()
             {
-                if (condition == null || condition())
+                return DataBase.PartitionEffectDiscription();
+            }
+
+            bool CanUseCondition(Hashtable hashtable)
+            {
+                if (CardEffectCommons.CanTriggerPartition(hashtable, card))
                 {
-                    return true;
+                    if (condition == null || condition())
+                    {
+                        return true;
+                    }
                 }
+
+                return false;
             }
 
-            return false;
-        }
+            bool CanActivateCondition(Hashtable hashtable)
+            {
+                if (CardEffectCommons.CanActivatePartition(targetPermanent))
+                {
+                    if (sourceOneCard == null || sourceOneCard.Count > 0)
+                    {
+                        if (sourceTwoCard == null || sourceTwoCard.Count > 0)
+                        {
+                            return true;
+                        }
+                    }
+                }
+
+                return false;
+            }
 
-        bool CanActivateCondition(Hashtable hashtable)
+            IEnumerator ActivateCoroutine(Hashtable _hashtable)
+            {
+                if (sourceOneCard.Count == 1)
+                    sourceTwoCard = sourceTwoCard.Except(sourceOneCard).ToList();
+
+                if (sourceTwoCard.Count == 1)
+                    sourceOneCard = sourceOneCard.Except(sourceTwoCard).ToList();
+
+                return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard);
+            }
+
+            return activateClass;
+        }
+        else
         {
-            if (CardEffectCommons.CanActivatePartition(targetPermanent))
+            List<CardSource> sourceOneCard = targetPermanent.cardSources
+                .Clone()
+                .Filter(source =>
+                    source.CardColors.Contains(partitionConditions[0].Color) || source.CardColors.Contains(partitionConditions[0].Color2)
+                    && (source.HasLevel && source.Level == partitionConditions[0].Level));
+
+            List<CardSource> sourceTwoCard = targetPermanent.cardSources
+                .Clone()
+                .Filter(source =>
+                    source.CardColors.Contains(partitionConditions[1].Color) || source.CardColors.Contains(partitionConditions[1].Color2)
+                    && (source.HasLevel && source.Level == partitionConditions[1].Level));
+
+            ActivateClass activateClass = new ActivateClass();
+            activateClass.SetUpICardEffect("Partition", CanUseCondition, card);
+            activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+            activateClass.SetHashString($"Partition_{card.CardID}" + (isInheritedEffect ? "_inherited" : ""));
+            activateClass.SetIsInheritedEffect(isInheritedEffect);
+
+            string EffectDiscription()
+            {
+                return DataBase.PartitionEffectDiscription();
+            }
+
+            bool CanUseCondition(Hashtable hashtable)
             {
-                if (sourceOneCard == null || sourceOneCard.Count > 0)
+                if (CardEffectCommons.CanTriggerPartition(hashtable, card))
                 {
-                    if (sourceTwoCard == null || sourceTwoCard.Count > 0)
+                    if (condition == null || condition())
                     {
                         return true;
                     }
                 }
+
+                return false;
             }
 
-            return false;
-        }
+            bool CanActivateCondition(Hashtable hashtable)
+            {
+                if (CardEffectCommons.CanActivatePartition(targetPermanent))
+                {
+                    if (sourceOneCard == null || sourceOneCard.Count > 0)
+                    {
+                        if (sourceTwoCard == null || sourceTwoCard.Count > 0)
+                        {
+                            return true;
+                        }
+                    }
+                }
 
-        IEnumerator ActivateCoroutine(Hashtable _hashtable)
-        {
-            if (sourceOneCard.Count == 1)
-                sourceTwoCard = sourceTwoCard.Except(sourceOneCard).ToList();
+                return false;
+            }
+
+            IEnumerator ActivateCoroutine(Hashtable _hashtable)
+            {
+                if (sourceOneCard.Count == 1)
+                    sourceTwoCard = sourceTwoCard.Except(sourceOneCard).ToList();
 
-            if (sourceTwoCard.Count == 1)
-                sourceOneCard = sourceOneCard.Except(sourceTwoCard).ToList();
+                if (sourceTwoCard.Count == 1)
+                    sourceOneCard = sourceOneCard.Except(sourceTwoCard).ToList();
 
-            return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard);
+                return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard);
+            }
+            return activateClass;
         }
-
-        return activateClass;
     }
     #endregion
 }