Преглед изворни кода

Add level 2 and 4 cardEffects

Andrej Erdelsky пре 1 година
родитељ
комит
dc15f60d1e

+ 425 - 7
Assets/CardEffect/BT18/Purple/Duskmon_BT18_078.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace DCGO.CardEffects.BT18
 {
@@ -9,34 +10,451 @@ namespace DCGO.CardEffects.BT18
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Alternate Digivolution
+
+            // Any purple
             if (timing == EffectTiming.None)
+            {
+                bool Condition()
+                {
+                    return card.Owner.HandCards.Contains(card);
+                }
+
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.IsTamer && targetPermanent.TopCard.CardColors.Contains(CardColor.Purple);
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
+                    card: card, condition: Condition));
+            }
+
+            // Koichi Kimura
+            if (timing == EffectTiming.None)
+            {
+                bool Condition()
+                {
+                    return card.Owner.HandCards.Contains(card);
+                }
+
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.EqualsCardName("Koichi Kimura");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
+                    card: card, condition: Condition));
+            }
+
+            // Velgrmon
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.EqualsCardName("Velgrmon");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false,
+                    card: card, condition: null));
+            }
+
+            #endregion
+
+            #region On Play/ When Digivolving Shared
+
+            bool CanSelectPermanentConditionShared(Permanent permanent)
+            {
+                return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
+                       (permanent.IsDigimon || permanent.IsTamer);
+            }
+
+            bool CanActivateConditionShared(Hashtable hashtable)
+            {
+                return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                       CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared);
+            }
+
+            #endregion
+
+            #region On Play
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Change the color of 1 of your opponent's Digimon or Tamer", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[On Play] Until the end of your opponent's turn, change 1 of their Digimon or Tamers into a color other than white.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    Permanent selectedPermanent = null;
+
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                    selectPermanentEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: CanSelectPermanentConditionShared,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: 1,
+                        canNoSelect: false,
+                        canEndNotMax: false,
+                        selectPermanentCoroutine: SelectPermanentCoroutine,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectPermanentEffect.SetUpCustomMessage(
+                        "Select 1 Digimon that will change color.",
+                        "The opponent is selecting 1 Digimon that will change color.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                    {
+                        selectedPermanent = permanent;
+
+                        yield return null;
+                    }
+
+                    if (selectedPermanent != null)
+                    {
+                        List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
+                        {
+                            new(message: $"Red", value: (int)CardColor.Red, spriteIndex: 0),
+                            new(message: $"Blue", value: (int)CardColor.Blue, spriteIndex: 0),
+                            new(message: $"Yellow", value: (int)CardColor.Yellow, spriteIndex: 0),
+                            new(message: $"Green", value: (int)CardColor.Green, spriteIndex: 0),
+                            new(message: $"Black", value: (int)CardColor.Black, spriteIndex: 0),
+                            new(message: $"Purple", value: (int)CardColor.Purple, spriteIndex: 0),
+                        };
+
+                        string selectPlayerMessage = "Select a color.";
+                        string notSelectPlayerMessage = "The opponent is selecting a color.";
+
+                        GManager.instance.userSelectionManager.SetIntSelection(
+                            selectionElements: selectionElements,
+                            selectPlayer: card.Owner,
+                            selectPlayerMessage: selectPlayerMessage,
+                            notSelectPlayerMessage: notSelectPlayerMessage);
+
+                        yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
+                            .WaitForEndSelect());
+
+                        CardColor chosenColor = (CardColor)GManager.instance.userSelectionManager.SelectedIntValue;
+
+                        ChangeBaseCardColorClass changeBaseCardNameClass = new ChangeBaseCardColorClass();
+                        changeBaseCardNameClass.SetUpICardEffect("Original card color is changed", CanUseChangeColorCondition, card);
+                        changeBaseCardNameClass.SetUpChangeBaseCardColorClass(ChangeBaseCardColors: ChangeBaseCardColors);
+                        selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => changeBaseCardNameClass);
+
+                        bool CanUseChangeColorCondition(Hashtable hashtableColor)
+                        {
+                            return selectedPermanent.TopCard != null && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
+                        }
+
+                        List<CardColor> ChangeBaseCardColors(CardSource cardSource, List<CardColor> cardColors)
+                        {
+                            if (cardSource == selectedPermanent.TopCard)
+                            {
+                                cardColors = new List<CardColor>() { chosenColor };
+                            }
+
+                            return cardColors;
+                        }
+                    }
+                }
+            }
+
+            #endregion
+            
+            #region When Digivolving
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Change the color of 1 of your opponent's Digimon or Tamer", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[When Digivolving] Until the end of your opponent's turn, change 1 of their Digimon or Tamers into a color other than white.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    Permanent selectedPermanent = null;
+
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                    selectPermanentEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: CanSelectPermanentConditionShared,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: 1,
+                        canNoSelect: false,
+                        canEndNotMax: false,
+                        selectPermanentCoroutine: SelectPermanentCoroutine,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectPermanentEffect.SetUpCustomMessage(
+                        "Select 1 Digimon that will change color.",
+                        "The opponent is selecting 1 Digimon that will change color.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                    {
+                        selectedPermanent = permanent;
+
+                        yield return null;
+                    }
+
+                    if (selectedPermanent != null)
+                    {
+                        List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
+                        {
+                            new(message: $"Red", value: (int)CardColor.Red, spriteIndex: 0),
+                            new(message: $"Blue", value: (int)CardColor.Blue, spriteIndex: 0),
+                            new(message: $"Yellow", value: (int)CardColor.Yellow, spriteIndex: 0),
+                            new(message: $"Green", value: (int)CardColor.Green, spriteIndex: 0),
+                            new(message: $"Black", value: (int)CardColor.Black, spriteIndex: 0),
+                            new(message: $"Purple", value: (int)CardColor.Purple, spriteIndex: 0),
+                        };
+
+                        string selectPlayerMessage = "Select a color.";
+                        string notSelectPlayerMessage = "The opponent is selecting a color.";
+
+                        GManager.instance.userSelectionManager.SetIntSelection(
+                            selectionElements: selectionElements,
+                            selectPlayer: card.Owner,
+                            selectPlayerMessage: selectPlayerMessage,
+                            notSelectPlayerMessage: notSelectPlayerMessage);
+
+                        yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
+                            .WaitForEndSelect());
+
+                        CardColor chosenColor = (CardColor)GManager.instance.userSelectionManager.SelectedIntValue;
+
+                        ChangeBaseCardColorClass changeBaseCardNameClass = new ChangeBaseCardColorClass();
+                        changeBaseCardNameClass.SetUpICardEffect("Original card color is changed", CanUseChangeColorCondition, card);
+                        changeBaseCardNameClass.SetUpChangeBaseCardColorClass(ChangeBaseCardColors: ChangeBaseCardColors);
+                        selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => changeBaseCardNameClass);
+
+                        bool CanUseChangeColorCondition(Hashtable hashtableColor)
+                        {
+                            return selectedPermanent.TopCard != null && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
+                        }
+
+                        List<CardColor> ChangeBaseCardColors(CardSource cardSource, List<CardColor> cardColors)
+                        {
+                            if (cardSource == selectedPermanent.TopCard)
+                            {
+                                cardColors = new List<CardColor>() { chosenColor };
+                            }
+
+                            return cardColors;
+                        }
+                    }
+                }
+            }
+
+            #endregion
+
+            #region When Attacking
+
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("1 of your Digimon or Tamers digivolves", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
+                    EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[When Attacking] 1 of your Digimon or Tamers may digivolve into a level 4 card with the [Hybrid] trait in the trash with the digivolution cost reduced by 1.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
+                }
+
+                bool DigivolveFromPermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
+                           (permanent.IsDigimon || permanent.IsTamer) &&
+                           card.Owner.TrashCards.Where(DigivolveToCardCondition).Any(cardSource =>
+                               cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
+                }
+
+                bool DigivolveToCardCondition(CardSource cardSource)
+                {
+                    return cardSource.IsDigimon && cardSource.ContainsTraits("Hybrid") &&
+                           cardSource.HasLevel && cardSource.Level == 4;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.HasMatchConditionPermanent(DigivolveFromPermanentCondition);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    Permanent selectedPermanent = null;
+
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                    selectPermanentEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: DigivolveFromPermanentCondition,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: 1,
+                        canNoSelect: true,
+                        canEndNotMax: false,
+                        selectPermanentCoroutine: SelectPermanentCoroutine,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.",
+                        "The opponent is selecting 1 Digimon that will digivolve.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                    {
+                        selectedPermanent = permanent;
+
+                        yield return null;
+                    }
+
+                    if (selectedPermanent != null)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
+                            targetPermanent: selectedPermanent,
+                            cardCondition: DigivolveToCardCondition,
+                            payCost: true,
+                            reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
+                            fixedCostTuple: null,
+                            ignoreDigivolutionRequirementFixedCost: -1,
+                            isHand: false,
+                            activateClass: activateClass,
+                            successProcess: null));
+                    }
+                }
+            }
+
+            #endregion
+
+            #region On Deletion - ESS
+
+            if (timing == EffectTiming.OnDestroyedAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpICardEffect("Play Tamer card from trash", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                activateClass.SetIsInheritedEffect(true);
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
-                    return "";
+                    return "[On Deletion] You may play 1 Tamer card with a play cost of 4 or less from your trash without paying the cost.";
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.IsTamer && cardSource.HasPlayCost && cardSource.GetCostItself <= 4 &&
+                           CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card) &&
+                           CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    yield return null;
+                    List<CardSource> selectedCards = new List<CardSource>();
+
+                    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 play.",
+                        maxCount: 1,
+                        canEndNotMax: false,
+                        isShowOpponent: true,
+                        mode: SelectCardEffect.Mode.Custom,
+                        root: SelectCardEffect.Root.Trash,
+                        customRootCardList: null,
+                        canLookReverseCard: true,
+                        selectPlayer: card.Owner,
+                        cardEffect: activateClass);
+
+                    selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
+                    selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+
+                    IEnumerator SelectCardCoroutine(CardSource cardSource)
+                    {
+                        selectedCards.Add(cardSource);
+
+                        yield return null;
+                    }
+
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
+                        cardSources: selectedCards,
+                        activateClass: activateClass,
+                        payCost: false,
+                        isTapped: false,
+                        root: SelectCardEffect.Root.Trash,
+                        activateETB: true));
                 }
             }
 
