فهرست منبع

fixed fragment

mbunch_kascope 1 سال پیش
والد
کامیت
e33aca263b

+ 42 - 14
Assets/Scripts/CardEffectCommons/KeyWordEffects/Fragment.cs

@@ -9,11 +9,14 @@ public partial class CardEffectCommons
     #region Can activate [Fragment]
     #region Can activate [Fragment]
     public static bool CanActivateFragment(Permanent permanent, int trashValue, ICardEffect activateClass)
     public static bool CanActivateFragment(Permanent permanent, int trashValue, ICardEffect activateClass)
     {
     {
+        Debug.Log($"FRAGMENT CAN ACTIVATE: {IsPermanentExistsOnBattleArea(permanent)}");
         if (IsPermanentExistsOnBattleArea(permanent))
         if (IsPermanentExistsOnBattleArea(permanent))
         {
         {
+            Debug.Log($"FRAGMENT CAN ACTIVATE: {permanent.CanBeDestroyedBySkill(activateClass)}");
             if (permanent.CanBeDestroyedBySkill(activateClass))
             if (permanent.CanBeDestroyedBySkill(activateClass))
             {
             {
-                return (permanent.DigivolutionCards.Count < trashValue);
+                Debug.Log($"FRAGMENT CAN ACTIVATE: {permanent.DigivolutionCards.Count} <= {trashValue}");
+                return (permanent.DigivolutionCards.Count <= trashValue);
             }
             }
         }
         }
 
 
@@ -30,24 +33,49 @@ public partial class CardEffectCommons
 
 
         bool cardsTrashed = false;
         bool cardsTrashed = false;
 
 
-        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
-            permanentCondition: (target => target == permanent),
-            cardCondition: (CardSource) =>  true,
-            maxCount: 3,
-            canNoTrash: true,
-            isFromOnly1Permanent: false,
-            activateClass: activateClass,
-            afterSelectionCoroutine: AfterTrashedCards
-        ));
-
-        IEnumerator AfterTrashedCards(Permanent permanent, List<CardSource> cards)
+        List<CardSource> selectedCards = new List<CardSource>();
+
+        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+        selectCardEffect.SetUp(
+                    canTargetCondition: (CardSource) => true,
+                    canTargetCondition_ByPreSelecetedList: null,
+                    canEndSelectCondition: null,
+                    canNoSelect: () => false,
+                    selectCardCoroutine: SelectCardCoroutine,
+                    afterSelectCardCoroutine: null,
+                    message: "Select digivolution cards to trash.",
+                    maxCount: 3,
+                    canEndNotMax: false,
+                    isShowOpponent: true,
+                    mode: SelectCardEffect.Mode.Custom,
+                    root: SelectCardEffect.Root.Custom,
+                    customRootCardList: permanent.DigivolutionCards,
+                    canLookReverseCard: true,
+                    selectPlayer: activateClass.EffectSourceCard.Owner,
+                    cardEffect: activateClass);
+
+        selectCardEffect.SetUpCustomMessage("Select digivolution cards to trash.", "The opponent is selecting digivolution cards to trash.");
+
+        yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+
+        IEnumerator SelectCardCoroutine(CardSource cardSource)
         {
         {
-            if (cards.Count == trashValue)
-                cardsTrashed = true;
+            selectedCards.Add(cardSource);
 
 
             yield return null;
             yield return null;
         }
         }
 
 
+        if (selectedCards.Count == trashValue)
+        {
+            yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(
+                permanent,
+                selectedCards,
+                activateClass).TrashDigivolutionCards());
+
+            cardsTrashed = true;
+        }
+
         if (cardsTrashed)
         if (cardsTrashed)
         {
         {
             permanent.willBeRemoveField = false;
             permanent.willBeRemoveField = false;

+ 1 - 0
Assets/Scripts/CardEffectCommons/TrashDigivolutionCards.cs

@@ -182,4 +182,5 @@ public partial class CardEffectCommons
             }
             }
         }
         }
     }
     }
+
 }
 }

+ 6 - 10
Assets/Scripts/CardEffectFactory/KeyWordEffects/Fragment.cs

@@ -48,22 +48,18 @@ public partial class CardEffectFactory
             activateClass.SetRootCardEffect(rootCardEffect);
             activateClass.SetRootCardEffect(rootCardEffect);
         }
         }
 
 
-        bool CanSelectPermanentCondition(Permanent permanent) => permanent == targetPermanent && CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && targetPermanent.DigivolutionCards.Count < trashValue;
-
         bool CanUseCondition(Hashtable hashtable)
         bool CanUseCondition(Hashtable hashtable)
         {
         {
-            bool CardEffectCondition(ICardEffect cardEffect) => cardEffect.EffectSourceCard.Owner == card.Owner.Enemy;
-
+            Debug.Log($"FRAGMENT CAN USE: {CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent)}");
             if (CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent))
             if (CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent))
             {
             {
-                if (CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, CanSelectPermanentCondition))
+                Debug.Log($"FRAGMENT CAN USE: {CardEffectCommons.CanTriggerWhenRemoveField(hashtable, targetPermanent.TopCard)}");
+                if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, targetPermanent.TopCard))
                 {
                 {
-                    if (CardEffectCommons.IsByEffect(hashtable, CardEffectCondition))
+                    if (condition == null || condition())
                     {
                     {
-                        if (condition == null || condition())
-                        {
-                            return true;
-                        }
+                        Debug.Log($"FRAGMENT CAN USE: TRUE");
+                        return true;
                     }
                     }
                 }
                 }
             }
             }

+ 1 - 1
Assets/Scripts/PlayLog.cs

@@ -150,7 +150,7 @@ public class PlayLog : MonoBehaviour
             startIndex[i] += 1;
             startIndex[i] += 1;
 
 
             string str = log.Substring(startIndex[i], endIndex[i] - startIndex[i]);
             string str = log.Substring(startIndex[i], endIndex[i] - startIndex[i]);
-            Debug.Log(str);
+
             if(!subStrings.Contains(str) && !String.IsNullOrEmpty(str))
             if(!subStrings.Contains(str) && !String.IsNullOrEmpty(str))
                 subStrings.Add(str);
                 subStrings.Add(str);
         }
         }