Parcourir la source

bug fixes, link count rule, fixed progress

mbunch_kascope il y a 1 an
Parent
commit
9bc392a142

+ 2 - 8
Assets/CardEffect/BT21/Purple/BT21_069.cs

@@ -75,10 +75,7 @@ namespace DCGO.CardEffects.BT21
                 {
                     if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
                     {
-                        if (CardEffectCommons.IsExistOnBattleArea(card))
-                        {
-                            return permanent.Level == 4;
-                        }
+                        return permanent.TopCard.HasLevel && permanent.Level <= 4;
                     }
 
                     return false;
@@ -232,10 +229,7 @@ namespace DCGO.CardEffects.BT21
                 {
                     if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
                     {
-                        if (CardEffectCommons.IsExistOnBattleArea(card))
-                        {
-                            return permanent.Level == 4;
-                        }
+                        return permanent.TopCard.HasLevel && permanent.Level <= 4;
                     }
 
                     return false;

+ 1 - 1
Assets/CardEffect/BT21/Purple/BT21_077.cs

@@ -497,7 +497,7 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.CanTriggerOnDeletion(hashtable, card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlay);
+                    return CardEffectCommons.CanActivateOnDeletion(card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlay);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)

+ 2 - 5
Assets/CardEffect/BT21/Red/BT21_002.cs

@@ -31,10 +31,6 @@ namespace DCGO.CardEffects.BT21
                     {
                         if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
                         {
-                            if (card.PermanentOfThisCard().TopCard.HasText("Gammamon") || card.PermanentOfThisCard().TopCard.CardTraits.FirstOrDefault(x => x.Equals("Hero")) != null)
-                            {
-                                return true;
-                            }
                             return true;
                         }
                     }
@@ -43,7 +39,8 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           (card.PermanentOfThisCard().TopCard.HasText("Gammamon") || card.PermanentOfThisCard().TopCard.EqualsTraits("Hero"));
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)

+ 6 - 1
Assets/CardEffect/BT21/Red/BT21_010.cs

@@ -88,7 +88,12 @@ namespace DCGO.CardEffects.BT21
 
             if (timing == EffectTiming.None)
             {
-                cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, null));
+                bool Condition()
+                {
+                    return CardEffectCommons.IsOwnerTurn(card);
+                }
+
+                cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, Condition));
             }
 
             #endregion

+ 2 - 16
Assets/CardEffect/BT21/Red/BT21_025.cs

@@ -13,23 +13,9 @@ namespace DCGO.CardEffects.BT21
 
             #region Progress
 
-            if (timing == EffectTiming.OnAllyAttack)
+            if (timing == EffectTiming.None)
             {
-                bool Condition()
-                {
-                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
-                    {
-                        if (GManager.instance.attackProcess.AttackingPermanent == card.PermanentOfThisCard())
-                        {
-                            if (CardEffectCommons.CanActivateProgress(card))
-                            {
-                                return true;
-                            }
-                        }
-                    }
-                    return false;
-                }
-                cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, Condition));
+                cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, null));
             }
 
             #endregion

+ 2 - 7
Assets/CardEffect/BT21/Red/BT21_029.cs

@@ -15,14 +15,9 @@ namespace DCGO.CardEffects.BT21
 
             #region Progress
 
-            if (timing == EffectTiming.RulesTiming || timing == EffectTiming.AfterEffectsActivate)
+            if (timing == EffectTiming.None)
             {
-                bool Condition()
-                {
-                    return CardEffectCommons.CanActivateProgress(card);
-                }
-
-                cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, Condition));
+                cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, null));
             }
 
             #endregion

+ 1 - 1
Assets/CardEffect/BT21/Red/BT21_030.cs

@@ -27,7 +27,7 @@ namespace DCGO.CardEffects.BT21
 
                 cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
                     permanentCondition: PermanentCondition,
-                    digivolutionCost: 3,
+                    digivolutionCost:5,
                     ignoreDigivolutionRequirement: false,
                     card: card,
                     condition: null)

+ 1 - 1
Assets/CardEffect/BT21/Yellow/BT21_045.cs

@@ -15,7 +15,7 @@ namespace DCGO.CardEffects.BT21
             {
                 bool PermanentCondition(Permanent targetPermanent)
                 {
-                    return (targetPermanent.TopCard.EqualsCardName("RizeGreymon") || targetPermanent.TopCard.EqualsTraits("Hero")) && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
+                    return (targetPermanent.TopCard.ContainsCardName("RizeGreymon") || targetPermanent.TopCard.EqualsTraits("Hero")) && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
                 }
 
                 cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));

