Browse Source

Blocked cards

mbunch_kascope 10 months ago
parent
commit
0a709f2cbf

+ 78 - 3
Assets/CardEffect/BT23/Blue/BT23_017.cs

@@ -154,8 +154,7 @@ namespace DCGO.CardEffects.BT23
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleArea(card)
-                        && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
+                    return CardEffectCommons.IsExistOnBattleArea(card);
                 }
 
                 bool CanSelectCardCondition(CardSource cardSource)
@@ -209,7 +208,83 @@ namespace DCGO.CardEffects.BT23
 
                             Permanent playedDigimon = selectedCard.PermanentOfThisCard();
 
-                            // Implement Can not Digivolve & Delete at end of opponent end phase
+                            #region Can't Digivolve/Delete EoOT
+                            if (playedDigimon != null)
+                            {
+                                #region Can't Digivolve
+                                CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
+                                canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
+                                canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
+                                playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
+
+                                bool CanUseCantEvoCondition(Hashtable hashtable)
+                                {
+                                    return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
+                                }
+
+                                bool PermanentCondition(Permanent permanent)
+                                {
+                                    return permanent == playedDigimon;
+                                }
+
+                                bool CardCondition(CardSource cardSource)
+                                {
+                                    return true;
+                                }
+                                #endregion
+
+                                #region Delete EoOT
+                                ActivateClass activateClass1 = new ActivateClass();
+                                activateClass1.SetUpICardEffect("Delete the Digimon", CanUseEndofOpponentTurnCondition, card);
+                                activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
+                                card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
+
+                                bool CanUseEndofOpponentTurnCondition(Hashtable hashtable)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
+                                    {
+                                        if (CardEffectCommons.IsOpponentTurn(card))
+                                        {
+                                            return true;
+                                        }
+                                    }
+
+                                    return false;
+                                }
+
+                                bool CanActivateCondition1(Hashtable hashtable)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
+                                    {
+                                        if (playedDigimon.CanBeDestroyedBySkill(activateClass1))
+                                        {
+                                            if (!playedDigimon.TopCard.CanNotBeAffected(activateClass1))
+                                            {
+                                                return true;
+                                            }
+                                        }
+                                    }
+
+                                    return false;
+                                }
+
+                                IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
+                                {
+                                    yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { playedDigimon }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
+                                }
+
+                                ICardEffect GetCardEffect(EffectTiming _timing)
+                                {
+                                    if (_timing == EffectTiming.OnEndTurn)
+                                    {
+                                        return activateClass1;
+                                    }
+
+                                    return null;
+                                }
+                                #endregion
+                            }
+                            #endregion
                         }
                     }
                 }

+ 2 - 1
Assets/CardEffect/BT23/Blue/BT23_022.cs

@@ -368,7 +368,8 @@ namespace DCGO.CardEffects.BT23
                     changeValue: 1,
                     isInheritedEffect: false,
                     card: card,
-                    condition: null));
+                    condition: null,
+                    isLinkedEffect: true));
             }
 
             #endregion

+ 162 - 1
Assets/CardEffect/BT23/Green/BT23_037.cs

@@ -1,3 +1,4 @@
+using System.Collections;
 using System.Collections.Generic;
 
 // Tentomon
@@ -66,7 +67,167 @@ namespace DCGO.CardEffects.BT23
 
             #endregion
 
