Browse Source

Add all digimon card Effects

Andrej Erdelsky 1 year ago
parent
commit
4fe7fb7e09

+ 43 - 0
Assets/CardEffect/BT21/Blue/BT21_003.cs

@@ -9,6 +9,49 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Your Turn - ESS
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
+                activateClass.SetIsInheritedEffect(true);
+                activateClass.SetHashString("Draw_BT21_003");
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[Your Turn] (Once Per Turn) When any of your [WG] trait Digimon are played, <Draw 1>.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.IsOwnerTurn(card) &&
+                           CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition);
+                }
+
+                bool PlayedPermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
+                           permanent.TopCard.EqualsTraits("WG");
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
+                }
+            }
+
+            #endregion
+
             return cardEffects;
         }
     }

+ 77 - 7
Assets/CardEffect/BT21/Blue/BT21_033.cs

@@ -9,34 +9,104 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Alternate Digivolution
+
             if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.EqualsTraits("WG");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition,
+                    digivolutionCost: 0,
+                    ignoreDigivolutionRequirement: false,
+                    card: card,
+                    condition: null)
+                );
+            }
+
+            #endregion
+
+            #region On Play
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
+                    EffectDescription());
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
+                {
+                    return
+                        "[On Play] Reveal the top 3 cards of your deck. Add 1 card with [Avian]/[Bird] in any of its traits and 1 card with the [WG] trait among them to the hand. Return the rest to the bottom of the deck.";
+                }
+
+                bool CanSelectAvianBirdCardCondition(CardSource cardSource)
+                {
+                    return cardSource.HasBirdTraits;
+                }
+
+                bool CanSelectWindGuardianCardCondition(CardSource cardSource)
                 {
-                    return "";
+                    return cardSource.ContainsTraits("WG");
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           card.Owner.LibraryCards.Count >= 1;
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    yield return null;
+                    yield return ContinuousController.instance.StartCoroutine(
+                        CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
+                            revealCount: 3,
+                            simplifiedSelectCardConditions:
+                            new SimplifiedSelectCardConditionClass[]
+                            {
+                                new(
+                                    canTargetCondition: CanSelectAvianBirdCardCondition,
+                                    message: "Select 1 card with [Avian]/[Bird] in any of its traits.",
+                                    mode: SelectCardEffect.Mode.AddHand,
+                                    maxCount: 1,
+                                    selectCardCoroutine: null),
+                                new(
+                                    canTargetCondition: CanSelectWindGuardianCardCondition,
+                                    message: "Select 1 card with the [WG] trait.",
+                                    mode: SelectCardEffect.Mode.AddHand,
+                                    maxCount: 1,
+                                    selectCardCoroutine: null),
+                            },
+                            remainingCardsPlace: RemainingCardsPlace.DeckBottom,
+                            activateClass: activateClass
+                        ));
                 }
             }
 
+            #endregion
+
+            #region Jamming - ESS
+
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
+                    isInheritedEffect: true,
+                    card: card,
+                    condition: null));
+            }
+
+            #endregion
+
             return cardEffects;
         }
     }

+ 98 - 7
Assets/CardEffect/BT21/Blue/BT21_036.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace DCGO.CardEffects.BT21
 {
@@ -9,34 +10,124 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Alternate Digivolution
+
             if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.EqualsCardName("Veemon") ||
+                           (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel3 &&
+                            targetPermanent.TopCard.EqualsTraits("Hero"));
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition,
+                    digivolutionCost: 3,
+                    ignoreDigivolutionRequirement: false,
+                    card: card,
+                    condition: null));
+            }
+
+            #endregion
+
+            #region Blocker
+
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
+                    isInheritedEffect: false,
+                    card: card,
+                    condition: null));
+            }
+
+            #endregion
+
+            #region Armor Purge
+
+            if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
+            {
+                cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
+            }
+
+            #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("Unsuspend this Digimon and gain DP+", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
-                    return "";
+                    return
+                        "[When Digivolving] This Digimon unsuspends. Then, to 1 of your opponent's Digimon give -2000 DP for the turn for each card with the [Armor Form] trait in your trash.";
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
+                }
+
+                bool CanSelectPermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return true;
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    yield return null;
+                    yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
+                        new List<Permanent>() { card.PermanentOfThisCard() },
+                        activateClass).Unsuspend());
+
+                    if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
+                    {
+                        int minusDP = -2000 * card.Owner.TrashCards.Count(
+                            cardSource => cardSource.CardTraits.Contains("Armor Form") || cardSource.CardTraits.Contains("ArmorForm"));
+
+                        SelectPermanentEffect selectPermanentEffect =
+                            GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectPermanentCondition,
+                            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 get DP {minusDP}.",
+                            $"The opponent is selecting 1 Digimon that will get DP {minusDP}.");
+
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                        IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                        {
+                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
+                                targetPermanent: permanent,
+                                changeValue: minusDP,
+                                effectDuration: EffectDuration.UntilEachTurnEnd,
+                                activateClass: activateClass));
+                        }
+                    }
                 }
             }
 
+            #endregion
+
             return cardEffects;
         }
     }

+ 1 - 1
Assets/CardEffect/BT21/Blue/BT21_038.cs

@@ -20,7 +20,7 @@ namespace DCGO.CardEffects.BT21
 
                 cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
                     permanentCondition: PermanentCondition,
-                    digivolutionCost: 3,
+                    digivolutionCost: 2,
                     ignoreDigivolutionRequirement: false,
                     card: card,
                     condition: null));

