瀏覽代碼

Update Terriermon_ST17_02.cs

mbunch_kascope 2 年之前
父節點
當前提交
0d2e9a5b86
共有 1 個文件被更改,包括 111 次插入201 次删除
  1. 111 201
      Assets/CardEffect/ST17/Green/Terriermon_ST17_02.cs

+ 111 - 201
Assets/CardEffect/ST17/Green/Terriermon_ST17_02.cs

@@ -6,69 +6,83 @@ using Photon;
 using System;
 using Photon.Pun;
 
-public class Terriermon_ST17_02 : CEntity_Effect
+namespace DCGO.CardEffects.ST17
 {
-    public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+    public class Terriermon_ST17_02 : CEntity_Effect
     {
-        List<ICardEffect> cardEffects = new List<ICardEffect>();
-
-        #region Digivolution Condition
-        if (timing == EffectTiming.None)
-        {
-            bool PermanentCondition(Permanent targetPermanent)
-            {
-                return targetPermanent.TopCard.CardNames.Contains("Gummymon");
-            }
-
-            cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
-        }
-        #endregion
-
-        #region Main
-        if (timing == EffectTiming.OnDeclaration)
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
         {
-            ActivateClass activateClass = new ActivateClass();
-            activateClass.SetUpICardEffect("Play 1 Digimon from hand", CanUseCondition, card);
-            activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDiscription());
-            activateClass.SetHashString("PlayDigimon_BT13_056");
-            cardEffects.Add(activateClass);
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            string EffectDiscription()
+            #region Aleternate Digivolution Condition
+            if (timing == EffectTiming.None)
             {
-                return "[Main][Once Per Turn] You may play 1 green or [Royal Knight] trait Digimon card from your hand for the cost. When it would be played by this effect, reduce the play cost by 4.";
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.CardNames.Contains("Gummymon");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
             }
+            #endregion
 
-            bool CanSelectCardCondition(CardSource cardSource)
+            #region Main
+            if (timing == EffectTiming.OnDeclaration)
             {
-                if (cardSource.IsDigimon)
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Play 1 Digimon/Tamer from hand", CanUseCondition, card);
+                activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, true, EffectDiscription());
+                activateClass.SetHashString("PlayReduce_ST17_02");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[Main] [Once Per Turn] You may play 1 green Tamer card or 1 level 3 Digimon card with [Lopmon] in its name from your hand with the play cost reduced by 2.";
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
                 {
-                    if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: true, cardEffect: activateClass))
+                    if (cardSource.IsDigimon)
                     {
-                        if (cardSource.HasRoyalKnightTraits)
+                        if (cardSource.Level == 3)
                         {
-                            return true;
+                            if (cardSource.CardNames.Contains("Lopmon"))
+                            {
+                                return true;
+                            }
                         }
+                    }
 
+                    if (cardSource.IsTamer)
+                    {
                         if (cardSource.CardColors.Contains(CardColor.Green))
                         {
                             return true;
                         }
                     }
-                }
 
-                return false;
-            }
+                    return false;
+                }
 
-            bool CanUseCondition(Hashtable hashtable)
-            {
-                if (CardEffectCommons.IsExistOnBattleArea(card))
+                bool CanUseCondition(Hashtable hashtable)
                 {
-                    bool canPlay = false;
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
+                        {
+                            return true;
+                        }
+                    }
 
-                    #region 登場コスト-4
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable _hashtable)
+                {
+                    #region reduce play cost
                     ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -4", CanUseCondition1, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
+                    changeCostClass.SetUpICardEffect($"Play Cost -2", CanUseCondition1, card);
+                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
                     Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
                     card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
 
@@ -95,7 +109,7 @@ public class Terriermon_ST17_02 : CEntity_Effect
                             {
                                 if (PermanentsCondition(targetPermanents))
                                 {
-                                    Cost -= 4;
+                                    Cost -= 2;
                                 }
                             }
                         }
@@ -123,21 +137,21 @@ public class Terriermon_ST17_02 : CEntity_Effect
 
                     bool CardSourceCondition(CardSource cardSource)
                     {
-                        if (cardSource != null)
+                        if (cardSource.IsTamer)
+                        {
+                            if (cardSource.CardColors.Contains(CardColor.Green))
+                            {
+                                return true;
+                            }
+                        }
+
+                        if (cardSource.IsDigimon)
                         {
-                            if (cardSource.Owner == card.Owner)
+                            if (cardSource.Level == 3)
                             {
-                                if (cardSource.IsDigimon)
+                                if (cardSource.CardNames.Contains("Lopmon"))
                                 {
-                                    if (cardSource.HasRoyalKnightTraits)
-                                    {
-                                        return true;
-                                    }
-
-                                    if (cardSource.CardColors.Contains(CardColor.Green))
-                                    {
-                                        return true;
-                                    }
+                                    return true;
                                 }
                             }
                         }
@@ -158,179 +172,75 @@ public class Terriermon_ST17_02 : CEntity_Effect
 
                     if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
                     {
-                        canPlay = true;
-                    }
+                        List<CardSource> selectedCards = new List<CardSource>();
 
-                    #region 登場コスト-4解除
-                    card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
-                    #endregion
+                        int maxCount = 1;
 
-                    if (canPlay)
-                    {
-                        return true;
-                    }
-                }
+                        SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
 