-            //TODO: Same ESS at 017
+            #region ESS - When Attacking
+
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Play 1 5 cost or less [Hudie] digimon from hand", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
+                activateClass.SetIsInheritedEffect(true);
+                activateClass.SetHashString("BT23_017_WA");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[When Attacking] [Once Per Turn] You may play 1 play cost 5 or lower Digimon card with the [Hudie] trait from your hand without paying the cost. The Digimon this effect played can't digivolve and is deleted at the end of your opponent's turn.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
+                        && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleArea(card);
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.IsDigiEgg
+                        && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
+                        && cardSource.EqualsTraits("Hudie")
+                        && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
+                    {
+                        CardSource selectedCard = null;
+                        SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                        selectHandEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectCardCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: 1,
+                            canNoSelect: true,
+                            canEndNotMax: false,
+                            isShowOpponent: true,
+                            selectCardCoroutine: SelectCardCoroutine,
+                            afterSelectCardCoroutine: null,
+                            mode: SelectHandEffect.Mode.Custom,
+                            cardEffect: activateClass);
+
+                        IEnumerator SelectCardCoroutine(CardSource cardSource)
+                        {
+                            selectedCard = cardSource;
+                            yield return null;
+                        }
+
+                        selectHandEffect.SetUpCustomMessage("Select 1 [Hudie] digimon to play", "Your opponent is selecting 1 card to play");
+                        selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
+                        yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+
+                        if (selectedCard != null)
+                        {
+                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
+                                new List<CardSource>() { selectedCard },
+                                activateClass: activateClass,
+                                payCost: false,
+                                isTapped: false,
+                                root: SelectCardEffect.Root.Hand,
+                                activateETB: true));
+
+                            Permanent playedDigimon = selectedCard.PermanentOfThisCard();
+
+                            #region Can't Digivolve/Delete EoOT
+                            if (playedDigimon != null)
+                            {
+                                #region Can't Digivolve
+                                CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
+                                canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
+                                canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
+                                playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
+
+                                bool CanUseCantEvoCondition(Hashtable hashtable)
+                                {
+                                    return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
+                                }
+
+                                bool PermanentCondition(Permanent permanent)
+                                {
+                                    return permanent == playedDigimon;
+                                }
+
+                                bool CardCondition(CardSource cardSource)
+                                {
+                                    return true;
+                                }
+                                #endregion
+
+                                #region Delete EoOT
+                                ActivateClass activateClass1 = new ActivateClass();
+                                activateClass1.SetUpICardEffect("Delete the Digimon", CanUseEndofOpponentTurnCondition, card);
+                                activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
+                                card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
+
+                                bool CanUseEndofOpponentTurnCondition(Hashtable hashtable)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
+                                    {
+                                        if (CardEffectCommons.IsOpponentTurn(card))
+                                        {
+                                            return true;
+                                        }
+                                    }
+
+                                    return false;
+                                }
+
+                                bool CanActivateCondition1(Hashtable hashtable)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
+                                    {
+                                        if (playedDigimon.CanBeDestroyedBySkill(activateClass1))
+                                        {
+                                            if (!playedDigimon.TopCard.CanNotBeAffected(activateClass1))
+                                            {
+                                                return true;
+                                            }
+                                        }
+                                    }
+
+                                    return false;
+                                }
+
+                                IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
+                                {
+                                    yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { playedDigimon }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
+                                }
+
+                                ICardEffect GetCardEffect(EffectTiming _timing)
+                                {
+                                    if (_timing == EffectTiming.OnEndTurn)
+                                    {
+                                        return activateClass1;
+                                    }
+
+                                    return null;
+                                }
+                                #endregion
+                            }
+                            #endregion
+                        }
+                    }
+                }
+            }
+
+            #endregion
 
             return cardEffects;
         }

+ 161 - 1
Assets/CardEffect/BT23/Red/BT23_048.cs

@@ -96,7 +96,167 @@ namespace DCGO.CardEffects.BT23
 
             #endregion
 
