Explorar o código

EX12_072 meta data and move Guard to correct location.

x89rt2 hai 2 meses
pai
achega
8fab5c5430

+ 11 - 0
Assets/Scripts/CardEffect/EX12/Black/EX12_072.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d3ffd8c4b0cc06141b5cbb596f604ce1
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 153 - 153
Assets/Scripts/Script/CardEffectCommons/KeyWordEffects/Guard.cs → Assets/Scripts/Script/CardEffectFactory/KeyWordEffects/Guard.cs

@@ -1,154 +1,154 @@
-using System.Collections;
-using System.Collections.Generic;
-using System;
-
-public partial class CardEffectFactory
-{
-    #region [Guard] self effect
-    public static ActivateClass GuardSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition, bool isLinkedEffect = false)
-    {
-        return GuardEffect(
-            targetPermanent: card.PermanentOfThisCard(), 
-            isInheritedEffect,
-            condition,
-            rootCardEffect: null,
-            card,
-            isLinkedEffect);
-    }
-    #endregion
-
-    #region [Guard] Effect
-    public static ActivateClass GuardEffect(Permanent targetPermanent, bool isInheritedEffect, Func<bool> condition, ICardEffect rootCardEffect, CardSource card, bool isLinkedEffect = false)
-    {
-        if (targetPermanent == null) return null;
-        if (targetPermanent.TopCard == null) return null;
-        if (card == null) return null;
-
-        ActivateClass activateClass = new ActivateClass();
-        activateClass.SetUpICardEffect("Guard", CanUseCondition, card);
-        activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, DataBase.GuardEffectDescription());
-        activateClass.SetIsInheritedEffect(isInheritedEffect);
-        activateClass.SetIsLinkedEffect(isLinkedEffect);
-
-        if (rootCardEffect != null)
-        {
-            activateClass.SetIsInheritedEffect(false);
-            activateClass.SetEffectSourcePermanent(targetPermanent);
-            activateClass.SetRootCardEffect(rootCardEffect);
-        }
-
-        bool CanUseCondition(Hashtable hashtable)
-        {
-            return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(targetPermanent)
-                && !targetPermanent.TopCard.CanNotBeAffected(activateClass)
-                && CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, PermanentCondition)
-                && CardEffectCommons.IsByEffect(hashtable, effect => CardEffectCommons.IsOpponentEffect(effect, card));
-        }
-
-        bool PermanentCondition(Permanent permanent) => permanent != targetPermanent && CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
-
-        bool CanActivateCondition(Hashtable hashtable)
-        {
-            return CanActivateGuard(targetPermanent, activateClass);
-        }
-
-        IEnumerator ActivateCoroutine(Hashtable _hashtable)
-        {
-            return CardEffectFactory.GuardProcess(_hashtable, activateClass, targetPermanent);
-        }
-
-        return activateClass;
-    }
-    #endregion
-
-    #region Can activate [Guard]
-    public static bool CanActivateGuard(Permanent permanent, ICardEffect activateClass)
-    {
-        return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
-            && permanent.CanBeDestroyedBySkill(activateClass);
-    }
-    #endregion
-
-    #region Effect process of [Guard]
-    public static IEnumerator GuardProcess(Hashtable hashtable, ICardEffect activateClass, Permanent permanent)
-    {
-        if (permanent == null) yield break;
-        if (permanent.TopCard == null) yield break;
-
-        bool PermanentCondition(Permanent otherPermanent) => permanent != otherPermanent && CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(otherPermanent, permanent.TopCard);
-
-        Player owner = permanent.TopCard.Owner;
-
-        string selectPlayerMessage = "Will you delete this digimon to prevent the removal?";
-        string notSelectPlayerMessage = "The opponent is choosing if they will use Guard.";
-
-        List<SelectionElement<bool>> command_SelectCommands = new List<SelectionElement<bool>>()
-        {
-            new SelectionElement<bool>(message: $"Yes", value: true, spriteIndex: 0),
-            new SelectionElement<bool>(message: $"No", value: false, spriteIndex: 1),
-        };
-
-        GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: command_SelectCommands, selectPlayer: owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
-
-        yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
-
-        if (GManager.instance.userSelectionManager.SelectedBoolValue)
-        {
-            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
-
-            IEnumerator SuccessProcess()
-            {
-                List<Permanent> GuardedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(PermanentCondition);
-
-                foreach (Permanent guardPermanent in GuardedPermanents)
-                {
-                    guardPermanent.willBeRemoveField = false;
-                    guardPermanent.HideDeleteEffect();
-                    guardPermanent.HideHandBounceEffect();
-                    guardPermanent.HideDeckBounceEffect();
-                    guardPermanent.HideWillRemoveFieldEffect();
-                }
-                yield return null;
-            }
-        }
-    }
-    #endregion
-
-    #region Target 1 Digimon gains [Guard]
-    public static IEnumerator GainGuard(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass)
-    {
-        if (targetPermanent == null) yield break;
-        if (!CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent)) yield break;
-        if (activateClass == null) yield break;
-        if (activateClass.EffectSourceCard == null) yield break;
-
-        CardSource card = activateClass.EffectSourceCard;
-
-        bool CanUseCondition()
-        {
-            return CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent)
-                && !targetPermanent.TopCard.CanNotBeAffected(activateClass);
-        }
-
-        ActivateClass guard = CardEffectFactory.GuardEffect(
-            targetPermanent: targetPermanent,
-            isInheritedEffect: false,
-            condition: CanUseCondition,
-            rootCardEffect: activateClass,
-            card: targetPermanent.TopCard);
-
-        CardEffectCommons.AddEffectToPermanent(
-            targetPermanent: targetPermanent,
-            effectDuration: effectDuration,
-            card: card,
-            cardEffect: guard,
-            timing: EffectTiming.WhenRemoveField);
-
-        if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
-        {
-            yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(targetPermanent));
-        }
-    }
-    #endregion
-
+using System.Collections;
+using System.Collections.Generic;
+using System;
+
+public partial class CardEffectFactory
+{
+    #region [Guard] self effect
+    public static ActivateClass GuardSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition, bool isLinkedEffect = false)
+    {
+        return GuardEffect(
+            targetPermanent: card.PermanentOfThisCard(), 
+            isInheritedEffect,
+            condition,
+            rootCardEffect: null,
+            card,
+            isLinkedEffect);
+    }
+    #endregion
+
+    #region [Guard] Effect
+    public static ActivateClass GuardEffect(Permanent targetPermanent, bool isInheritedEffect, Func<bool> condition, ICardEffect rootCardEffect, CardSource card, bool isLinkedEffect = false)
+    {
+        if (targetPermanent == null) return null;
+        if (targetPermanent.TopCard == null) return null;
+        if (card == null) return null;
+
+        ActivateClass activateClass = new ActivateClass();
+        activateClass.SetUpICardEffect("Guard", CanUseCondition, card);
+        activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, DataBase.GuardEffectDescription());
+        activateClass.SetIsInheritedEffect(isInheritedEffect);
+        activateClass.SetIsLinkedEffect(isLinkedEffect);
+
+        if (rootCardEffect != null)
+        {
+            activateClass.SetIsInheritedEffect(false);
+            activateClass.SetEffectSourcePermanent(targetPermanent);
+            activateClass.SetRootCardEffect(rootCardEffect);
+        }
+
+        bool CanUseCondition(Hashtable hashtable)
+        {
+            return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(targetPermanent)
+                && !targetPermanent.TopCard.CanNotBeAffected(activateClass)
+                && CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, PermanentCondition)
+                && CardEffectCommons.IsByEffect(hashtable, effect => CardEffectCommons.IsOpponentEffect(effect, card));
+        }
+
+        bool PermanentCondition(Permanent permanent) => permanent != targetPermanent && CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
+
+        bool CanActivateCondition(Hashtable hashtable)
+        {
+            return CanActivateGuard(targetPermanent, activateClass);
+        }
+
+        IEnumerator ActivateCoroutine(Hashtable _hashtable)
+        {
+            return CardEffectFactory.GuardProcess(_hashtable, activateClass, targetPermanent);
+        }
+
+        return activateClass;
+    }
+    #endregion
+
+    #region Can activate [Guard]
+    public static bool CanActivateGuard(Permanent permanent, ICardEffect activateClass)
+    {
+        return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
+            && permanent.CanBeDestroyedBySkill(activateClass);
+    }
+    #endregion
+
+    #region Effect process of [Guard]
+    public static IEnumerator GuardProcess(Hashtable hashtable, ICardEffect activateClass, Permanent permanent)
+    {
+        if (permanent == null) yield break;
+        if (permanent.TopCard == null) yield break;
+
+        bool PermanentCondition(Permanent otherPermanent) => permanent != otherPermanent && CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(otherPermanent, permanent.TopCard);
+
+        Player owner = permanent.TopCard.Owner;
+
+        string selectPlayerMessage = "Will you delete this digimon to prevent the removal?";
+        string notSelectPlayerMessage = "The opponent is choosing if they will use Guard.";
+
+        List<SelectionElement<bool>> command_SelectCommands = new List<SelectionElement<bool>>()
+        {
+            new SelectionElement<bool>(message: $"Yes", value: true, spriteIndex: 0),
+            new SelectionElement<bool>(message: $"No", value: false, spriteIndex: 1),
+        };
+
+        GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: command_SelectCommands, selectPlayer: owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
+
+        yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+
+        if (GManager.instance.userSelectionManager.SelectedBoolValue)
+        {
+            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
+
+            IEnumerator SuccessProcess()
+            {
+                List<Permanent> GuardedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(PermanentCondition);
+
+                foreach (Permanent guardPermanent in GuardedPermanents)
+                {
+                    guardPermanent.willBeRemoveField = false;
+                    guardPermanent.HideDeleteEffect();
+                    guardPermanent.HideHandBounceEffect();
+                    guardPermanent.HideDeckBounceEffect();
+                    guardPermanent.HideWillRemoveFieldEffect();
+                }
+                yield return null;
+            }
+        }
+    }
+    #endregion
+
+    #region Target 1 Digimon gains [Guard]
+    public static IEnumerator GainGuard(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass)
+    {
+        if (targetPermanent == null) yield break;
+        if (!CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent)) yield break;
+        if (activateClass == null) yield break;
+        if (activateClass.EffectSourceCard == null) yield break;
+
+        CardSource card = activateClass.EffectSourceCard;
+
+        bool CanUseCondition()
+        {
+            return CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent)
+                && !targetPermanent.TopCard.CanNotBeAffected(activateClass);
+        }
+
+        ActivateClass guard = CardEffectFactory.GuardEffect(
+            targetPermanent: targetPermanent,
+            isInheritedEffect: false,
+            condition: CanUseCondition,
+            rootCardEffect: activateClass,
+            card: targetPermanent.TopCard);
+
+        CardEffectCommons.AddEffectToPermanent(
+            targetPermanent: targetPermanent,
+            effectDuration: effectDuration,
+            card: card,
+            cardEffect: guard,
+            timing: EffectTiming.WhenRemoveField);
+
+        if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
+        {
+            yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(targetPermanent));
+        }
+    }
+    #endregion
+
 }

+ 0 - 0
Assets/Scripts/Script/CardEffectCommons/KeyWordEffects/Guard.cs.meta → Assets/Scripts/Script/CardEffectFactory/KeyWordEffects/Guard.cs.meta