Просмотр исходного кода

Reverted adding inherited effect default paramteter to Pierce effect

S-E-I-G-E 1 год назад
Родитель
Сommit
03c488b90b

+ 93 - 35
Assets/CardEffect/BT20/Red/BT20_017.cs

@@ -1,9 +1,9 @@
-using System;
+using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 
-namespace DCGO.CardEffects
+namespace DCGO.CardEffects.BT20
 {
     //Regular Jesmon
     public class BT20_017 : CEntity_Effect
@@ -15,74 +15,135 @@ namespace DCGO.CardEffects
             #region OnPlay WhenDigivovling
             if (timing == EffectTiming.OnEnterFieldAnyone)
             {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Play token", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
-                cardEffects.Add(activateClass);
-
-                string EffectDiscription()
+                #region <OnPlay>
                 {
-                    return "Play 1 [Atho, René & Por] Token. (Digimon/White/6000 DP/<Reboot> <Blocker> <Decoy Red/Black>)";
-                }
+                    ActivateClass activateClass = new ActivateClass();
+                    activateClass.SetUpICardEffect("Play a token", CanUseCondition, card);
+                    activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                    cardEffects.Add(activateClass);
 
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return (CardEffectCommons.CanTriggerOnPlay(hashtable, card) || CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card));
-                }
+                    string EffectDiscription()
+                    {
+                        return "[On Play] Play 1 [Atho, René & Por] Token. (Digimon/White/6000 DP/<Reboot>/<Blocker>/<Decoy Red/Black>)";
+                    }
 
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    bool CanUseCondition(Hashtable hashtable)
                     {
-                        if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
+                        return (CardEffectCommons.CanTriggerOnPlay(hashtable, card));
+                    }
+
+                    bool CanActivateCondition(Hashtable hashtable)
+                    {
+                        if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
                         {
-                            return true;
+                            if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
+                            {
+                                return true;
+                            }
                         }
+
+                        return false;
                     }
 
-                    return false;
+                    //#TODO Implement token effect script
+                    IEnumerator ActivateCoroutine(Hashtable hashtable)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayAthoRenePorToken(activateClass));
+                    }
                 }
+                #endregion
 
-//#TODO Implement token effect script
-                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                #region <WhenDigivovling>
                 {
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayAthoRenePorToken(activateClass));
+                    ActivateClass activateClass = new ActivateClass();
+                    activateClass.SetUpICardEffect("Play token", CanUseCondition, card);
+                    activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                    cardEffects.Add(activateClass);
+
+                    string EffectDiscription()
+                    {
+                        return "[When Digivolving] Play 1 [Atho, René & Por] Token. (Digimon/White/6000 DP/<Reboot> <Blocker> <Decoy Red/Black>)";
+                    }
+
+                    bool CanUseCondition(Hashtable hashtable)
+                    {
+                        return (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card));
+                    }
+
+                    bool CanActivateCondition(Hashtable hashtable)
+                    {
+                        if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                        {
+                            if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
+                            {
+                                return true;
+                            }
+                        }
+
+                        return false;
+                    }
+
+                    //#TODO Implement token effect script
+                    IEnumerator ActivateCoroutine(Hashtable hashtable)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayAthoRenePorToken(activateClass));
+                    }
                 }
+                #endregion
             }
             #endregion
 
-            #region AllTurns
+            #region Your Turn
 
             if (timing == EffectTiming.OnEnterFieldAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Play token", CanUseCondition, card);
-                activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
+                activateClass.SetHashString("PlayLevel6_BT20_017");
                 cardEffects.Add(activateClass);
 
                 string EffectDiscription ()
                 {
-                    return "When this Digimon would digivolve or leave the battle area, delete"
+                    return "[Your Turn] [Once Per Turn] When any of your other Digimon are played, delete 1 of your opponent's Digimon with 8000 SP or less. Then, 1 of you Digimon may attack.";
+                }
+
+                bool PermanentCondition (Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
                 }
 
                 bool CanUseCondition (Hashtable hashtable)
                 {
                     if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        if (!CardEffectCommons.IsOpponentTurn(card))
+                        if (CardEffectCommons.IsOwnerTurn(card))
                         {
-                            return true;
+                            if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
+                            {
+                                return true;
+                            }
                         }
                     }
 
                     return false;
                 }
 
