Explorar el Código

Fix AD1_021, BT7_032 not use OPT and fix Twice Per Turn

hooperk hace 4 meses
padre
commit
f41f595ca4

+ 6 - 1
Assets/Scripts/CardEffect/AD1/Yellow/AD1_021.cs

@@ -122,7 +122,6 @@ namespace DCGO.CardEffects.AD1
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("1 Marcus Damon is also a 6k Digimon, gains Rush & can't digivolve. Then, 1 of your Digimon may attack", CanUseCondition, card);
                 activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
-                activateClass.SetIsOptionalOverride(_ => !CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition));//Effect is optional while you do not have an Agumon or Greymon
                 activateClass.SetHashString("AD1_021_EoYT");
                 cardEffects.Add(activateClass);
 
@@ -158,6 +157,7 @@ namespace DCGO.CardEffects.AD1
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
+                    bool activated = false;
                     if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
                     {
                         SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
@@ -181,6 +181,8 @@ namespace DCGO.CardEffects.AD1
 
                         IEnumerator SelectPermanentCoroutine(Permanent permanent)
                         {
+                            activated = true;
+
                             yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BecomeDigimonThatCantDigivolve(
                                 targetPermanent: permanent, 
                                 DP: 6000, 
@@ -216,6 +218,8 @@ namespace DCGO.CardEffects.AD1
 
                         IEnumerator SelectPermanentCoroutine(Permanent permanent)
                         {
+                            activated = true;
+
                             SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
 
                             selectAttackEffect.SetUp(
@@ -227,6 +231,7 @@ namespace DCGO.CardEffects.AD1
                             yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
                         }
                     }
+                    if (!activated) activateClass.RemoveUse();
                 }
             }
             #endregion

+ 6 - 3
Assets/Scripts/CardEffect/BT7/Yellow/BT7_032.cs

@@ -12,8 +12,7 @@ public class BT7_032 : CEntity_Effect
         {
             ActivateClass activateClass = new ActivateClass();
             activateClass.SetUpICardEffect("If you have 3 security cards, gain 2 memory", CanUseCondition, card);
-            activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
-            activateClass.SetIsOptionalOverride(_ => card.Owner.SecurityCards.Count != 3);//Effect is optional while you do not have 3 mem to whiff
+            activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
             activateClass.SetIsInheritedEffect(true);
             activateClass.SetHashString("Memory+2_BT7_032");
             cardEffects.Add(activateClass);
@@ -34,12 +33,16 @@ public class BT7_032 : CEntity_Effect
                 return CardEffectCommons.IsExistOnBattleArea(card);
             }
 
-            IEnumerator ActivateCoroutine(Hashtable _hashtable)
+            IEnumerator ActivateCoroutine(Hashtable hashtable)
             {
                 if (card.Owner.SecurityCards.Count == 3)
                 { 
                     yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
                 }
+                else
+                {
+                    activateClass.RemoveUse();
+                }
             }
         }
 

+ 7 - 0
Assets/Scripts/Script/CEntity_EffectController.cs

@@ -273,6 +273,13 @@ public class CEntity_EffectController : MonoBehaviour
         UseEffectsThisTurn.Add(cardEffect);
     }
     #endregion
+
+    #region Remove a use of the effect this turn
+    public void RemoveUseEffectThisTurn(ICardEffect cardEffect)
+    {
+        UseEffectsThisTurn.Remove(cardEffect);
+    }
+    #endregion
 }
 
 public class EmptyEffectClass : CEntity_Effect

+ 7 - 1
Assets/Scripts/Script/ICardEffect.cs

@@ -1087,7 +1087,6 @@ public static class ActivateICardEffectExtensionClass
             ((ICardEffect)activateICardEffect).SetOnProcessCallbuck(null);
 
             //Handling Effect
-            ((ICardEffect)activateICardEffect).EffectSourceCard.cEntity_EffectController.RegisterUseEfffectThisTurn(((ICardEffect)activateICardEffect));
             yield return ContinuousController.instance.StartCoroutine(activateICardEffect.Activate(hash));
         }
     }
@@ -1205,6 +1204,13 @@ public static class ActivateICardEffectExtensionClass
 
     #endregion
 
+    #region remove a usage of an X Per Turn
+    public static void RemoveUse(this ActivateICardEffect activateICardEffect)
+    {
+        ((ICardEffect)activateICardEffect).EffectSourceCard.cEntity_EffectController.RemoveUseEffectThisTurn((ICardEffect)activateICardEffect);
+    }
+    #endregion
+
     #region Effect → Processing
 
     public static IEnumerator Activate_Effect_Execute(this ActivateICardEffect activateICardEffect, Hashtable hash, UnityAction<ICardEffect> useEffectCallback)