+            #endregion
+
             return cardEffects;
         }
     }

+ 30 - 8
Assets/CardEffect/BT18/Purple/Frimon_BT18_006.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace DCGO.CardEffects.BT18
 {
@@ -9,34 +10,55 @@ namespace DCGO.CardEffects.BT18
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            if (timing == EffectTiming.None)
+            #region On Deletion - ESS
+
+            if (timing == EffectTiming.OnDestroyedAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpICardEffect("Trash cards from the top of your deck", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
+                activateClass.SetIsInheritedEffect(true);
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
-                    return "";
+                    return "[On Deletion] Trash the top card of your deck for each color of your opponent's Digimon and Tamers.";
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
+                }
+
+                int OpponentColorCount()
+                {
+                    List<CardColor> cardColors = new List<CardColor>();
+
+                    foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaPermanents()
+                                 .Where(permanent => permanent.IsDigimon || permanent.IsTamer))
+                    {
+                        cardColors.AddRange(permanent.TopCard.CardColors);
+                    }
+
+                    cardColors = cardColors.Distinct().ToList();
+
+                    return cardColors.Count;
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    yield return null;
+                    yield return ContinuousController.instance.StartCoroutine(
+                        new IAddTrashCardsFromLibraryTop(OpponentColorCount(), card.Owner, activateClass).AddTrashCardsFromLibraryTop());
                 }
             }
 