+                bool CanActivateCondition (Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        return true;
+                    }
+
+                    return false;
+                }
+
                 bool CanSelectDeletePermanentCondition (Permanent permanent)
                 {
                     if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
                     {
-                        if (permanent.CanBeRemoved() && permanent.DP <= 8000)
+                        if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
                         {
                             return true;
                         }
@@ -97,10 +158,7 @@ namespace DCGO.CardEffects
                     {
                         if (permanent.CanAttack(activateClass))
                         {
-                            if (card.Owner.Enemy.GetBattleAreaDigimons().Count((enemyDigimon) => permanent.CanAttackTargetDigimon(enemyDigimon, activateClass)) >= 1)
-                            {
-                                return true;
-                            }
+                            return true;
                         }
                     }
 
@@ -123,7 +181,7 @@ namespace DCGO.CardEffects
                             canTargetCondition_ByPreSelecetedList: null,
                             canEndSelectCondition: null,
                             maxCount: maxCount,
-                            canNoSelect: true,
+                            canNoSelect: false,
                             canEndNotMax: false,
                             selectPermanentCoroutine: null,
                             afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
@@ -186,7 +244,7 @@ namespace DCGO.CardEffects
 
                                     selectAttackEffect.SetUp(
                                         attacker: selectedPermanent,
-                                        canAttackPlayerCondition: () => false,
+                                        canAttackPlayerCondition: () => true,
                                         defenderCondition: (permanent) => true,
                                         cardEffect: activateClass);
 

+ 223 - 135
Assets/CardEffect/BT20/Red/BT20_019.cs

@@ -2,8 +2,9 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net.Http.Headers;
 
-namespace DCGO.CardEffects
+namespace DCGO.CardEffects.BT20
 {
     public class BT20_019 : CEntity_Effect
     {
@@ -11,35 +12,33 @@ namespace DCGO.CardEffects
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            if (timing == EffectTiming.None)
+            if (timing == EffectTiming.OnEnterFieldAnyone)
             {
+                #region When Digivolving
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Become unaffected by opponents effects, then can attack", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
                 cardEffects.Add(activateClass);
 
                 string EffectDiscription()
                 {
-                    return "[When Digivolving] if [Jesmon]/[X Antibody] is in this Digimon's digivoulution cards, for the turn, 1 of your Digimon isn't affected by you opponent's effects. THne, 1 of your Digimon may attack.";
+                    return "[When Digivolving] if [Jesmon]/[X Antibody] is in this Digimon's digivoulution cards, for the turn, 1 of your Digimon isn't affected by your opponent's effects. THne, 1 of your Digimon may attack.";
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
                     if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
                     {
-                        return CardEffectCommons.IsExistOnBattleArea(card);
+                        return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
                     }
                     return false;
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
                     {
-                        if (CardEffectCommons.IsExistOnBattleArea(card))
-                        {
-                            return true;
-                        }
+                        return true;
                     }
                     return false;
                 }
@@ -59,11 +58,56 @@ namespace DCGO.CardEffects
                             return false;
                         }
 
-                        List<Permanent> selectedPermanents = new List<Permanent>();
                         if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Jesmon") || cardSource.EqualsCardName("X Antibody")) >= 1)
                         {
                             #region select immunity recipient
                             {
+                                IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                                {
+                                    CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
+                                    canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects.", CanUseConditionImmunity, card);
+                                    canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
+                                    card.Owner.UntilEachTurnEndEffects.Add(GetCardEffect);
+
+                                    bool CanUseConditionImmunity(Hashtable hashtable)
+                                    {
+                                        return true;
+                                    }
+
+                                    bool CardCondition(CardSource cardSource)
+                                    {
+                                        if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
+                                        {
+                                            if (card.Owner == cardSource.Owner)
+                                            {
+                                                return true;
+                                            }
+                                        }
+
+                                        return false;
+                                    }
+
+                                    bool SkillCondition (ICardEffect cardEffect)
+                                    {
+                                        if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
+                                        {
+                                            return true;
+                                        }
+
+                                        return false;
+                                    }
+
+                                    ICardEffect GetCardEffect (EffectTiming _timing)
+                                    {
+                                        if (_timing == EffectTiming.None)
+                                        {
+                                            return canNotAffectedClass;
+                                        }
+                                        return null;
+                                    }
+
+                                    yield return null;
+                                }
 
                                 int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectCondition));
 
@@ -77,41 +121,19 @@ namespace DCGO.CardEffects
                                     maxCount: maxCount,
                                     canNoSelect: true,
                                     canEndNotMax: false,
-                                    selectPermanentCoroutine: null,
-                                    afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
+                                    selectPermanentCoroutine: SelectPermanentCoroutine,
+                                    afterSelectPermanentCoroutine: null,
                                     mode: SelectPermanentEffect.Mode.Custom,
                                     cardEffect: activateClass);
 
                                 selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that be immune from your opponent's effects.", "Opponent is selecting on Digimon that will be immune from your effects.");
                                 yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                                IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
-                                {
-                                    selectedPermanents = permanents;
-                                    yield return null;
-                                }
-
-                                foreach (Permanent permanent in selectedPermanents)
-                                {
-                                    Permanent selectedPermanent = permanent;
-
-                                    if (selectedPermanent != null)
-                                    {
-                                        if (selectedPermanent.CanAttack(activateClass))
-                                        {
-                                            SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
-
-                                            selectAttackEffect.SetUp(
-                                                attacker: selectedPermanent,
-                                                canAttackPlayerCondition: () => false,
-                                                defenderCondition: (permanent) => true,
-                                                cardEffect: activateClass);
-
-                                            yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
-                                        }
-                                    }
-                                }
+                                
                             }
+                            #endregion
+                        }
+
+                        {
                             #region Select attacker
                             {
                                 bool CanSelectAttackPermanentCondition(Permanent permanent)
@@ -128,6 +150,20 @@ namespace DCGO.CardEffects
                                     }
                                     return false;
                                 }
+
+                                IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                                {
+                                    SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
+
+                                    selectAttackEffect.SetUp(
+                                        attacker: permanent,
+                                        canAttackPlayerCondition: () => true,
+                                        defenderCondition: (permanent) => true,
+                                        cardEffect: activateClass);
+
+                                    yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
+                                }
+
                                 int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectAttackPermanentCondition));
 
                                 SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
