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

Merge pull request #1353 from DCGO2/x89rt2-patch-3

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

+ 172 - 0
Assets/Scripts/CardEffect/BT25/Black/BT25_071.cs

@@ -0,0 +1,172 @@
+using System.Collections;
+using System.Collections.Generic;
+
+// Orochimon
+namespace DCGO.CardEffects.BT25
+{
+    public class BT25_071 : 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)
+            {
+                static bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.EqualsTraits("TS");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 4, permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
+            }
+            #endregion
+
+            #region Shared OP / WD
+            string SharedEffectName = "1 enemy Digimon/Tamer can't attack until their turn ends";
+
+            CardEffectFactory.ActivateClassesForSharedEffects
+                (ref cardEffects, timing, card,
+                    SharedEffectName,
+                    SharedActivateCoroutine,
+                    SharedEffectDescription,
+                    optional: false,
+                    onPlay: true,
+                    whenDigivolving: true);
+
+            string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon or Tamers can't attack until their turn ends.";
+
+            bool CanSelectPermanentCondition(Permanent permanent)
+            {
+                return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
+                    && (permanent.IsDigimon
+                        || permanent.IsTamer);
+            }        
+
+            IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
+                {
+                    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 Digimon/Tamer to give can't attack until their turn ends.", "The opponent is selecting Digimon/Tamer to give can't attack until your turn ends.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
+                                targetPermanent: permanent,
+                                defenderCondition: null,
+                                effectDuration: EffectDuration.UntilOpponentTurnEnd,
+                                activateClass: activateClass,
+                                effectName: "Can't Attack"));
+                    }
+                }
+            }
+            #endregion
+
+            #region Shared AT/Inherited
+
+            string SharedEffectName1() => "Reveal 3, may play 1 play cost 4 or lower [TS] trait Digimon card, bot deck the rest.";
+
+            string SharedEffectDescription1() => "[All Turns] [Once Per Turn] When this Digimon suspends, reveal the top 3 cards of your deck. You may play 1 play cost 4 or lower [TS] trait Digimon card among them without paying the cost. Return the rest to the bottom of the deck.";
+
+            bool SharedCanActivateCondition(Hashtable hashtable)
+            {
+                return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+            }
+
+            bool SharedCanUseCondition(Hashtable hashtable)
+            {
+                return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
+                    && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
+            }
+
+            IEnumerator SharedActivateCoroutine1(Hashtable hashtable, ActivateClass activateClass)
+            {
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.IsDigimon
+                        && cardSource.HasPlayCost
+                        && cardSource.GetCostItself <= 4
+                        && cardSource.EqualsTraits("TS");
+                }
+                List<CardSource> selectedCards = new List<CardSource>();
+
+                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
+                    revealCount: 3,
+                    simplifiedSelectCardConditions:
+                    new SimplifiedSelectCardConditionClass[]
+                    {
+                    new SimplifiedSelectCardConditionClass(
+                        canTargetCondition:CanSelectCardCondition,
+                        message: "Select 1 Digimon card to play for free.",
+                        mode: SelectCardEffect.Mode.Custom,
+                        maxCount: 1,
+                        selectCardCoroutine: SelectCardCoroutine),
+                    },
+                    remainingCardsPlace: RemainingCardsPlace.DeckBottom,
+                    activateClass: activateClass,
+                    canNoSelect: true
+                ));
+
+                IEnumerator SelectCardCoroutine(CardSource cardSource)
+                {
+                    selectedCards.Add(cardSource);
+                    yield return null;
+                }
+
+                if (selectedCards.Count > 0)
+                {
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
+                    cardSources: selectedCards,
+                    activateClass: activateClass,
+                    payCost: false,
+                    isTapped: false,
+                    root: SelectCardEffect.Root.Library,
+                    activateETB: true));
+                }
+            }
+            #endregion
+
+            #region All Turns
+            if (timing == EffectTiming.WhenRemoveField)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect(SharedEffectName1(), SharedCanUseCondition, card);
+                activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass, true), 1, true, SharedEffectDescription1());
+                activateClass.SetHashString("BT25_073_AT");
+                cardEffects.Add(activateClass);
+            }
+            #endregion
+
+            #region All Turns Inherited
+            if (timing == EffectTiming.WhenRemoveField)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect(SharedEffectName1(), SharedCanUseCondition, card);
+                activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass, false), 1, true, SharedEffectDescription1());
+                activateClass.SetIsInheritedEffect(true);
+                activateClass.SetHashString("BT25_073_AT_ESS");
+                cardEffects.Add(activateClass);
+            }
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}