+ 10 - 10
Assets/Scripts/AutoProcessing.cs

@@ -244,7 +244,7 @@ public class AutoProcessing : MonoBehaviourPunCallbacks
         {
             if (permanent.TopCard != null)
             {
-                if (permanent.LinkedCards.Count >= permanent.LinkedMax)
+                if (permanent.LinkedCards.Count > permanent.LinkedMax)
                 {
                     return true;
                 }
@@ -280,7 +280,8 @@ public class AutoProcessing : MonoBehaviourPunCallbacks
             //Link Lacking condition
             yield return ContinuousController.instance.StartCoroutine(DigimonLackLinkConditionProcess());
 
-            //TODO: Add link count correction
+            //Add link count correction
+            yield return ContinuousController.instance.StartCoroutine(DigimonLackLinkMaxCountProcess());
 
             IsRuleProcessing = false;
         }
@@ -333,7 +334,12 @@ public class AutoProcessing : MonoBehaviourPunCallbacks
         }
         #endregion
 
-        //TODO: Add link count condition
+        #region Is it necessary to deal with Digimon's Link Count?
+        if (CardEffectCommons.HasMatchConditionPermanent(IsDigimonLackLinkCount))
+        {
+            return true;
+        }
+        #endregion
 
         return false;
     }
@@ -490,13 +496,7 @@ public class AutoProcessing : MonoBehaviourPunCallbacks
         {
             foreach (Permanent permanent in LackLinkCountPermanents)
             {
-                if (permanent.LinkedCards.Count >= permanent.LinkedMax)
-                {
-                    if (permanent.LinkedMax > 1)
-                        yield return ContinuousController.instance.StartCoroutine(permanent.RemoveLinkedCard(null, (permanent.LinkedCards.Count - permanent.LinkedMax)));
-                    else
-                        yield return ContinuousController.instance.StartCoroutine(permanent.RemoveLinkedCard(permanent.LinkedCards[0]));
-                }
+                yield return ContinuousController.instance.StartCoroutine(permanent.RemoveLinkedCard(null, (permanent.LinkedCards.Count - permanent.LinkedMax)));
             }
         }
     }

+ 9 - 2
Assets/Scripts/CardController.cs

@@ -968,7 +968,7 @@ public class PlayCardClass
         }
 
         if (appFusion)
-            playPermanent.SetAppFusion();
+            playPermanent.SetAppFusion(_appFusionFrameIDs);
 
         if (_isBreedingArea)
         {
@@ -1109,8 +1109,12 @@ public class PlayPermanentClass
         _burstDigivolved = true;
     }
 
-    public void SetAppFusion()
+    public void SetAppFusion(int[] appFusionFrameIDs)
     {
+        if (appFusionFrameIDs != null)
+        {
+            _appFusionFrameIDs = appFusionFrameIDs.CloneArray();
+        }
         _appFusion = true;
     }
 
@@ -1132,12 +1136,15 @@ public class PlayPermanentClass
     int[] _jogressEvoRootsFrameIDs = null;
     int _digiXrosCount = 0;
     bool _burstDigivolved = false;
+    int[] _appFusionFrameIDs = null;
     bool _appFusion = false;
     bool _isBreedingArea = false;
     bool _isPlayOption = false;
 
     public bool isJogress => _jogressEvoRootsFrameIDs != null && _jogressEvoRootsFrameIDs.Length == 2;
 
+    public bool isAppFusion => _appFusionFrameIDs != null && _appFusionFrameIDs.Length == 2;
+
     public IEnumerator PlayPermanent()
     {
         List<OnEnterFieldHashtableParams> hashtableParams = new List<OnEnterFieldHashtableParams>();

+ 2 - 4
Assets/Scripts/CardEffectCommons/KeyWordEffects/Progress.cs

@@ -16,8 +16,6 @@ public partial class CardEffectCommons
 
         CardSource card = activateClass.EffectSourceCard;
 
-        bool PermanentCondition(Permanent permanent) => permanent == targetPermanent;
-
         bool CanUseCondition()
         {
             if (IsPermanentExistsOnBattleArea(targetPermanent))
@@ -31,9 +29,9 @@ public partial class CardEffectCommons
             return false;
         }
 
-        ActivateClass progress = CardEffectFactory.ProgressStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, condition: CanUseCondition);
+        CanNotAffectedClass progress = CardEffectFactory.ProgressStaticEffect(isInheritedEffect: false, card: card, condition: CanUseCondition);
 
