x89rt2 3 місяців тому
батько
коміт
433ad29a71
1 змінених файлів з 211 додано та 0 видалено
  1. 211 0
      Assets/Scripts/CardEffect/BT25/Blue/BT25_026.cs

+ 211 - 0
Assets/Scripts/CardEffect/BT25/Blue/BT25_026.cs

@@ -0,0 +1,211 @@
+using System.Collections;
+using System.Collections.Generic;
+
+// Crescemon
+namespace DCGO.CardEffects.BT25
+{
+    public class BT25_026 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Alt Digivolution Condition
+            if (timing == EffectTiming.None)
+            {
+                static bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.HasTSTraits;
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 4, permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
+            }
+            #endregion
+
+            #region Shared OP/WD
+            string SharedEffectName = "Trash 3 bottom sources of 1 enemy digimon, 1 enemy digimon with no sources can't suspend until end of their turn";
+
+            CardEffectFactory.ActivateClassesForSharedEffects
+            (ref cardEffects, timing, card,
+                SharedEffectName,
+                SharedActivateCoroutine,
+                SharedEffectDescription,
+                optional: false,
+                onPlay: true,
+                whenDigivolving: true);
+
+            string SharedEffectDescription(string tag)
+            {
+                return $"[{tag}] Trash the bottom 3 digivolution cards of 1 of your opponent's Digimon. Then, 1 of their Digimon with no digivolution cards can't suspend until their turn ends.";
+            }
+
+            bool CanSelectPermanentCondition(Permanent permanent)
+            {
+                return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
+            }
+
+            bool OpponentsDigimonWithoutSources(Permanent permanent)
+            {
+                return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
+                    && permanent.DigivolutionCards.Count == 0;
+            }
+
+            IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                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 to trash digivolution cards from.",
+                    "The opponent is selecting 1 Digimon to trash digivolution cards from.");
+
+                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                {
+                    yield return ContinuousController.instance.StartCoroutine(
+                        CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
+                            targetPermanent: permanent,
+                            trashCount: 3,
+                            isFromTop: false,
+                            activateClass: activateClass));
+                }
+
+                SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                selectPermanentEffect1.SetUp(
+                    selectPlayer: card.Owner,
+                    canTargetCondition: OpponentsDigimonWithoutSources,
+                    canTargetCondition_ByPreSelecetedList: null,
+                    canEndSelectCondition: null,
+                    maxCount: 1,
+                    canNoSelect: false,
+                    canEndNotMax: false,
+                    selectPermanentCoroutine: null,
+                    afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
+                    mode: SelectPermanentEffect.Mode.Custom,
+                    cardEffect: activateClass);
+
+                selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to gain can't suspend until end of opponent's turn.", "The opponent is selecting 1 Digimon that will gain can't suspend until end of opponent's turn.");
+
+                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
+
+                IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
+                {
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspendPlayerEffect(
+                               permanentCondition: (permanent) => permanent == permanents[0],
+                               effectDuration: EffectDuration.UntilOpponentTurnEnd,
+                               activateClass: activateClass,
+                               isOnlyActivePhase: false,
+                               effectName: "Can't Suspend"
+                           ));
+                }
+            }
+            #endregion
+
+            #region Your Turn
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Digivolve into [Dianamon] in trash for 2 less", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription() => "[Your Turn] When your Digimon are played or digivolve, if any of them are red, this Digimon may digivolve into [Dianamon] in the trash with the cost reduced by 2.";
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleArea(card)
+                        && CardEffectCommons.IsOwnerTurn(card)
+                        && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition)
+                            || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition));
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleArea(card)
+                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+                }
+
+                bool PermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.EqualsCardName("Dianamon")
+                        && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    List<Permanent> playedPermanents = new List<Permanent>();
+
+                    foreach (Hashtable hash in CardEffectCommons.GetHashtablesFromHashtable(hashtable))
+                    {
+                        playedPermanents.Add(CardEffectCommons.GetPermanentFromHashtable(hash));
+                    }
+
+                    bool PermanentCondition1(Permanent permanent)
+                    {
+                        return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
+                            && permanent.TopCard.CardColors.Contains(CardColor.Red);
+                    }
+
+                    List<Permanent> targetPermanents = playedPermanents.Filter(PermanentCondition1);
+
+                    if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, targetPermanents.Contains))
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
+                            targetPermanent: card.PermanentOfThisCard(),
+                            cardCondition: CanSelectCardCondition,
+                            payCost: true,
+                            reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
+                            fixedCostTuple: null,
+                            ignoreDigivolutionRequirementFixedCost: -1,
+                            isHand: false,
+                            activateClass: activateClass,
+                            successProcess: null));
+                    }
+                }
+            }
+            #endregion
+
+            #region Inherited
+            if (timing == EffectTiming.None)
+            {
+                CanNotSwitchAttackTargetClass canNotSwitchAttackTargetClass = new CanNotSwitchAttackTargetClass();
+                canNotSwitchAttackTargetClass.SetUpICardEffect("This Digimon's attack target can't be changed.", CanUseCondition, card);
+                canNotSwitchAttackTargetClass.SetUpCanNotSwitchAttackTargetClass(PermanentCondition: PermanentCondition);
+                canNotSwitchAttackTargetClass.SetIsInheritedEffect(true);
+                cardEffects.Add(canNotSwitchAttackTargetClass);
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.IsOwnerTurn(card);
+                }
+
+                bool PermanentCondition(Permanent permanent)
+                {
+                    return permanent != null && permanent.TopCard && permanent == card.PermanentOfThisCard();
+                }
+            }
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}