浏览代码

Zanmetsumon and kohagurumon token

mbunch_kascope 2 年之前
父节点
当前提交
3f45ee3cb5

+ 20 - 15
Assets/CardEffect/BT16/Black/KoHagurumon_BT16_052_token.cs

@@ -1,7 +1,7 @@
 using System.Collections;
 using System.Collections.Generic;
 
-namespace DCGO.CardEffects.BT16
+namespace DCGO.CardEffects.Tokens
 {
     public class KoHagurumon_BT16_052_token : CEntity_Effect
     {
@@ -9,32 +9,36 @@ namespace DCGO.CardEffects.BT16
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            string DecoyDiscription()
+            #region Decoy
+            if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
             {
-                return "<Decoy (Black)> (When one of your other Black Digimon would be deleted by an opponent's effect, you may delete this Digimon to prevent that deletion.)";
-            }
+                string DecoyDiscription()
+                {
+                    return "<Decoy (Black)> (When one of your other Black Digimon would be deleted by an opponent's effect, you may delete this Digimon to prevent that deletion.)";
+                }
 
-            bool CanSelectDecoyPermanentCondition(Permanent permanent)
-            {
-                if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                bool CanSelectDecoyPermanentCondition(Permanent permanent)
                 {
-                    if (permanent != card.PermanentOfThisCard())
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
                     {
-                        if (permanent.TopCard.CardColors.Contains(CardColor.Black))
+                        if (permanent != card.PermanentOfThisCard())
                         {
-                            if (permanent.willBeRemoveField)
+                            if (permanent.TopCard.CardColors.Contains(CardColor.Black))
                             {
-                                return true;
+                                if (permanent.willBeRemoveField)
+                                {
+                                    return true;
+                                }
                             }
                         }
                     }
+
+                    return false;
                 }
 
-                return false;
+                cardEffects.Add(CardEffectFactory.DecoySelfEffect(isInheritedEffect: false, card: card, condition: null, permanentCondition: CanSelectDecoyPermanentCondition, effectName: "Decoy ([Black])", effectDiscription: DecoyDiscription()));
             }
-
-            cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(false, card, null));            
-            cardEffects.Add(CardEffectFactory.DecoySelfEffect(isInheritedEffect: false, card: card, condition: null, permanentCondition: CanSelectDecoyPermanentCondition, effectName: "Decoy ([Bagra Army])", effectDiscription: DecoyDiscription()));
+            #endregion
 
             if (timing == EffectTiming.None)
             {
@@ -44,6 +48,7 @@ namespace DCGO.CardEffects.BT16
                 }
 
                 cardEffects.Add(CardEffectFactory.CanNotAttackSelfStaticEffect(defenderCondition: null, isInheritedEffect: false, card: card, condition: Condition, effectName: "Can't Attack"));
+                cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(false, card, null));
             }
 
             return cardEffects;

+ 213 - 1
Assets/CardEffect/BT16/Black/Zanmetsumon_BT16_062.cs

@@ -34,12 +34,224 @@ namespace DCGO.CardEffects.BT16
             }
             #endregion
 
