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

Merge pull request #1358 from DCGO2/x89rt2-patch-5

Create BT25_038.cs
hooperk 3 месяцев назад
Родитель
Сommit
db45ce64e4
1 измененных файлов с 411 добавлено и 0 удалено
  1. 411 0
      Assets/Scripts/CardEffect/BT25/Yellow/BT25_038.cs

+ 411 - 0
Assets/Scripts/CardEffect/BT25/Yellow/BT25_038.cs

@@ -0,0 +1,411 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+// Shakkoumon
+namespace DCGO.CardEffects.BT25
+{
+    public class BT25_038 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Alternate Digivolution Requirement
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent permanent)
+                {
+                    return permanent.TopCard.HasTSTraits;
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 4));
+            }
+            #endregion
+
+            #region DNA Digivolution - Yellow Lv.4 + Black/Blue Lv.4: Cost 0
+
+            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 true;
+                }
+
+                JogressCondition GetJogress(CardSource cardSource)
+                {
+                    if (cardSource == card)
+                    {
+                        bool PermanentCondition1(Permanent permanent)
+                        {
+                            if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                            {
+                                if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
+                                {
+                                    if (permanent.Levels_ForJogress(card).Contains(4))
+                                    {
+                                        return true;
+                                    }
+                                }
+                            }
+
+                            return false;
+                        }
+
+                        bool PermanentCondition2(Permanent permanent)
+                        {
+                            if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                            {
+                                if (permanent.TopCard.CardColors.Contains(CardColor.Black) || permanent.TopCard.CardColors.Contains(CardColor.Blue))
+                                {
+                                    if (permanent.Levels_ForJogress(card).Contains(4))
+                                    {
+                                        return true;
+                                    }
+                                }
+                            }
+
+                            return false;
+                        }
+
+                        JogressConditionElement[] elements = new JogressConditionElement[]
+                        {
+                        new JogressConditionElement(PermanentCondition1, "a level 4 Yellow Digimon"),
+
+                        new JogressConditionElement(PermanentCondition2, "a level 4 Black or Blue Digimon"),
+                        };
+
+                        JogressCondition jogressCondition = new JogressCondition(elements, 0);
+
+                        return jogressCondition;
+                    }
+
+                    return null;
+                }
+            }
+
+            #endregion
+
+            #region Shared OP/WD
+
+            string SharedEffectName = "May place 1 traited Digimon card from hand/sources as top or bot sec, then if DNA, trash both player's top sec";
+
+            CardEffectFactory.ActivateClassesForSharedEffects
+                (ref cardEffects, timing, card,
+                    SharedEffectName,
+                    SharedActivateCoroutine,
+                    SharedEffectDescription,
+                    optional: false,
+                    isSkippableFunction: IsSkippable,
+                    onPlay: true,
+                    whenDigivolving: true);
+
+            string SharedEffectDescription(string tag)
+                => $"[{tag}] You may place 1 [Angel], [Archangel], [Three Great Angels] or [Iliad] trait Digimon card from your hand or your Digimon's digivolution cards as the top or bottom security card. Then, if DNA digivolving, trash both players' top security cards.";
+
+            bool IsSkippable(Hashtable hashtable)
+            {
+                return !CardEffectCommons.IsJogress(hashtable);
+            }
+
+            bool CanSelectCardCondition(CardSource cardSource)
+            {
+                return cardSource.IsDigimon
+                    && (cardSource.EqualsTraits("Angel")
+                        || cardSource.EqualsTraits("Archangel")
+                        || cardSource.EqualsTraits("Three Great Angels")
+                        || cardSource.EqualsTraits("Iliad"));
+            }
+
+            bool CanSelectPlacePermanentCondition(Permanent permanent)
+            {
+                return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
+                    && permanent.DigivolutionCards.Exists(CanSelectCardCondition);
+            }
+
+            bool CanSelectOpponentPermanentCondition(Permanent permanent)
+            {
+                return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
+            }
+
+            IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                if (card.Owner.CanAddSecurity(activateClass))
+                {
+                    bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
+                    bool canSelectSource = CardEffectCommons.HasMatchConditionPermanent(CanSelectPlacePermanentCondition);
+
+                    if (canSelectHand || canSelectSource)
+                    {
+                        if (canSelectHand && canSelectSource)
+                        {
+                            List<SelectionElement<int>> selectionElements1 = new List<SelectionElement<int>>()
+                            {
+                                new (message: $"From hand", value : 1, spriteIndex: 0),
+                                new (message: $"From sources", value : 2, spriteIndex: 1),
+                                new (message: $"Don't place", value: 3, spriteIndex: 2)
+                            };
+
+                            string selectPlayerMessage1 = "From which area will you place a card?";
+                            string notSelectPlayerMessage1 = "The opponent is choosing from which area to place a card.";
+                            GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
+                        }
+                        else
+                        {
+                            GManager.instance.userSelectionManager.SetInt(canSelectHand ? 1 : 2);
+                        }
+
+                        yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+                        bool fromHand = GManager.instance.userSelectionManager.SelectedIntValue == 1;
+                        bool dontPlace = GManager.instance.userSelectionManager.SelectedIntValue == 3;
+
+                        if (!dontPlace)
+                        {
+                            CardSource selectedCard = null;
+
+                            if (fromHand)
+                            {
+                                SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                                selectHandEffect.SetUp(
+                                    selectPlayer: card.Owner,
+                                    canTargetCondition: CanSelectCardCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    maxCount: 1,
+                                    canNoSelect: true,
+                                    canEndNotMax: false,
+                                    isShowOpponent: true,
+                                    selectCardCoroutine: SelectCardCoroutine,
+                                    afterSelectCardCoroutine: null,
+                                    mode: SelectHandEffect.Mode.Custom,
+                                    cardEffect: activateClass);
+
+                                selectHandEffect.SetUpCustomMessage("Select 1 card to place in security.", "The opponent is selecting 1 card to place in security.");
+                                selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
+
+                                yield return StartCoroutine(selectHandEffect.Activate());
+                            }
+                            else
+                            {
+                                SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                                selectPermanentEffect.SetUp(
+                                    selectPlayer: card.Owner,
+                                    canTargetCondition: CanSelectPlacePermanentCondition,
+                                    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 select a card from to place in security.", "The opponent is selecting 1 Digimon to select a card from to place in security.");
+
+                                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                                IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                                {
+                                    Permanent selectedPermanent = permanent;
+
+                                    if (selectedPermanent != null)
+                                    {
+                                        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                                        selectCardEffect.SetUp(
+                                            canTargetCondition: CanSelectCardCondition,
+                                            canTargetCondition_ByPreSelecetedList: null,
+                                            canEndSelectCondition: null,
+                                            canNoSelect: () => true,
+                                            selectCardCoroutine: SelectCardCoroutine,
+                                            afterSelectCardCoroutine: null,
+                                            message: "Select 1 [Angel], [Archangel], [Three Great Angels] or [Iliad] trait Digimon card to place in security.",
+                                            maxCount: 1,
+                                            canEndNotMax: false,
+                                            isShowOpponent: true,
+                                            mode: SelectCardEffect.Mode.Custom,
+                                            root: SelectCardEffect.Root.DigivolutionCards,
+                                            customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
+                                            canLookReverseCard: true,
+                                            selectPlayer: card.Owner,
+                                            cardEffect: activateClass);
+
+                                        yield return StartCoroutine(selectCardEffect.Activate());
+                                    }
+                                }
+                            }
+
+                            IEnumerator SelectCardCoroutine(CardSource cardSource)
+                            {
+                                selectedCard = cardSource;
+
+                                yield return null;
+                            }
+
+                            if (selectedCard != null)
+                            {
+                                List<SelectionElement<int>> selectionElements1 = new List<SelectionElement<int>>()
+                                {
+                                    new (message: $"to Top", value : 1, spriteIndex: 0),
+                                    new (message: $"to Bottom", value : 2, spriteIndex: 1),
+                                    new (message: $"do not place", value : 3, spriteIndex: 2),
+                                };
+
+                                string selectPlayerMessage1 = "Where will you place card?";
+                                string notSelectPlayerMessage1 = "The opponent is choosing where to place card.";
+                                GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
+                            }
+
+                            bool toTop = GManager.instance.userSelectionManager.SelectedIntValue == 1;
+                            bool dontPlace1 = GManager.instance.userSelectionManager.SelectedIntValue == 3;
+
+                            if (!dontPlace1)
+                            {
+                                yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(selectedCard, selectedCard.PermanentOfThisCard()));
+
+                                yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard, toTop: toTop));
+                            }
+                        }
+                    }
+                }
+
+                if (CardEffectCommons.IsJogress(hashtable))
+                {
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                        player: card.Owner,
+                        destroySecurityCount: 1,
+                        cardEffect: activateClass,
+                        fromTop: true).DestroySecurity());
+
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                        player: card.Owner.Enemy,
+                        destroySecurityCount: 1,
+                        cardEffect: activateClass,
+                        fromTop: true).DestroySecurity());
+                }
+            }
+            #endregion
+
+            #region All Turns
+            if (timing == EffectTiming.OnAddSecurity)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("<Dedigivolve 1> 1 enemy digimon>", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
+                activateClass.SetHashString("BT25_038_AT");
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return "[All Turns] [Once Per Turn] When your security stack is added to, <De-Digivolve 1> 1 of your opponent's Digimon.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
+                        && CardEffectCommons.CanTriggerWhenAddSecurity(hashtable, player => player == card.Owner);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentPermanentCondition))
+                    {
+                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectOpponentPermanentCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: 1,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            selectPermanentCoroutine: null,
+                            afterSelectPermanentCoroutine: null,
+                            mode: SelectPermanentEffect.Mode.Degenerate,
+                            cardEffect: activateClass);
+
+                        selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to <De-Digivolve 1>", "The opponent is selecting 1 Digimon to <De-Digivolve 1>");
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                    }
+                }
+            }
+            #endregion
+
+            #region Inherited
+            if (timing == EffectTiming.OnLoseSecurity)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("1 of your opponent's Digimon gets -4000 DP", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
+                activateClass.SetHashString("BT25_040_WST_AT");
+                activateClass.SetIsInheritedEffect(true);
+                cardEffects.Add(activateClass);
+
+                string EffectDescription() => "[All Turns] (Once Per Turn) When security stacks are removed from, 1 of your opponent's Digimon gets -4000 DP for the turn.";
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
+                    {
+                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectOpponentPermanentCondition,
+                            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 -4000.",
+                            "The opponent is selecting 1 Digimon that will get DP -4000.");
+
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                        IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                        {
+                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
+                                targetPermanent: permanent,
+                                changeValue: -4000,
+                                effectDuration: EffectDuration.UntilEachTurnEnd,
+                                activateClass: activateClass));
+                        }
+                    }
+                }
+            }
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}