@@ -140,44 +176,15 @@ namespace DCGO.CardEffects
                                     maxCount: maxCount,
                                     canNoSelect: true,
                                     canEndNotMax: false,
-                                    selectPermanentCoroutine: null,
-                                    afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
+                                    selectPermanentCoroutine: SelectPermanentCoroutine,
+                                    afterSelectPermanentCoroutine: null,
                                     mode: SelectPermanentEffect.Mode.Custom,
                                     cardEffect: activateClass);
 
                                 selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that be immune from your opponent's effects.", "Opponent is selecting on Digimon that will be immune from your effects.");
                                 yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                                IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
-                                {
-                                    selectedPermanents = permanents;
-                                    yield return null;
-                                }
-
-                                foreach (Permanent permanent in selectedPermanents)
-                                {
-                                    Permanent selectedPermanent = permanent;
-
-                                    if (selectedPermanent != null)
-                                    {
-                                        if (selectedPermanent.CanAttack(activateClass))
-                                        {
-                                            SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
-
-                                            selectAttackEffect.SetUp(
-                                                attacker: selectedPermanent,
-                                                canAttackPlayerCondition: () => false,
-                                                defenderCondition: (permanent) => true,
-                                                cardEffect: activateClass);
-
-                                            yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
-                                        }
-                                    }
-                                }
-
                             }
                             #endregion
-
                         }
 
                         CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
@@ -219,98 +226,179 @@ namespace DCGO.CardEffects
                         }
                     }
                 }
+                #endregion
             }
 
-            #region Alliance
 
-            #endregion
-
-            #region When Digivolving
-            if (timing == EffectTiming.OnEnterFieldAnyone)
+            if (timing == EffectTiming.None)
             {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
-                cardEffects.Add(activateClass);
-
-                string EffectDiscription()
-                {
-                    return "";
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
+                #region Your Turn
                 {
-                    return true;
-                }
+                    ActivateClass activateClass = new ActivateClass();
+                    activateClass.SetUpICardEffect("Select digimon to gain piercing and can attack unsuspended digimon", CanUseCondition, card);
+                    activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
+                    cardEffects.Add(activateClass);
 
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return true;
-                }
+                    String EffectDiscription ()
+                    {
+                        return "[Your Turn] All of your Digimon with [Sistermon] in their names or the [Royal Knight] trait gain <Piercing> and can also attack your opponent's unsuspended Digimon."
+                    }
 
-                IEnumerator ActivateCoroutine(Hashtable hashtable)
-                {
-                    yield return null;
-                }
-            }
-            #endregion
+                    bool CanUseCondition(Hashtable hashtable)
+                    {
+                        if (CardEffectCommons.IsExistOnBattleArea(card))
+                        {
+                            if (CardEffectCommons.IsOpponentTurn(card))
+                            {
+                                return true;
+                            }
+                        }
 
-            #region Your Turn
-            if (timing == EffectTiming.OnStartTurn)
-            {
+                        return false;
+                    }
 
-                CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass();
-                canAttackTargetDefendingPermanentClass.SetUpICardEffect("Gain Piercing and can attack unsuspended Digimon", CanUseCondition, card);
-                canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass(attackerCondition: PermanentCondition, defenderCondition: DefenderCondition, cardEffectCondition: CardEffectCondition);
-                card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => canAttackTargetDefendingPermanentClass);
+                    bool PermanentCondition(Permanent permanent)
+                    {
+                        if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                        {
+                            if (permanent.DigivolutionCards.Count((card) => card.ContainsCardName("Sistermon") || card.HasRoyalKnightTraits) >= 1)
+                            {
+                                return true;
+                            }
+                        }
 
-                string EffectDiscription ()
-                {
-                    return "All of you DIgimon with [Sistermon] in their names or the [Royal Knight] trait gain <Piercing> and can also attack unsuspended Digimon.";
-                }
+                        return false;
+                    }
 