-                return false;
-            }
+                        selectHandEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectCardCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: maxCount,
+                            canNoSelect: true,
+                            canEndNotMax: false,
+                            isShowOpponent: true,
+                            selectCardCoroutine: SelectCardCoroutine,
+                            afterSelectCardCoroutine: null,
+                            mode: SelectHandEffect.Mode.Custom,
+                            cardEffect: activateClass);
 
-            IEnumerator ActivateCoroutine(Hashtable _hashtable)
-            {
-                #region 登場コスト-4
-                ChangeCostClass changeCostClass = new ChangeCostClass();
-                changeCostClass.SetUpICardEffect("Play Cost -4", CanUseCondition1, card);
-                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
-                card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
-
-                ICardEffect GetCardEffect(EffectTiming _timing)
-                {
-                    if (_timing == EffectTiming.None)
-                    {
-                        return changeCostClass;
-                    }
+                        selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
+                        selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
 
-                    return null;
-                }
+                        yield return StartCoroutine(selectHandEffect.Activate());
 
-                bool CanUseCondition1(Hashtable hashtable)
-                {
-                    return true;
-                }
-
-                int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-                {
-                    if (CardSourceCondition(cardSource))
-                    {
-                        if (RootCondition(root))
+                        IEnumerator SelectCardCoroutine(CardSource cardSource)
                         {
-                            if (PermanentsCondition(targetPermanents))
-                            {
-                                Cost -= 4;
-                            }
-                        }
-                    }
-
-                    return Cost;
-                }
-
-                bool PermanentsCondition(List<Permanent> targetPermanents)
-                {
-                    if (targetPermanents == null)
-                    {
-                        return true;
-                    }
+                            selectedCards.Add(cardSource);
 
-                    else
-                    {
-                        if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
-                        {
-                            return true;
+                            yield return null;
                         }
-                    }
-
-                    return false;
-                }
-
-                bool CardSourceCondition(CardSource cardSource)
-                {
-                    if (cardSource != null)
-                    {
-                        if (cardSource.Owner == card.Owner)
-                        {
-                            if (cardSource.IsDigimon)
-                            {
-                                if (cardSource.HasRoyalKnightTraits)
-                                {
-                                    return true;
-                                }
-
-                                if (cardSource.CardColors.Contains(CardColor.Green))
-                                {
-                                    return true;
-                                }
-                            }
-                        }
-                    }
 
-                    return false;
-                }
-
-                bool RootCondition(SelectCardEffect.Root root)
-                {
-                    return true;
-                }
-
-                bool isUpDown()
-                {
-                    return true;
-                }
-                #endregion
-
-                if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
-                {
-                    List<CardSource> selectedCards = new List<CardSource>();
-
-                    int maxCount = 1;
-
-                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
-
-                    selectHandEffect.SetUp(
-                        selectPlayer: card.Owner,
-                        canTargetCondition: CanSelectCardCondition,
-                        canTargetCondition_ByPreSelecetedList: null,
-                        canEndSelectCondition: null,
-                        maxCount: maxCount,
-                        canNoSelect: true,
-                        canEndNotMax: false,
-                        isShowOpponent: true,
-                        selectCardCoroutine: SelectCardCoroutine,
-                        afterSelectCardCoroutine: null,
-                        mode: SelectHandEffect.Mode.Custom,
-                        cardEffect: activateClass);
-
-                    selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
-                    selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
-
-                    yield return StartCoroutine(selectHandEffect.Activate());
-
-                    IEnumerator SelectCardCoroutine(CardSource cardSource)
-                    {
-                        selectedCards.Add(cardSource);
-
-                        yield return null;
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
+                            cardSources: selectedCards,
+                            activateClass: activateClass,
+                            payCost: true,
+                            isTapped: false,
+                            root: SelectCardEffect.Root.Hand,
+                            activateETB: true));
                     }
 
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: true, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
+                    #region Remove Cost effect after use
+                    card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
+                    #endregion
                 }
-
-                #region 登場コスト-4解除
-                card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
-                #endregion
             }
-        }
             #endregion
 
             #region Inherit
             if (timing == EffectTiming.None)
-        {
-            bool Condition()
             {
-                if (CardEffectCommons.IsExistOnBattleArea(card))
+                bool Condition()
                 {
-                    if (card.PermanentOfThisCard().IsSuspended)
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        return true;
+                        if (card.PermanentOfThisCard().IsSuspended)
+                        {
+                            return true;
+                        }
                     }
+
+                    return false;
                 }
 
-                return false;
+                cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
             }
+            #endregion
 
-            cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
+            return cardEffects;
         }
-        #endregion
-
-        return cardEffects;
     }
-}
+}