Explorar el Código

Update Guard.cs

x89rt2 hace 2 meses
padre
commit
8e2177a81c
Se han modificado 1 ficheros con 19 adiciones y 14 borrados
  1. 19 14
      Assets/Scripts/Script/CardEffectFactory/KeyWordEffects/Guard.cs

+ 19 - 14
Assets/Scripts/Script/CardEffectFactory/KeyWordEffects/Guard.cs

@@ -52,9 +52,9 @@ public partial class CardEffectFactory
             return CanActivateGuard(targetPermanent, activateClass);
             return CanActivateGuard(targetPermanent, activateClass);
         }
         }
 
 
-        IEnumerator ActivateCoroutine(Hashtable _hashtable)
+        IEnumerator ActivateCoroutine(Hashtable hashtable)
         {
         {
-            return CardEffectFactory.GuardProcess(_hashtable, activateClass, targetPermanent);
+            return CardEffectFactory.GuardProcess(hashtable, activateClass, targetPermanent);
         }
         }
 
 
         return activateClass;
         return activateClass;
@@ -70,14 +70,18 @@ public partial class CardEffectFactory
     #endregion
     #endregion
 
 
     #region Effect process of [Guard]
     #region Effect process of [Guard]
-    public static IEnumerator GuardProcess(Hashtable hashtable, ICardEffect activateClass, Permanent permanent)
+    public static IEnumerator GuardProcess(Hashtable hashtable, ICardEffect activateClass, Permanent guardPermanent)
     {
     {
-        if (permanent == null) yield break;
-        if (permanent.TopCard == null) yield break;
+        if (guardPermanent == null) yield break;
+        if (guardPermanent.TopCard == null) yield break;
 
 
-        bool PermanentCondition(Permanent otherPermanent) => permanent != otherPermanent && CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(otherPermanent, permanent.TopCard);
+        bool PermanentCondition(Permanent otherPermanent)
+        {
+            return otherPermanent != guardPermanent
+                && CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(otherPermanent, guardPermanent.TopCard);
+        }
 
 
-        Player owner = permanent.TopCard.Owner;
+        Player owner = guardPermanent.TopCard.Owner;
 
 
         string selectPlayerMessage = "Will you delete this digimon to prevent the removal?";
         string selectPlayerMessage = "Will you delete this digimon to prevent the removal?";
         string notSelectPlayerMessage = "The opponent is choosing if they will use Guard.";
         string notSelectPlayerMessage = "The opponent is choosing if they will use Guard.";
@@ -94,20 +98,21 @@ public partial class CardEffectFactory
 
 
         if (GManager.instance.userSelectionManager.SelectedBoolValue)
         if (GManager.instance.userSelectionManager.SelectedBoolValue)
         {
         {
-            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
+            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { guardPermanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
 
 
             IEnumerator SuccessProcess()
             IEnumerator SuccessProcess()
             {
             {
                 List<Permanent> GuardedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(PermanentCondition);
                 List<Permanent> GuardedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(PermanentCondition);
 
 
-                foreach (Permanent guardPermanent in GuardedPermanents)
+                foreach (Permanent otherpermanent in GuardedPermanents)
                 {
                 {
-                    guardPermanent.willBeRemoveField = false;
-                    guardPermanent.HideDeleteEffect();
-                    guardPermanent.HideHandBounceEffect();
-                    guardPermanent.HideDeckBounceEffect();
-                    guardPermanent.HideWillRemoveFieldEffect();
+                    otherpermanent.willBeRemoveField = false;
+                    otherpermanent.HideDeleteEffect();
+                    otherpermanent.HideHandBounceEffect();
+                    otherpermanent.HideDeckBounceEffect();
+                    otherpermanent.HideWillRemoveFieldEffect();
                 }
                 }
+
                 yield return null;
                 yield return null;
             }
             }
         }
         }