-        AddEffectToPermanent(targetPermanent: targetPermanent, effectDuration: effectDuration, card: card, cardEffect: progress, timing: EffectTiming.OnAllyAttack);
+        AddEffectToPermanent(targetPermanent: targetPermanent, effectDuration: effectDuration, card: card, cardEffect: progress, timing: EffectTiming.None);
 
         if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
         {

+ 36 - 49
Assets/Scripts/CardEffectFactory/KeyWordEffects/Progress.cs

@@ -7,88 +7,75 @@ using UnityEngine;
 public partial class CardEffectFactory
 {
     #region Static effect of [Progress] on oneself
-    public static ActivateClass ProgressSelfStaticEffect(bool isInheritedEffect, CardSource card, Func<bool> condition)
+    public static CanNotAffectedClass ProgressSelfStaticEffect(bool isInheritedEffect, CardSource card, Func<bool> condition)
     {
-        Permanent targetPermanent = card.PermanentOfThisCard();
-
-        bool PermanentCondition(Permanent permanent) => permanent == card.PermanentOfThisCard();
-
         bool CanUseCondition()
         {
-            if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
-            {
-                if (GManager.instance.attackProcess.IsAttacking)
-                {
-                    if (GManager.instance.attackProcess.AttackingPermanent == card.PermanentOfThisCard())
-                    {
-                        if (condition == null || condition())
-                        {
-                            return true;
-                        }
-                    }
-                }
-            }
-
-            return false;
+            return CardEffectCommons.CanActivateProgress(card);
         }
 
-        return ProgressStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: isInheritedEffect, card: card, condition: CanUseCondition);
+        return ProgressStaticEffect(isInheritedEffect: isInheritedEffect, card: card, condition: CanUseCondition);
     }
     #endregion
 
     #region Static effect of [Progress]
-    public static ActivateClass ProgressStaticEffect(
-        Func<Permanent, bool> permanentCondition,
+    public static CanNotAffectedClass ProgressStaticEffect(
         bool isInheritedEffect,
         CardSource card,
         Func<bool> condition)
     {
-        ActivateClass activateClass = new ActivateClass();
-        activateClass.SetUpICardEffect("Progress", CanUseCondition, card);
-        activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
-        activateClass.SetIsInheritedEffect(isInheritedEffect);
-        activateClass.SetIsBackgroundProcess(true);
+        CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
+        canNotAffectedClass.SetUpICardEffect("Progress", CanUseCondition, card);
+        canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
+        canNotAffectedClass.SetIsInheritedEffect(isInheritedEffect);
+        canNotAffectedClass.SetIsBackgroundProcess(true);
 
-        string EffectDiscription()
+        bool CanUseCondition(Hashtable hashtable)
         {
-            return DataBase.ProgressEffectDiscription();
+            if (condition == null || condition())
+            {
+                return true;
+            }
+
+            return false;
         }
 
-        bool PermanentCondition(Permanent permanent)
+        bool CardCondition(CardSource cardSource)
         {
-            if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
+            if (CardEffectCommons.IsExistOnBattleArea(card))
             {
-                if (permanentCondition == null || permanentCondition(permanent))
+                if (cardSource == card)
                 {
-                    return true;
+                    if (GManager.instance.attackProcess.IsAttacking)
+                    {
+                        if (GManager.instance.attackProcess.AttackingPermanent == cardSource.PermanentOfThisCard())
+                        {
+                            return true;
+                        }
+                    }
                 }
             }
 
             return false;
         }
 
-        bool CanUseCondition(Hashtable hashtable)
+        bool SkillCondition(ICardEffect cardEffect)
         {
-            if (condition == null || condition())
+            if (cardEffect != null)
             {
-                if(PermanentCondition(card.PermanentOfThisCard()))
-                    return true;
+                if (cardEffect.EffectSourceCard != null)
+                {
+                    if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
+                    {
+                        return true;
+                    }
+                }
             }
 
             return false;
         }
 
-        bool CanActivateCondition(Hashtable hashtable)
-        {
-            return true;
-        }
-
-        IEnumerator ActivateCoroutine(Hashtable _hashtable)
-        {
-            return CardEffectCommons.ProgressProcess(card, activateClass);
-        }
-
-        return activateClass;
+        return canNotAffectedClass;
     }
     #endregion
 }

+ 2 - 2
ProjectSettings/ProjectSettings.asset

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:ef18a9093b188f1982ab02ba819e35d75af5c626eb56d2d741e541871c1b284b
-size 20169
+oid sha256:16ca5104caac976b610575e165741ee3b8f029455be1d5f0cb7c0f4b78a3675d
+size 20168