-                bool CanUseCondition (Hashtable hashtable)
-                {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    IEnumerator ActivateCoroutine (Hashtable hashtable)
                     {
-                        if (CardEffectCommons.IsOwnerTurn (card))
-                        {  
+
+                        List<Permanent> permanents = card.Owner.GetBattleAreaDigimons();
+
+                        if (permanents.Count >= 1)
+                        {
+                            foreach (Permanent permanent in permanents)
+                            {
+                                yield return CardEffectCommons.GainPierce(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass, true);
+                            }
+                        }
+
+                        CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass();
+                        canAttackTargetDefendingPermanentClass.SetUpICardEffect($"Can attack to unsuspended Digimon", CanUseCondition1, card);
+                        canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass(attackerCondition: PermanentCondition, defenderCondition: DefenderCondition, cardEffectCondition: CardEffectCondition);
+                        card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => canAttackTargetDefendingPermanentClass);
+
+                        bool CanUseCondition1(Hashtable hashtable)
+                        {
+                            return true;
+                        }
+
+                        bool DefenderCondition(Permanent permanent)
+                        {
+                            if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                            {
+                                if (!permanent.IsSuspended)
+                                {
+                                    return true;
+                                }
+                            }
+
+                            return false;
+                        }
+
+                        bool CardEffectCondition(ICardEffect cardEffect)
+                        {
                             return true;
                         }
                     }
 
-                    return false;
+                    
                 }
+                #endregion
 
-                bool PermanentCondition (Permanent permanent)
+                #region Inherit
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                    ActivateClass activateClass = new ActivateClass();
+                    activateClass.SetUpICardEffect("Select digimon to gain piercing and can attack unsuspended digimon", CanUseCondition, card);
+                    activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
+                    cardEffects.Add(activateClass);
+
+                    String EffectDiscription()
                     {
-                        return (permanent.TopCard.ContainsCardName("Sistermon") || permanent.TopCard.HasRoyalKnightTraits);
+                        return "[Your Turn] While this Digimon is [Jesmon GX], all of your Digimon gain <Piercing> and can also attack your opponent's unsuspended Digimon.";
                     }
-                    return false;
-                }
-            
-                bool DefenderCondition (Permanent permanent)
-                {
-                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+
+                    bool CanUseCondition(Hashtable hashtable)
+                    {
+                        if (CardEffectCommons.IsExistOnBattleArea(card))
+                        {
+                            if (CardEffectCommons.IsOpponentTurn(card))
+                            {
+                                return true;
+                            }
+                        }
+
+                        return false;
+                    }
+
+                    bool PermanentCondition(Permanent permanent)
+                    {
+                        if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                        {
+                            if (permanent.TopCard.CardNames.Contains("Jesmon GX"))
+                            {
+                                return true;
+                            }
+                        }
+
+                        return false;
+                    }
+
+                    IEnumerator ActivateCoroutine(Hashtable hashtable)
                     {
-                        if (!permanent.IsSuspended)
+
+                        List<Permanent> permanents = card.Owner.GetBattleAreaDigimons();
+
+                        if (permanents.Count >= 1)
+                        {
+                            foreach (Permanent permanent in permanents)
+                            {
+                                yield return CardEffectCommons.GainPierce(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass, true);
+                            }
+                        }
+
+                        CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass();
+                        canAttackTargetDefendingPermanentClass.SetUpICardEffect($"Can attack to unsuspended Digimon", CanUseCondition1, card);
+                        canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass(attackerCondition: PermanentCondition, defenderCondition: DefenderCondition, cardEffectCondition: CardEffectCondition);
+                        card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => canAttackTargetDefendingPermanentClass);
+
+                        bool CanUseCondition1(Hashtable hashtable)
+                        {
+                            return true;
+                        }
+
+                        bool DefenderCondition(Permanent permanent)
+                        {
+                            if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                            {
+                                if (!permanent.IsSuspended)
+                                {
+                                    return true;
+                                }
+                            }
+
+                            return false;
+                        }
+
+                        bool CardEffectCondition(ICardEffect cardEffect)
                         {
                             return true;
                         }
                     }
