瀏覽代碼

isLinkEffect added

mbunch_kascope 1 年之前
父節點
當前提交
3266bdd13e

+ 2 - 1
Assets/Scripts/CardEffectFactory/ChangeCardDP.cs

@@ -8,7 +8,7 @@ using UnityEngine;
 public partial class CardEffectFactory
 {
     #region Static effect that changes security Digimon card DP
-    public static ChangeCardDPClass ChangeSecurityDigimonCardDPStaticEffect<T>(Func<CardSource, bool> cardCondition, T changeValue, bool isInheritedEffect, CardSource card, Func<bool> condition, string effectName)
+    public static ChangeCardDPClass ChangeSecurityDigimonCardDPStaticEffect<T>(Func<CardSource, bool> cardCondition, T changeValue, bool isInheritedEffect, CardSource card, Func<bool> condition, string effectName, bool islinkedEffect = false)
     {
         bool isInt = typeof(T) == typeof(int);
         bool isIntFunc = typeof(T) == typeof(Func<int>);
@@ -25,6 +25,7 @@ public partial class CardEffectFactory
         changeCardDPClass.SetUpICardEffect("", CanUseCondition, card);
         changeCardDPClass.SetUpChangeCardDPClass(changeDPFunc: ChangeDP, cardSourceCondition: CardCondition, isUpDown: _isUpDown, isMinusDP: () => !isUpValue());
         changeCardDPClass.SetIsInheritedEffect(isInheritedEffect);
+        changeCardDPClass.SetIsLinkedEffect(islinkedEffect);
 
         bool CanUseCondition(Hashtable hashtable)
         {

+ 5 - 3
Assets/Scripts/CardEffectFactory/KeyWordEffects/Pierce.cs

@@ -7,7 +7,7 @@ using UnityEngine;
 public partial class CardEffectFactory
 {
     #region Trigger effect of [Pierce] on oneself
-    public static ActivateClass PierceSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition)
+    public static ActivateClass PierceSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition, bool isLinkedEffect = false)
     {
         Permanent targetPermanent = card.PermanentOfThisCard();
 
@@ -24,12 +24,12 @@ public partial class CardEffectFactory
             return false;
         }
 
-        return PierceEffect(targetPermanent: targetPermanent, isInheritedEffect: isInheritedEffect, condition: CanUseCondition, rootCardEffect: null, card);
+        return PierceEffect(targetPermanent: targetPermanent, isInheritedEffect: isInheritedEffect, condition: CanUseCondition, rootCardEffect: null, card, isLinkedEffect: isLinkedEffect);
     }
     #endregion
 
     #region Trigger effect of [Pierce]
-    public static ActivateClass PierceEffect(Permanent targetPermanent, bool isInheritedEffect, Func<bool> condition, ICardEffect rootCardEffect, CardSource card)
+    public static ActivateClass PierceEffect(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;
@@ -39,10 +39,12 @@ public partial class CardEffectFactory
         activateClass.SetUpICardEffect("Pierce", CanUseCondition, card);
         activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, DataBase.PierceEffectDiscription());
         activateClass.SetIsInheritedEffect(isInheritedEffect);
+        activateClass.SetIsLinkedEffect(isLinkedEffect);
 
         if (rootCardEffect != null)
         {
             activateClass.SetIsInheritedEffect(false);
+            activateClass.SetIsLinkedEffect(false);
             activateClass.SetEffectSourcePermanent(targetPermanent);
             activateClass.SetRootCardEffect(rootCardEffect);
         }

+ 5 - 3
Assets/Scripts/CardEffectFactory/KeyWordEffects/Raid.cs

@@ -7,7 +7,7 @@ using UnityEngine;
 public partial class CardEffectFactory
 {
     #region Trigger effect of [Raid] on oneself
-    public static ActivateClass RaidSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition, ICardEffect rootCardEffect = null)
+    public static ActivateClass RaidSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition, ICardEffect rootCardEffect = null, bool isLinkedEffect = false)
     {
         Permanent targetPermanent = card.PermanentOfThisCard();
 
@@ -24,12 +24,12 @@ public partial class CardEffectFactory
             return false;
         }
 
-        return RaidEffect(targetPermanent: targetPermanent, isInheritedEffect: isInheritedEffect, condition: CanUseCondition, rootCardEffect: rootCardEffect, card);
+        return RaidEffect(targetPermanent: targetPermanent, isInheritedEffect: isInheritedEffect, condition: CanUseCondition, rootCardEffect: rootCardEffect, card, isLinkedEffect: isLinkedEffect);
     }
     #endregion
 
     #region Trigger effect of [Raid]
-    public static ActivateClass RaidEffect(Permanent targetPermanent, bool isInheritedEffect, Func<bool> condition, ICardEffect rootCardEffect, CardSource card)
+    public static ActivateClass RaidEffect(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;
@@ -39,10 +39,12 @@ public partial class CardEffectFactory
         activateClass.SetUpICardEffect("Raid", CanUseCondition, card);
         activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, DataBase.RaidEffectDiscription());
         activateClass.SetIsInheritedEffect(isInheritedEffect);
+        activateClass.SetIsLinkedEffect(isLinkedEffect);
 
         if (rootCardEffect != null)
         {
             activateClass.SetIsInheritedEffect(false);
+            activateClass.SetIsLinkedEffect(false);
             activateClass.SetEffectSourcePermanent(targetPermanent);
             activateClass.SetRootCardEffect(rootCardEffect);
         }

+ 4 - 5
Assets/Scripts/ICardEffect.cs

@@ -285,15 +285,14 @@ public abstract class ICardEffect
                     if (IsInheritedEffect || IsLinkedEffect)
                     {
                         if (EffectSourceCard == EffectSourceCard.PermanentOfThisCard().TopCard)
-                        {
                             return false;
-                        }
+
                         if (!EffectSourceCard.PermanentOfThisCard().IsDigimon)
-                        {
                             return false;
-                        }
-                    }
 
+                        if (IsLinkedEffect && !EffectSourceCard.PermanentOfThisCard().LinkedCards.Exists(link => link.Source == EffectSourceCard))
+                            return false;
+                    }
                     else
                     {
                         if (EffectSourceCard != EffectSourceCard.PermanentOfThisCard().TopCard)