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

Implement Mode.Degenerate with AD1-018 to test

hooperk 5 месяцев назад
Родитель
Сommit
8c769f87c3
2 измененных файлов с 33 добавлено и 29 удалено
  1. 9 29
      Assets/Scripts/CardEffect/AD1/Purple/AD1_018.cs
  2. 24 0
      Assets/Scripts/Script/SelectPermanentEffect.cs

+ 9 - 29
Assets/Scripts/CardEffect/AD1/Purple/AD1_018.cs

@@ -263,8 +263,6 @@ namespace DCGO.CardEffects.AD1
 
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
                 {
-                    Permanent selectedPermanent = null;
-
                     int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
                     int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
 
 
                     SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
                     SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
@@ -276,22 +274,15 @@ namespace DCGO.CardEffects.AD1
                         maxCount: 1,
                         maxCount: 1,
                         canNoSelect: false,
                         canNoSelect: false,
                         canEndNotMax: false,
                         canEndNotMax: false,
-                        selectPermanentCoroutine: SelectPermanentCoroutine,
-                            afterSelectPermanentCoroutine: null,
-                            mode: SelectPermanentEffect.Mode.Custom,
-                            cardEffect: activateClass);
+                        selectPermanentCoroutine: null,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Degenerate,
+                        cardEffect: activateClass);
 
 
-                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
-                    {
-                        selectedPermanent = permanent;
-                        yield return null;
-                    }
+                    selectPermanentEffect.SetDegenerationCount(2);
 
 
                     selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
                     selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
                     yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
                     yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                    if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(
-                        new IDegeneration(selectedPermanent, 2, activateClass).Degeneration());
                 }
                 }
             }
             }
             #endregion
             #endregion
@@ -334,8 +325,6 @@ namespace DCGO.CardEffects.AD1
 
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
                 {
-                    Permanent selectedPermanent = null;
-
                     int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
                     int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
 
 
                     SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
                     SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
@@ -347,23 +336,14 @@ namespace DCGO.CardEffects.AD1
                         maxCount: maxCount,
                         maxCount: maxCount,
                         canNoSelect: false,
                         canNoSelect: false,
                         canEndNotMax: false,
                         canEndNotMax: false,
-                        selectPermanentCoroutine: SelectPermanentCoroutine,
-                            afterSelectPermanentCoroutine: null,
-                            mode: SelectPermanentEffect.Mode.Custom,
-                            cardEffect: activateClass);
-
-                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
-                    {
-                        selectedPermanent = permanent;
-                        yield return null;
-                    }
+                        selectPermanentCoroutine: null,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Degenerate,
+                        cardEffect: activateClass);
 
 
                     selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
                     selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
                     yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
                     yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
 
 
-                    if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(
-                        new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
-
                     int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition1));
                     int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition1));
 
 
                     SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
                     SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();

+ 24 - 0
Assets/Scripts/Script/SelectPermanentEffect.cs

@@ -73,6 +73,11 @@ public class SelectPermanentEffect : MonoBehaviourPunCallbacks
         _customBackButtonMessage = CustomBackButtonMessage;
         _customBackButtonMessage = CustomBackButtonMessage;
     }
     }
 
 
+    public void SetDegenerationCount(int degenerationCount)
+    {
+        _degenerationCount = degenerationCount;
+    }
+
     //Player to select
     //Player to select
     Player _selectPlayer = null;
     Player _selectPlayer = null;
     //Conditions of units that can be selected
     //Conditions of units that can be selected
@@ -97,6 +102,7 @@ public class SelectPermanentEffect : MonoBehaviourPunCallbacks
     ICardEffect _cardEffect = null;
     ICardEffect _cardEffect = null;
     bool _isLocal = false;
     bool _isLocal = false;
     bool _isdigiXros = false;
     bool _isdigiXros = false;
+    int _degenerationCount = 1;
 
 
     public enum Mode
     public enum Mode
     {
     {
@@ -106,6 +112,7 @@ public class SelectPermanentEffect : MonoBehaviourPunCallbacks
         Bounce,
         Bounce,
         PutLibraryBottom,
         PutLibraryBottom,
         PutLibraryTop,
         PutLibraryTop,
+        Degenerate,
         Custom
         Custom
     }
     }
 
 
@@ -224,6 +231,7 @@ public class SelectPermanentEffect : MonoBehaviourPunCallbacks
         List<Permanent> libraryBottomPermanents = new List<Permanent>();
         List<Permanent> libraryBottomPermanents = new List<Permanent>();
         List<Permanent> libraryTopPermanents = new List<Permanent>();
         List<Permanent> libraryTopPermanents = new List<Permanent>();
         List<Permanent> handBouncePermanents = new List<Permanent>();
         List<Permanent> handBouncePermanents = new List<Permanent>();
+        List<Permanent> degeneratePermanents = new List<Permanent>();
 
 
         _noSelect = false;
         _noSelect = false;
 
 
@@ -304,6 +312,10 @@ public class SelectPermanentEffect : MonoBehaviourPunCallbacks
                             message = "Select cards to put on top of the deck.";
                             message = "Select cards to put on top of the deck.";
                             break;
                             break;
 
 
+                        case Mode.Degenerate:
+                            message = $"Select cards to De-Digivolve {_degenerationCount}.";
+                            break;
+
                         case Mode.Custom:
                         case Mode.Custom:
                             message = "Select cards.";
                             message = "Select cards.";
                             break;
                             break;
@@ -831,6 +843,10 @@ public class SelectPermanentEffect : MonoBehaviourPunCallbacks
                             case Mode.PutLibraryTop:
                             case Mode.PutLibraryTop:
                                 libraryTopPermanents.Add(targetPermanent);
                                 libraryTopPermanents.Add(targetPermanent);
                                 break;
                                 break;
+
+                            case Mode.Degenerate:
+                                degeneratePermanents.Add(targetPermanent);
+                                break;
                         }
                         }
                         #endregion
                         #endregion
 
 
@@ -884,6 +900,14 @@ public class SelectPermanentEffect : MonoBehaviourPunCallbacks
                     {
                     {
                         yield return ContinuousController.instance.StartCoroutine(new HandBounceClaass(handBouncePermanents, hashtable).Bounce());
                         yield return ContinuousController.instance.StartCoroutine(new HandBounceClaass(handBouncePermanents, hashtable).Bounce());
                     }
                     }
+
+                    if (degeneratePermanents.Count > 0)
+                    {
+                        foreach (Permanent selectedPermanent in degeneratePermanents)
+                        {
+                            yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, _degenerationCount, _cardEffect).Degeneration());
+                        }
+                    }
                 }
                 }
             }
             }
         }
         }