-                    return false;
-                }
-            
-                bool CardEffectCondition (ICardEffect cardEffect)
-                {
-                    return true;
                 }
-
+                #endregion
+                
             }
-            #endregion
-
 
             return cardEffects;
         }

+ 666 - 10
Assets/CardEffect/BT20/Red/BT20_021.cs

@@ -1,5 +1,7 @@
+using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace DCGO.CardEffects
 {
@@ -23,21 +25,21 @@ namespace DCGO.CardEffects
                     return true;
                 }
 
-                JogressCondition GetJogress (CardSource cardSource)
+                JogressCondition GetJogress(CardSource cardSource)
                 {
                     if (cardSource == card)
                     {
-                        bool PermanentCondition1 (Permanent permanent)
+                        bool PermanentCondition1(Permanent permanent)
                         {
                             return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
                                 && permanent.TopCard.ContainsCardName("Jesmon")
                                 && permanent.Levels_ForJogress(card).Contains(6);
                         }
 
-                        bool PermanentCondition2 (Permanent permanent)
+                        bool PermanentCondition2(Permanent permanent)
                         {
                             return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
-                                && permanent.TopCard.ContainsCardName("Gankoomon");
+                                && permanent.TopCard.ContainsCardName("Gankoomon")
                                 && permanent.Levels_ForJogress(card).Contains(6);
                         }
 
@@ -53,7 +55,7 @@ namespace DCGO.CardEffects
 
                     return null;
                 }
-      
+
             }
             #endregion
 
@@ -64,23 +66,677 @@ namespace DCGO.CardEffects
             }
             #endregion
 