-            //TODO: Same ESS at 017
+            #region ESS - When Attacking
+
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Play 1 5 cost or less [Hudie] digimon from hand", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
+                activateClass.SetIsInheritedEffect(true);
+                activateClass.SetHashString("BT23_017_WA");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[When Attacking] [Once Per Turn] You may play 1 play cost 5 or lower Digimon card with the [Hudie] trait from your hand without paying the cost. The Digimon this effect played can't digivolve and is deleted at the end of your opponent's turn.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
+                        && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleArea(card);
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.IsDigiEgg
+                        && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
+                        && cardSource.EqualsTraits("Hudie")
+                        && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
+                    {
+                        CardSource selectedCard = null;
+                        SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                        selectHandEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectCardCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: 1,
+                            canNoSelect: true,
+                            canEndNotMax: false,
+                            isShowOpponent: true,
+                            selectCardCoroutine: SelectCardCoroutine,
+                            afterSelectCardCoroutine: null,
+                            mode: SelectHandEffect.Mode.Custom,
+                            cardEffect: activateClass);
+
+                        IEnumerator SelectCardCoroutine(CardSource cardSource)
+                        {
+                            selectedCard = cardSource;
+                            yield return null;
+                        }
+
+                        selectHandEffect.SetUpCustomMessage("Select 1 [Hudie] digimon to play", "Your opponent is selecting 1 card to play");
+                        selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
+                        yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+
+                        if (selectedCard != null)
+                        {
+                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
+                                new List<CardSource>() { selectedCard },
+                                activateClass: activateClass,
+                                payCost: false,
+                                isTapped: false,
+                                root: SelectCardEffect.Root.Hand,
+                                activateETB: true));
+
+                            Permanent playedDigimon = selectedCard.PermanentOfThisCard();
+
+                            #region Can't Digivolve/Delete EoOT
+                            if (playedDigimon != null)
+                            {
+                                #region Can't Digivolve
+                                CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
+                                canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
+                                canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
+                                playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
+
+                                bool CanUseCantEvoCondition(Hashtable hashtable)
+                                {
+                                    return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
+                                }
+
+                                bool PermanentCondition(Permanent permanent)
+                                {
+                                    return permanent == playedDigimon;
+                                }
+
+                                bool CardCondition(CardSource cardSource)
+                                {
+                                    return true;
+                                }
+                                #endregion
+
+                                #region Delete EoOT
+                                ActivateClass activateClass1 = new ActivateClass();
+                                activateClass1.SetUpICardEffect("Delete the Digimon", CanUseEndofOpponentTurnCondition, card);
+                                activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
+                                card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
+
+                                bool CanUseEndofOpponentTurnCondition(Hashtable hashtable)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
+                                    {
+                                        if (CardEffectCommons.IsOpponentTurn(card))
+                                        {
+                                            return true;
+                                        }
+                                    }
+
+                                    return false;
+                                }
+
+                                bool CanActivateCondition1(Hashtable hashtable)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
+                                    {
+                                        if (playedDigimon.CanBeDestroyedBySkill(activateClass1))
+                                        {
+                                            if (!playedDigimon.TopCard.CanNotBeAffected(activateClass1))
+                                            {
+                                                return true;
+                                            }
+                                        }
+                                    }
+
+                                    return false;
+                                }
+
+                                IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
+                                {
+                                    yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { playedDigimon }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
+                                }
+
+                                ICardEffect GetCardEffect(EffectTiming _timing)
+                                {
+                                    if (_timing == EffectTiming.OnEndTurn)
+                                    {
+                                        return activateClass1;
+                                    }
+
+                                    return null;
+                                }
+                                #endregion
+                            }
+                            #endregion
+                        }
+                    }
+                }
+            }
+
+            #endregion
 
             return cardEffects;
         }

+ 15 - 5
Assets/Scripts/CardEffectFactory/ChangeSAttack.cs

@@ -11,7 +11,8 @@ public partial class CardEffectFactory
         T changeValue,
         bool isInheritedEffect,
         CardSource card,
-        Func<bool> condition)
+        Func<bool> condition,
+        bool isLinkedEffect = false)
     {
         bool CanUseCondition()
         {
@@ -31,7 +32,8 @@ public partial class CardEffectFactory
             changeValue: changeValue,
             isInheritedEffect: isInheritedEffect,
             card: card,
-            condition: CanUseCondition);
+            condition: CanUseCondition,
+            isLinkedEffect: isLinkedEffect);
     }
     #endregion
 
@@ -42,7 +44,8 @@ public partial class CardEffectFactory
         bool isInheritedEffect,
         CardSource card,
         Func<bool> condition,
-        string hashstring = null)
+        string hashstring = null,
+        bool isLinkedEffect = false)
     {
         bool PermanentCondition(Permanent permanent)
         {
@@ -55,7 +58,8 @@ public partial class CardEffectFactory
             isInheritedEffect: isInheritedEffect,
             card: card,
             condition: condition,
-            hashstring: hashstring
+            hashstring: hashstring,
+            isLinkedEffect: isLinkedEffect
         );
     }
 
@@ -65,7 +69,8 @@ public partial class CardEffectFactory
         bool isInheritedEffect,
         CardSource card,
         Func<bool> condition,
-        string hashstring = null)
+        string hashstring = null,
+        bool isLinkedEffect = false)
     {
         bool isInt = typeof(T) == typeof(int);
         bool isIntFunc = typeof(T) == typeof(Func<int>);
@@ -93,6 +98,11 @@ public partial class CardEffectFactory
             changeSAttackClass.SetIsInheritedEffect(true);
         }
 
+        if (isLinkedEffect)
+        {
+            changeSAttackClass.SetIsLinkedEffect(true);
+        }
+
         bool CanUseCondition(Hashtable hashtable)
         {
             if (condition == null || condition())