Selaa lähdekoodia

added factory scapegoat, fixed up dinomon

mbunch_kascope 1 vuosi sitten
vanhempi
sitoutus
43cff3d7da

+ 5 - 0
Assets/CardEffect/EX8/Purple/NightmareSoldiers_EX8_071.cs

@@ -48,6 +48,11 @@ namespace DCGO.CardEffects.EX8
                 }
                 }
 
 
                 // TODO: Apply Scapegoat to all NSo Digimon
                 // TODO: Apply Scapegoat to all NSo Digimon
+                cardEffects.Add(CardEffectFactory.ScapegoatStaticEffect(
+                    permanentCondition: PermanentCondition,
+                    isInheritedEffect: false,
+                    card: card,
+                    condition: CanUseCondition));
             }
             }
 
 
             #endregion
             #endregion

+ 1 - 1
Assets/CardEffect/EX8/Red/Dinomon_EX8_016.cs

@@ -190,7 +190,7 @@ namespace DCGO.CardEffects.EX8
 
 
                 bool DefenderCondition(Permanent permanent)
                 bool DefenderCondition(Permanent permanent)
                 {
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
                     {
                     {
                         if (permanent.IsSuspended)
                         if (permanent.IsSuspended)
                         {
                         {

+ 35 - 0
Assets/Scripts/CardEffectFactory/KeyWordEffects/Scapegoat.cs

@@ -103,4 +103,39 @@ public partial class CardEffectFactory
     }
     }
     #endregion
     #endregion
 
 
+    #region Static effect of [Scapegoat]
+    public static ScapegoatClass ScapegoatStaticEffect(Func<Permanent, bool> permanentCondition, bool isInheritedEffect, CardSource card, Func<bool> condition)
+    {
+        string effectName = "Scapegoat";
+
+        ScapegoatClass scapegoateClass = new ScapegoatClass();
+        scapegoateClass.SetUpICardEffect(effectName, CanUseCondition, card);
+        scapegoateClass.SetUpScapegoatClass(PermanentCondition: PermanentCondition);
+
+        if (isInheritedEffect)
+        {
+            scapegoateClass.SetIsInheritedEffect(true);
+        }
+
+        bool CanUseCondition(Hashtable hashtable)
+        {
+            return condition == null || condition();
+        }
+
+        bool PermanentCondition(Permanent permanent)
+        {
+            if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
+            {
+                if (permanentCondition == null || permanentCondition(permanent))
+                {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
+        return scapegoateClass;
+    }
+    #endregion
 }
 }

+ 7 - 0
Assets/Scripts/CardEffectInterfaces.cs

@@ -58,6 +58,13 @@ public interface IAllianceEffect
 }
 }
 #endregion
 #endregion
 
 
+#region "Target permanent gains Scapegoat" effect
+public interface IScapegoatEffect
+{
+    bool HasScapegoat(Permanent permanent);
+}
+#endregion
+
 #region "Treat target permanent as Digimon" effect
 #region "Treat target permanent as Digimon" effect
 public interface ITreatAsDigimonEffect
 public interface ITreatAsDigimonEffect
 {
 {

+ 35 - 0
Assets/Scripts/CardEffects/ScapegoatClass.cs

@@ -0,0 +1,35 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System.Linq;
+using Photon;
+using System;
+
+public class ScapegoatClass : ICardEffect, IScapegoatEffect
+{
+    public void SetUpScapegoatClass(Func<Permanent, bool> PermanentCondition)
+    {
+        this.PermanentCondition = PermanentCondition;
+    }
+
+    Func<Permanent, bool> PermanentCondition { get; set; }
+
+    public bool HasScapegoat(Permanent permanent)
+    {
+        if (PermanentCondition != null)
+        {
+            if (permanent != null)
+            {
+                if (permanent.TopCard != null)
+                {
+                    if (PermanentCondition(permanent))
+                    {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+}

+ 11 - 0
Assets/Scripts/CardEffects/ScapegoatClass.cs.meta

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