+ 202 - 31
Assets/CardEffect/BT21/Blue/BT21_039.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace DCGO.CardEffects.BT21
 {
@@ -9,74 +10,244 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            #region Your Turn
+            #region Alternate Digivolution
 
             if (timing == EffectTiming.None)
             {
-                bool Condition()
-                {
-                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card);
-                }
-
                 bool PermanentCondition(Permanent targetPermanent)
                 {
-                    return targetPermanent == card.PermanentOfThisCard();
+                    return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsTraits("WG");
                 }
 
-                bool CardSourceCondition(CardSource cardSource)
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition,
+                    digivolutionCost: 3,
+                    ignoreDigivolutionRequirement: false,
+                    card: card,
+                    condition: null));
+            }
+
+            #endregion
+
+            #region DNA Digivolution
+
+            if (timing == EffectTiming.None)
+            {
+                AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
+                addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
+                addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
+                addJogressConditionClass.SetNotShowUI(true);
+                cardEffects.Add(addJogressConditionClass);
+
+                bool CanUseCondition(Hashtable hashtable)
                 {
-                    return cardSource.IsDigimon &&
-                           (cardSource.EqualsTraits("Mollusk") ||
-                            cardSource.EqualsTraits("Aquatic"));
+                    return true;
                 }
 
-                bool RootCondition(SelectCardEffect.Root root)
+                JogressCondition GetJogress(CardSource cardSource)
                 {
-                    return true;
+                    if (cardSource == card)
+                    {
+                        bool PermanentConditionA(Permanent permanent)
+                        {
+                            return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
+                                   (permanent.TopCard.CardColors.Contains(CardColor.Blue) ||
+                                    permanent.TopCard.CardColors.Contains(CardColor.Yellow)) &&
+                                   permanent.Levels_ForJogress(card).Contains(5);
+                        }
+
+                        bool PermanentConditionB(Permanent permanent)
+                        {
+                            return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
+                                   (permanent.TopCard.CardColors.Contains(CardColor.Green) ||
+                                    permanent.TopCard.CardColors.Contains(CardColor.Red)) &&
+                                   permanent.Levels_ForJogress(card).Contains(5);
+                        }
+
+                        JogressConditionElement[] elements =
+                        {
+                            new(PermanentConditionA, "a level 5 Blue or Yellow Digimon"),
+                            new(PermanentConditionB, "a level 5 Green or Red Digimon")
+                        };
+
+                        JogressCondition jogressCondition = new JogressCondition(elements, 0);
+
+                        return jogressCondition;
+                    }
+
+                    return null;
                 }
+            }
 
-                cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
-                    changeValue: -1,
-                    permanentCondition: PermanentCondition,
-                    cardCondition: CardSourceCondition,
-                    rootCondition: RootCondition,
+            #endregion
+
+            #region Alliance
+
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                cardEffects.Add(CardEffectFactory.AllianceSelfEffect(
                     isInheritedEffect: false,
                     card: card,
-                    condition: Condition,
-                    setFixedCost: false));
+                    condition: null));
+            }
+
+            #endregion
+
+            #region When Digivolving
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("You may play 1 level 4 or lower Digimon card from your hand.", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[When Digivolving] You may play 1 level 4 or lower Digimon card with the [WG] trait from your hand without paying the cost.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
+                }
+
+                bool CanSelectDigimonCardCondition(CardSource source)
+                {
+                    return source.IsDigimon &&
+                           source.HasLevel && source.Level <= 4 &&
+                           source.EqualsTraits("WG") &&
+                           CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDigimonCardCondition);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    List<CardSource> selectedCards = new List<CardSource>();
+
+                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                    selectHandEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: CanSelectDigimonCardCondition,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: 1,
+                        canNoSelect: true,
+                        canEndNotMax: false,
+                        isShowOpponent: true,
+                        selectCardCoroutine: SelectCardCoroutine,
+                        afterSelectCardCoroutine: null,
+                        mode: SelectHandEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
+                    selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
+
+                    yield return StartCoroutine(selectHandEffect.Activate());
+
+                    IEnumerator SelectCardCoroutine(CardSource cardSource)
+                    {
+                        selectedCards.Add(cardSource);
+
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
+                            cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
+                            root: SelectCardEffect.Root.Hand, activateETB: true));
+                    }
+                }
             }
 
             #endregion
-            
-            #region End of Attack - ESS
 
-            if (timing == EffectTiming.OnEndAttack)
+            #region When Attacking
+
+            if (timing == EffectTiming.OnAllyAttack)
             {
                 ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
-                activateClass.SetIsInheritedEffect(true);
-                activateClass.SetHashString("Memory+1_BT21_031");
+                activateClass.SetUpICardEffect("1 of your other Digimon digivolves without paying the cost", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
                 cardEffects.Add(activateClass);
 
                 string EffectDescription()
                 {
-                    return "[End of Attack] (Once Per Turn) Gain 1 memory.";
+                    return
+                        "[When Attacking] (Once Per Turn) 1 of your other Digimon may digivolve into a Digimon card with the [WG] trait in the hand without paying the cost.";
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
+                    return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
+                }
+
+                bool DigivolveFromPermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
+                           permanent.IsDigimon &&
+                           card.Owner.HandCards.Where(DigivolveToCardCondition).Any(cardSource =>
+                               cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
+                }
+
+                bool DigivolveToCardCondition(CardSource cardSource)
+                {
+                    return cardSource.IsDigimon && cardSource.EqualsTraits("WG");
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.HasMatchConditionPermanent(DigivolveFromPermanentCondition);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
+                    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: false,
+                            reduceCostTuple: null,
+                            fixedCostTuple: null,
+                            ignoreDigivolutionRequirementFixedCost: -1,
+                            isHand: true,
+                            activateClass: activateClass,
+                            successProcess: null));
+                    }
                 }
             }