-            #region OnPlay
+            #region On Play
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("<De-Digivolve 1>, then delete 3 cost", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[On Play] <De-Digivolve 1> 1 of your opponent's Digimon with as much or less DP as this Digimon. Then, delete 1 Digimon with a play cost of 3 or less.";
+                }
+
+                bool CanSelectDedigivolvePermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    {
+                        if(permanent.HasDP && permanent.DP <= card.PermanentOfThisCard().DP)
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanSelectDeletePermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    {
+                        if(permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 3)
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleArea(card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        int maxCount = 1;
+
+                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDedigivolvePermanentCondition))
+                        {
+                            selectPermanentEffect.SetUp(
+                                selectPlayer: card.Owner,
+                                canTargetCondition: CanSelectDedigivolvePermanentCondition,
+                                canTargetCondition_ByPreSelecetedList: null,
+                                canEndSelectCondition: null,
+                                maxCount: maxCount,
+                                canNoSelect: true,
+                                canEndNotMax: false,
+                                selectPermanentCoroutine: null,
+                                afterSelectPermanentCoroutine: AfterSelectDedigivolvePermanentCoroutine,
+                                mode: SelectPermanentEffect.Mode.Custom,
+                                cardEffect: activateClass);
 
+                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                        }
+
+                        if (card.PermanentOfThisCard().cardSources.Count > 1)
+                        {
+                            if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeletePermanentCondition))
+                            {
+                                selectPermanentEffect.SetUp(
+                                    selectPlayer: card.Owner,
+                                    canTargetCondition: CanSelectDeletePermanentCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    maxCount: maxCount,
+                                    canNoSelect: false,
+                                    canEndNotMax: false,
+                                    selectPermanentCoroutine: null,
+                                    afterSelectPermanentCoroutine: null,
+                                    mode: SelectPermanentEffect.Mode.Destroy,
+                                    cardEffect: activateClass);
+
+                                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                            }
+                        }
+                    }
+
+                    yield return null;
+                }
+
+                IEnumerator AfterSelectDedigivolvePermanentCoroutine(List<Permanent> permanents)
+                {
+                    foreach (Permanent permanent in permanents)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
+                    }
+                }
+            }
             #endregion
 
             #region When Digivolved
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("<De-Digivolve 1>, then delete 3 cost", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[When Digivolve] <De-Digivolve 1> 1 of your opponent's Digimon with as much or less DP as this Digimon. Then, delete 1 Digimon with a play cost of 3 or less.";
+                }
+
+                bool CanSelectDedigivolvePermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    {
+                        if (permanent.HasDP && permanent.DP <= card.PermanentOfThisCard().DP)
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanSelectDeletePermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    {
+                        if (permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 3)
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleArea(card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        int maxCount = 1;
+
+                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDedigivolvePermanentCondition))
+                        {
+                            selectPermanentEffect.SetUp(
+                                selectPlayer: card.Owner,
+                                canTargetCondition: CanSelectDedigivolvePermanentCondition,
+                                canTargetCondition_ByPreSelecetedList: null,
+                                canEndSelectCondition: null,
+                                maxCount: maxCount,
+                                canNoSelect: true,
+                                canEndNotMax: false,
+                                selectPermanentCoroutine: null,
+                                afterSelectPermanentCoroutine: AfterSelectDedigivolvePermanentCoroutine,
+                                mode: SelectPermanentEffect.Mode.Custom,
+                                cardEffect: activateClass);
 
+                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                        }
+
+                        if (card.PermanentOfThisCard().cardSources.Count > 1)
+                        {
+                            if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeletePermanentCondition))
+                            {
+                                selectPermanentEffect.SetUp(
+                                    selectPlayer: card.Owner,
+                                    canTargetCondition: CanSelectDeletePermanentCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    maxCount: maxCount,
+                                    canNoSelect: false,
+                                    canEndNotMax: false,
+                                    selectPermanentCoroutine: null,
+                                    afterSelectPermanentCoroutine: null,
+                                    mode: SelectPermanentEffect.Mode.Destroy,
+                                    cardEffect: activateClass);
+
+                                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                            }
+                        }
+                    }
+
+                    yield return null;
+                }
+
+                IEnumerator AfterSelectDedigivolvePermanentCoroutine(List<Permanent> permanents)
+                {
+                    foreach (Permanent permanent in permanents)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
+                    }
+                }
+            }
             #endregion
 
             #region All Turns

+ 21 - 3
Assets/Scripts/CEntity_EffectController.cs

@@ -161,10 +161,22 @@ public class CEntity_EffectController : MonoBehaviour
         #region Generate and set an instance of the card effect class
         bool CanAttachEffectComponent()
         {
-            if (string.IsNullOrEmpty(ClassName)) return false;
+            if (string.IsNullOrEmpty(ClassName)) 
+                return false;
+
             if (Type.GetType(ClassName) == null)
             {
-                if (Type.GetType($"DCGO.CardEffects.{ID}.{ClassName}") == null) return false;
+                if (!ClassName.Contains("token"))
+                {
+                    if (Type.GetType($"DCGO.CardEffects.{ID}.{ClassName}") == null)
+                        return false;
+                }
+                else
+                {
+                    if (Type.GetType($"DCGO.CardEffects.Tokens.{ClassName}") == null)
+                        return false;
+                }
+                
             }
 
             return true;
@@ -177,7 +189,13 @@ public class CEntity_EffectController : MonoBehaviour
             Type t = Type.GetType(ClassName);
 
             if (t == null)
-                t = Type.GetType($"DCGO.CardEffects.{ID}.{ClassName}");
+            {
+                if (!ClassName.Contains("token"))
+                    t = Type.GetType($"DCGO.CardEffects.{ID}.{ClassName}");
+                else
+                    t = Type.GetType($"DCGO.CardEffects.Tokens.{ClassName}");
+            }
+                
 
             Component component = this.gameObject.AddComponent(t);
 

+ 1 - 1
Assets/Scripts/ContinuousController.cs

@@ -223,7 +223,7 @@ public class ContinuousController : MonoBehaviour
         KoHagurumonToken = new CEntity_Base()
         {
             cardColors = new List<CardColor>() { CardColor.Black },
-            PlayCost = 0,
+            PlayCost = -1,
             Level = 0,
             CardName_JPN = "",
             CardName_ENG = "KoHagurumon",