+            #endregion
+
             return cardEffects;
         }
     }

+ 259 - 7
Assets/CardEffect/BT18/Purple/Velgrmon_BT18_079.cs

@@ -1,5 +1,7 @@
+using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace DCGO.CardEffects.BT18
 {
@@ -9,34 +11,284 @@ namespace DCGO.CardEffects.BT18
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Alternate Digivolution
+
+            // Any purple
+            if (timing == EffectTiming.None)
+            {
+                bool Condition()
+                {
+                    return card.Owner.HandCards.Contains(card);
+                }
+
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.IsTamer && targetPermanent.TopCard.CardColors.Contains(CardColor.Purple);
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false,
+                    card: card, condition: Condition));
+            }
+
+            // Koichi Kimura
             if (timing == EffectTiming.None)
+            {
+                bool Condition()
+                {
+                    return card.Owner.HandCards.Contains(card);
+                }
+
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.EqualsCardName("Koichi Kimura");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
+                    card: card, condition: Condition));
+            }
+
+            // Duskmon
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.EqualsCardName("Duskmon");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false,
+                    card: card, condition: null));
+            }
+
+            #endregion
+
+            #region On Play/ When Digivolving Shared
+
+            int OpponentColorCount()
+            {
+                List<CardColor> cardColors = new List<CardColor>();
+
+                foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaPermanents()
+                             .Where(permanent => permanent.IsDigimon || permanent.IsTamer))
+                {
+                    cardColors.AddRange(permanent.TopCard.CardColors);
+                }
+
+                cardColors = cardColors.Distinct().ToList();
+
+                return cardColors.Count;
+            }
+
+            bool CanActivateConditionShared(Hashtable hashtable)
+            {
+                return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+            }
+
+            #endregion
+
+            #region On Play
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Trash both player's decks and gain +1000 DP for every card trashed", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[On Play] For each color among your opponent's Digimon and Tamers, trash the top card of both players decks. Then, this Digimon gets +1000 DP for each card trashed by this effect for the turn.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    int trashCount = OpponentColorCount();
+
+                    int ownerTrashed = Math.Max(0, card.Owner.SecurityCards.Count - trashCount);
+                    int opponentTrashed = Math.Max(0, card.Owner.Enemy.SecurityCards.Count - trashCount);
+
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                        player: card.Owner.Enemy,
+                        destroySecurityCount: trashCount,
+                        cardEffect: activateClass,
+                        fromTop: true).DestroySecurity());
+
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                        player: card.Owner,
+                        destroySecurityCount: trashCount,
+                        cardEffect: activateClass,
+                        fromTop: true).DestroySecurity());
+
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
+                        targetPermanent: card.PermanentOfThisCard(),
+                        changeValue: 1000 * (ownerTrashed + opponentTrashed),
+                        effectDuration: EffectDuration.UntilEachTurnEnd,
+                        activateClass: activateClass));
+                }
+            }
+
+            #endregion
+
+            #region When Digivolving
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpICardEffect("Trash both player's decks and gain +1000 DP for every card trashed", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
-                    return "";
+                    return
+                        "[When Digivolving] For each color among your opponent's Digimon and Tamers, trash the top card of both players decks. Then, this Digimon gets +1000 DP for each card trashed by this effect for the turn.";
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    int trashCount = OpponentColorCount();
+
+                    int ownerTrashed = Math.Max(0, card.Owner.SecurityCards.Count - trashCount);
+                    int opponentTrashed = Math.Max(0, card.Owner.Enemy.SecurityCards.Count - trashCount);
+
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                        player: card.Owner.Enemy,
+                        destroySecurityCount: trashCount,
+                        cardEffect: activateClass,
+                        fromTop: true).DestroySecurity());
+
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                        player: card.Owner,
+                        destroySecurityCount: trashCount,
+                        cardEffect: activateClass,
+                        fromTop: true).DestroySecurity());
+
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
+                        targetPermanent: card.PermanentOfThisCard(),
+                        changeValue: 1000 * (ownerTrashed + opponentTrashed),
+                        effectDuration: EffectDuration.UntilEachTurnEnd,
+                        activateClass: activateClass));
+                }
+            }
+
+            #endregion
+
+            #region End of Attack
+
+            if (timing == EffectTiming.OnEndAttack)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Delete 1 Digimon to delete all of your opponent's Digimon with the same level",
+                    CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[End of Attack] By deleting 1 level 4 or lower purple Digimon, delete all of your opponent's Digimon with the lowest level.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
+                }
+
+                bool CanSelectPermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) &&
+                           permanent.IsDigimon &&
+                           permanent.TopCard.HasLevel &&
+                           permanent.Level <= 4 &&
+                           permanent.TopCard.CardColors.Contains(CardColor.Purple);
+                }
+                
+                bool OpponentMinLevelPermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
+                           CardEffectCommons.IsMinLevel(permanent, card.Owner.Enemy);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    yield return null;
+                    Permanent selectedPermanent = null;
+
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                    selectPermanentEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: CanSelectPermanentCondition,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: 1,
+                        canNoSelect: true,
+                        canEndNotMax: false,
+                        selectPermanentCoroutine: SelectPermanentCoroutine,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
+                        "The opponent is selecting 1 Digimon to delete.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                    {
+                        selectedPermanent = permanent;
+
+                        yield return null;
+                    }
+
+                    if (selectedPermanent != null)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(
+                            CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
+                                targetPermanents: new List<Permanent>() { selectedPermanent }, activateClass: activateClass,
+                                successProcess: _ => SuccessProcess(), failureProcess: null));
+
+                        IEnumerator SuccessProcess()
+                        {
+                            List<Permanent> destroyTargetPermanents =
+                                card.Owner.Enemy.GetBattleAreaDigimons().Filter(OpponentMinLevelPermanentCondition);
+
+                            yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
+                                destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
+                        }
+                    }
                 }
             }
 
+            #endregion
+
+            #region Retaliation - ESS
+
+            if (timing == EffectTiming.OnDestroyedAnyone)
+            {
+                cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
+            }
+
+            #endregion
+
             return cardEffects;
         }
     }