-            #region OnPlay - WhenDigivolve - When Attacking
-            if (timing == EffectTiming.OnEnterFieldAnyone || timing == EffectTiming.OnAllyAttack)
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
             {
+                #region OnPlay
                 ActivateClass activate_class = new ActivateClass();
-                activate_class.SetUpICardEffect ("Select 1 card, delete 1 card", CanUseCondition, card);
+                activate_class.SetUpICardEffect("Select 1 card, delete 1 card", CanUseCondition, card);
+                activate_class.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
+                cardEffects.Add(activate_class);
+
+                string EffectDescription()
+                {
+                    return "[OnPlay] [Once Per Turn] Place 1 [Royal Knight] trait card from your hand or trash as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with as much or less DP as this digimon.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return (CardEffectCommons.CanTriggerOnPlay(hashtable, card));
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    if (cardSource.HasRoyalKnightTraits)
+                    {
+                        return true;
+                    }
+
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
+                        bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+
+                        if (canSelectHand || canSelectTrash)
+                        {
+                            if (canSelectHand && canSelectHand)
+                            {
+                                List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
+                                {
+                                    new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
+                                    new SelectionElement<bool>(message: $"From trash", value: false, spriteIndex: 1),
+                                };
+
+                                string selectPlayerMessage = "From which area do you select a card?";
+                                string notSelectPlayerMessage = "The opponent is choosing from which are to select a card.";
+
+                                GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
+
+                            }
+                            else
+                            {
+                                GManager.instance.userSelectionManager.SetBool(canSelectHand);
+                            }
+
+                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+
+                            bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
+
+                            List<CardSource> selectedCards = new List<CardSource>();
+
+                            IEnumerator SelectCardCoroutine(CardSource card)
+                            {
+                                selectedCards.Add(card);
+
+                                yield return null;
+                            }
+
+                            if (fromHand)
+                            {
+                                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: activate_class);
+
+                                selectHandEffect.SetUpCustomMessage(
+                                    "Select 1 card to place on bottom of digivolution cards.",
+                                    "The opponent is selecting 1 card to place on bottom of digivolution cards.");
+                                selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
+
+                                yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+                            }
+                            else
+                            {
+                                int maxCount = 1;
+
+                                SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                                selectCardEffect.SetUp(
+                                    canTargetCondition: CanSelectCardCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    canNoSelect: () => true,
+                                    selectCardCoroutine: SelectCardCoroutine,
+                                    afterSelectCardCoroutine: null,
+                                    message: "Select 1 card to place on bottom of digivolution cards.",
+                                    maxCount: maxCount,
+                                    canEndNotMax: false,
+                                    isShowOpponent: true,
+                                    mode: SelectCardEffect.Mode.Custom,
+                                    root: SelectCardEffect.Root.Trash,
+                                    customRootCardList: null,
+                                    canLookReverseCard: true,
+                                    selectPlayer: card.Owner,
+                                    cardEffect: activate_class);
+
+                                selectCardEffect.SetUpCustomMessage(
+                                    "Select 1 card to place on bottom of digivolution cards.",
+                                    "The opponent is selecting 1 card to place on bottom of digivolution cards.");
+                                selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
+
+                                yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                            }
+
+                            CardSource selectedCard = null;
+
+                            if (selectedCards.Count >= 1)
+                            {
+                                if (CardEffectCommons.IsExistOnBattleArea(card))
+                                {
+                                    yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
+                                        selectedCards,
+                                        activate_class));
+
+                                    selectedCard = selectedCards[0];
+                                }
+                            }
+
+                            if (selectedCard != null)
+                            {
+                                List<Permanent> deleteTargets = new List<Permanent>();
+
+                                bool CanSelectForDeletion(Permanent permanent)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                                    {
+                                        if (permanent.DP <= card.PermanentOfThisCard().DP)
+                                        {
+                                            return true;
+                                        }
+                                    }
+                                    return false;
+                                }
+
+                                IEnumerator AfterSelectionCoroutine(List<Permanent> permanents)
+                                {
+                                    deleteTargets = permanents.Clone();
+
+                                    yield return null;
+                                }
+
+                                if (CardEffectCommons.HasMatchConditionPermanent(CanSelectForDeletion))
+                                {
+                                    int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectForDeletion));
+
+                                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                                    selectPermanentEffect.SetUp(
+                                        selectPlayer: card.Owner,
+                                        canTargetCondition: CanSelectForDeletion,
+                                        canTargetCondition_ByPreSelecetedList: null,
+                                        canEndSelectCondition: null,
+                                        maxCount: maxCount,
+                                        canNoSelect: false,
+                                        canEndNotMax: false,
+                                        selectPermanentCoroutine: null,
+                                        afterSelectPermanentCoroutine: AfterSelectionCoroutine,
+                                        mode: SelectPermanentEffect.Mode.Custom,
+                                        cardEffect: activate_class);
+
+                                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
+
+                                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                                }
+
+                                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargets, activateClass: activate_class, successProcess: null, failureProcess: null));
+
+                            }
+                        }
+                    }
+                }
+
+                #endregion
+            }
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                #region When Digivolving
+                ActivateClass activate_class = new ActivateClass();
+                activate_class.SetUpICardEffect("Select 1 card, delete 1 card", CanUseCondition, card);
+                activate_class.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
+                cardEffects.Add(activate_class);
+
+                string EffectDescription()
+                {
+                    return "[When Digivolving] [Once Per Turn] Place 1 [Royal Knight] trait card from your hand or trash as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with as much or less DP as this digimon.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card));
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    if (cardSource.HasRoyalKnightTraits)
+                    {
+                        return true;
+                    }
+
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
+                        bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+
+                        if (canSelectHand || canSelectTrash)
+                        {
+                            if (canSelectHand && canSelectHand)
+                            {
+                                List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
+                                {
+                                    new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
+                                    new SelectionElement<bool>(message: $"From trash", value: false, spriteIndex: 1),
+                                };
+
+                                string selectPlayerMessage = "From which area do you select a card?";
+                                string notSelectPlayerMessage = "The opponent is choosing from which are to select a card.";
+
+                                GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
+
+                            }
+                            else
+                            {
+                                GManager.instance.userSelectionManager.SetBool(canSelectHand);
+                            }
+
+                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+
+                            bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
+
+                            List<CardSource> selectedCards = new List<CardSource>();
+
+                            IEnumerator SelectCardCoroutine(CardSource card)
+                            {
+                                selectedCards.Add(card);
+
+                                yield return null;
+                            }
+
+                            if (fromHand)
+                            {
+                                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: activate_class);
+
+                                selectHandEffect.SetUpCustomMessage(
+                                    "Select 1 card to place on bottom of digivolution cards.",
+                                    "The opponent is selecting 1 card to place on bottom of digivolution cards.");
+                                selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
+
+                                yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+                            }
+                            else
+                            {
+                                int maxCount = 1;
+
+                                SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                                selectCardEffect.SetUp(
+                                    canTargetCondition: CanSelectCardCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    canNoSelect: () => true,
+                                    selectCardCoroutine: SelectCardCoroutine,
+                                    afterSelectCardCoroutine: null,
+                                    message: "Select 1 card to place on bottom of digivolution cards.",
+                                    maxCount: maxCount,
+                                    canEndNotMax: false,
+                                    isShowOpponent: true,
+                                    mode: SelectCardEffect.Mode.Custom,
+                                    root: SelectCardEffect.Root.Trash,
+                                    customRootCardList: null,
+                                    canLookReverseCard: true,
+                                    selectPlayer: card.Owner,
+                                    cardEffect: activate_class);
+
+                                selectCardEffect.SetUpCustomMessage(
+                                    "Select 1 card to place on bottom of digivolution cards.",
+                                    "The opponent is selecting 1 card to place on bottom of digivolution cards.");
+                                selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
+
+                                yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                            }
+
+                            CardSource selectedCard = null;
+
+                            if (selectedCards.Count >= 1)
+                            {
+                                if (CardEffectCommons.IsExistOnBattleArea(card))
+                                {
+                                    yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
+                                        selectedCards,
+                                        activate_class));
+
+                                    selectedCard = selectedCards[0];
+                                }
+                            }
+
+                            if (selectedCard != null)
+                            {
+                                List<Permanent> deleteTargets = new List<Permanent>();
+
+                                bool CanSelectForDeletion(Permanent permanent)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                                    {
+                                        if (permanent.DP <= card.PermanentOfThisCard().DP)
+                                        {
+                                            return true;
+                                        }
+                                    }
+                                    return false;
+                                }
+
+                                IEnumerator AfterSelectionCoroutine(List<Permanent> permanents)
+                                {
+                                    deleteTargets = permanents.Clone();
+
+                                    yield return null;
+                                }
+
+                                if (CardEffectCommons.HasMatchConditionPermanent(CanSelectForDeletion))
+                                {
+                                    int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectForDeletion));
+
+                                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                                    selectPermanentEffect.SetUp(
+                                        selectPlayer: card.Owner,
+                                        canTargetCondition: CanSelectForDeletion,
+                                        canTargetCondition_ByPreSelecetedList: null,
+                                        canEndSelectCondition: null,
+                                        maxCount: maxCount,
+                                        canNoSelect: false,
+                                        canEndNotMax: false,
+                                        selectPermanentCoroutine: null,
+                                        afterSelectPermanentCoroutine: AfterSelectionCoroutine,
+                                        mode: SelectPermanentEffect.Mode.Custom,
+                                        cardEffect: activate_class);
+
+                                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
+
+                                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                                }
+
+                                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargets, activateClass: activate_class, successProcess: null, failureProcess: null));
+
+                            }
+                        }
+                    }
+                }
+
+                #endregion
+            }
+
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                #region When attacking 1
+                ActivateClass activate_class = new ActivateClass();
+                activate_class.SetUpICardEffect("Select 1 card, delete 1 card", CanUseCondition, card);
+                activate_class.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
+                cardEffects.Add(activate_class);
+
+                string EffectDescription()
+                {
+                    return "[When Attacking] [Once Per Turn] Place 1 [Royal Knight] trait card from your hand or trash as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with as much or less DP as this digimon.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return (CardEffectCommons.CanTriggerOnAttack(hashtable, card));
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    if (cardSource.HasRoyalKnightTraits)
+                    {
+                        return true;
+                    }
+
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
+                        bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+
+                        if (canSelectHand || canSelectTrash)
+                        {
+                            if (canSelectHand && canSelectHand)
+                            {
+                                List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
+                                {
+                                    new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
+                                    new SelectionElement<bool>(message: $"From trash", value: false, spriteIndex: 1),
+                                };
+
+                                string selectPlayerMessage = "From which area do you select a card?";
+                                string notSelectPlayerMessage = "The opponent is choosing from which are to select a card.";
+
+                                GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
+
+                            }
+                            else
+                            {
+                                GManager.instance.userSelectionManager.SetBool(canSelectHand);
+                            }
+
+                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+
+                            bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
+
+                            List<CardSource> selectedCards = new List<CardSource>();
+
+                            IEnumerator SelectCardCoroutine(CardSource card)
+                            {
+                                selectedCards.Add(card);
+
+                                yield return null;
+                            }
+
+                            if (fromHand)
+                            {
+                                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: activate_class);
+
+                                selectHandEffect.SetUpCustomMessage(
+                                    "Select 1 card to place on bottom of digivolution cards.",
+                                    "The opponent is selecting 1 card to place on bottom of digivolution cards.");
+                                selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
+
+                                yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+                            }
+                            else
+                            {
+                                int maxCount = 1;
+
+                                SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                                selectCardEffect.SetUp(
+                                    canTargetCondition: CanSelectCardCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    canNoSelect: () => true,
+                                    selectCardCoroutine: SelectCardCoroutine,
+                                    afterSelectCardCoroutine: null,
+                                    message: "Select 1 card to place on bottom of digivolution cards.",
+                                    maxCount: maxCount,
+                                    canEndNotMax: false,
+                                    isShowOpponent: true,
+                                    mode: SelectCardEffect.Mode.Custom,
+                                    root: SelectCardEffect.Root.Trash,
+                                    customRootCardList: null,
+                                    canLookReverseCard: true,
+                                    selectPlayer: card.Owner,
+                                    cardEffect: activate_class);
+
+                                selectCardEffect.SetUpCustomMessage(
+                                    "Select 1 card to place on bottom of digivolution cards.",
+                                    "The opponent is selecting 1 card to place on bottom of digivolution cards.");
+                                selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
+
+                                yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                            }
+
+                            CardSource selectedCard = null;
+
+                            if (selectedCards.Count >= 1)
+                            {
+                                if (CardEffectCommons.IsExistOnBattleArea(card))
+                                {
+                                    yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
+                                        selectedCards,
+                                        activate_class));
+
+                                    selectedCard = selectedCards[0];
+                                }
+                            }
+
+                            if (selectedCard != null)
+                            {
+                                List<Permanent> deleteTargets = new List<Permanent>();
+
+                                bool CanSelectForDeletion(Permanent permanent)
+                                {
+                                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                                    {
+                                        if (permanent.DP <= card.PermanentOfThisCard().DP)
+                                        {
+                                            return true;
+                                        }
+                                    }
+                                    return false;
+                                }
+
+                                IEnumerator AfterSelectionCoroutine(List<Permanent> permanents)
+                                {
+                                    deleteTargets = permanents.Clone();
+
+                                    yield return null;
+                                }
+
+                                if (CardEffectCommons.HasMatchConditionPermanent(CanSelectForDeletion))
+                                {
+                                    int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectForDeletion));
+
+                                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                                    selectPermanentEffect.SetUp(
+                                        selectPlayer: card.Owner,
+                                        canTargetCondition: CanSelectForDeletion,
+                                        canTargetCondition_ByPreSelecetedList: null,
+                                        canEndSelectCondition: null,
+                                        maxCount: maxCount,
+                                        canNoSelect: false,
+                                        canEndNotMax: false,
+                                        selectPermanentCoroutine: null,
+                                        afterSelectPermanentCoroutine: AfterSelectionCoroutine,
+                                        mode: SelectPermanentEffect.Mode.Custom,
+                                        cardEffect: activate_class);
+
+                                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
+
+                                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                                }
+
+                                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargets, activateClass: activate_class, successProcess: null, failureProcess: null));
+
+                            }
+                        }
+                    }
+                }
+
+                #endregion
+            }
+
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                ActivateClass activate_class = new ActivateClass();
+                activate_class.SetUpICardEffect("Select 1 card, delete 1 card", CanUseCondition, card);
                 activate_class.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
                 cardEffects.Add(activate_class);
 
                 string EffectDescription()
                 {
-                    return "[OnPlay] [When Digivolving] [When Attacking] [Once Per Turn] Place 1 [Royal Knight] trait card from your hand or trash as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with as much or less DP as this digimon.";
+                    return "[When Attacking] [Once per Turn] This Digimon unsuspends. Then, for every 2 [Royal Knigght] trait cards in this Digimon'd digivolution cards, trash your opponent's top security card";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return (CardEffectCommons.CanTriggerOnAttack(hashtable, card));
                 }
 
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
 
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    Permanent selectedPermanent = card.PermanentOfThisCard();
+
+                    yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activate_class).Unsuspend());
+
+                    int num_security_deletes = selectedPermanent.DigivolutionCards.Count((card)=>(card.HasRoyalKnightTraits)) % 2;
+
+                    if (num_security_deletes > 0)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                            player: card.Owner.Enemy,
+                            destroySecurityCount: 1,
+                            cardEffect: activate_class,
+                            fromTop: true).DestroySecurity());
+                    }
+                }
             }
 
-            return cardEffects;
+                return cardEffects;
         }
     }
 }