Explorar el Código

Merge branch 'develop' into Hybrid-lvl-5s

x89rt2 hace 3 meses
padre
commit
07815c689b
Se han modificado 1 ficheros con 125 adiciones y 193 borrados
  1. 125 193
      Assets/Scripts/CardEffect/BT18/Black/BT18_092.cs

+ 125 - 193
Assets/Scripts/CardEffect/BT18/Black/BT18_092.cs

@@ -1,8 +1,8 @@
-using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 
+// Zenith
 namespace DCGO.CardEffects.BT18
 {
     public class BT18_092 : CEntity_Effect
@@ -16,93 +16,61 @@ namespace DCGO.CardEffects.BT18
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Trash 1 card from hand to gain Memory +1 and Draw 1", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
+                activateClass.SetIsSkippable(true);
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
                     return "[Start of Your Main Phase] By trashing 1 [Vemmon] in your hand, <Draw 1> and gain 1 memory.";
                 }
 
-                bool CanSelectCardCondition(CardSource cardSource)
-                {
-                    if (cardSource.CardNames.Contains("Vemmon"))
-                    {
-                        return true;
-                    }
-
-                    return false;
-                }
-
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.IsOwnerTurn(card))
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
+                        && CardEffectCommons.IsOwnerTurn(card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
-                        {
-                            return true;
-                        }
-                    }
+                    return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
+                        && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
+                }
 
-                    return false;
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.CardNames.Equals("Vemmon");
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
-                    if (card.Owner.HandCards.Some(CanSelectCardCondition))
+                    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: null,
+                        afterSelectCardCoroutine: AfterSelectCardCoroutine,
+                        mode: SelectHandEffect.Mode.Discard,
+                        cardEffect: activateClass);
+
+                    yield return StartCoroutine(selectHandEffect.Activate());
+
+                    IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
                     {
-                        bool discarded = false;
-
-                        int discardCount = 1;
-
-                        SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
-
-                        selectHandEffect.SetUp(
-                            selectPlayer: card.Owner,
-                            canTargetCondition: CanSelectCardCondition,
-                            canTargetCondition_ByPreSelecetedList: null,
-                            canEndSelectCondition: null,
-                            maxCount: discardCount,
-                            canNoSelect: true,
-                            canEndNotMax: false,
-                            isShowOpponent: true,
-                            selectCardCoroutine: null,
-                            afterSelectCardCoroutine: AfterSelectCardCoroutine,
-                            mode: SelectHandEffect.Mode.Discard,
-                            cardEffect: activateClass);
-
-                        yield return StartCoroutine(selectHandEffect.Activate());
-
-                        IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
-                        {
-                            if (cardSources.Count >= 1)
-                            {
-                                discarded = true;
-
-                                yield return null;
-                            }
-                        }
-
-                        if (discarded)
+                        if (cardSources.Count >= 1)
                         {
                             yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
 
                             yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
                         }
-                    }
+                    }         
                 }
             }
             #endregion
@@ -112,46 +80,36 @@ namespace DCGO.CardEffects.BT18
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Return 2 [Vemmon] to <De-Digivolve - 1>", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
                     return "[Your Turn] When any of your Digimon attacks, by suspending this Tamer and returning 2 [Vemmon] from that Digimon's digivolution cards to the bottom of the deck, <De-Digivolve - 1> 1 of your opponent's Digimon.";
                 }
 
-                bool PermanentCondition(Permanent permanent)
+                bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
-                    {
-                        if (permanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Vemmon")) >= 2)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
+                        && CardEffectCommons.IsOwnerTurn(card)
+                        && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
                 }
 
-                bool CanSelectCardCondition(CardSource cardSource)
+                bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return cardSource.CardNames.Contains("Vemmon");
+                    return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
+                        && CardEffectCommons.CanActivateSuspendCostEffect(card);
                 }
 
-                bool CanUseCondition(Hashtable hashtable)
+                bool PermanentCondition(Permanent permanent)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.IsOwnerTurn(card))
-                        {
-                            if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
-                            {
-                                return true;
-                            }
-                        }
-                    }
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
+                        && permanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Equals("Vemmon")) >= 2;
+                }
 
-                    return false;
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.CardNames.Equals("Vemmon");
                 }
 
                 bool CanSelectPermanentCondition(Permanent permanent)
@@ -159,130 +117,104 @@ namespace DCGO.CardEffects.BT18
                     return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
                 }
 
-                bool CanActivateCondition(Hashtable hashtable)
+                IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
+
+                    if (GManager.instance.attackProcess.AttackingPermanent != null
+                    && GManager.instance.attackProcess.AttackingPermanent.TopCard != null
+                    && GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Vemmon")) >= 2
+                    && GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 2)
                     {
-                        if (CardEffectCommons.CanActivateSuspendCostEffect(card))
+                        List<CardSource> selectedCards = new List<CardSource>();
+
+                        bool returnedToLibrary = false;
+
+                        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                        selectCardEffect.SetUp(
+                            canTargetCondition: CanSelectCardCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            canNoSelect: () => true,
+                            selectCardCoroutine: SelectCardCoroutine,
+                            afterSelectCardCoroutine: null,
+                            message: "Select digivolution cards to return to the bottom of deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
+                            maxCount: 2,
+                            canEndNotMax: false,
+                            isShowOpponent: true,
+                            mode: SelectCardEffect.Mode.Custom,
+                            root: SelectCardEffect.Root.Custom,
+                            customRootCardList: GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards,
+                            canLookReverseCard: true,
+                            selectPlayer: card.Owner,
+                            cardEffect: null);
+
+                        selectCardEffect.SetUpCustomMessage("Select digivolution cards to return to the bottom of deck.", "The opponent is selecting digivolution cards to return to the bottom of deck.");
+                        selectCardEffect.SetNotShowCard();
+
+                        yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+
+                        IEnumerator SelectCardCoroutine(CardSource cardSource)
                         {
-                            return true;
+                            selectedCards.Add(cardSource);
+
+                            yield return null;
                         }
-                    }
 
-                    return false;
-                }
+                        if (selectedCards.Count >= 1)
+                        {
+                            yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(
+                                GManager.instance.attackProcess.AttackingPermanent,
+                                selectedCards,
+                                CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
 
-                IEnumerator ActivateCoroutine(Hashtable _hashtable)
-                {
-                    yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
+                            if (selectedCards.Count == 2)
+                            {
+                                returnedToLibrary = true;
+                            }
+                        }
 
-                    if (GManager.instance.attackProcess.AttackingPermanent != null)
-                    {
-                        if (GManager.instance.attackProcess.AttackingPermanent.TopCard != null)
+                        if (returnedToLibrary)
                         {
-                            if (GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Vemmon")) >= 2)
+                            if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
                             {
-                                if (GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 2)
+                                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 De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
+                                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                                IEnumerator SelectPermanentCoroutine(Permanent permanent)
                                 {
-                                    List<CardSource> selectedCards = new List<CardSource>();
-
-                                    int maxCount = 2;
-
-                                    bool returnedToLibrary = false;
-
-                                    SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
-
-                                    selectCardEffect.SetUp(
-                                                canTargetCondition: CanSelectCardCondition,
-                                                canTargetCondition_ByPreSelecetedList: null,
-                                                canEndSelectCondition: null,
-                                                canNoSelect: () => true,
-                                                selectCardCoroutine: SelectCardCoroutine,
-                                                afterSelectCardCoroutine: null,
-                                                message: "Select digivolution cards to return to the bottom of deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
-                                                maxCount: maxCount,
-                                                canEndNotMax: false,
-                                                isShowOpponent: true,
-                                                mode: SelectCardEffect.Mode.Custom,
-                                                root: SelectCardEffect.Root.Custom,
-                                                customRootCardList: GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards,
-                                                canLookReverseCard: true,
-                                                selectPlayer: card.Owner,
-                                                cardEffect: null);
-
-                                    selectCardEffect.SetUpCustomMessage("Select digivolution cards to return to the bottom of deck.", "The opponent is selecting digivolution cards to return to the bottom of deck.");
-                                    selectCardEffect.SetNotShowCard();
-
-                                    yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
-
-                                    IEnumerator SelectCardCoroutine(CardSource cardSource)
-                                    {
-                                        selectedCards.Add(cardSource);
-
-                                        yield return null;
-                                    }
-
-                                    if (selectedCards.Count >= 1)
-                                    {
-                                        yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(
-                                            GManager.instance.attackProcess.AttackingPermanent,
-                                            selectedCards,
-                                            CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
-
-                                        if (selectedCards.Count == 2)
-                                        {
-                                            returnedToLibrary = true;
-                                        }
-                                    }
-
-                                    if (returnedToLibrary)
-                                    {
-                                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                                        {
-                                            int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
-
-                                            SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
-                                            selectPermanentEffect.SetUp(
-                                                selectPlayer: card.Owner,
-                                                canTargetCondition: CanSelectPermanentCondition,
-                                                canTargetCondition_ByPreSelecetedList: null,
-                                                canEndSelectCondition: null,
-                                                maxCount: maxCount1,
-                                                canNoSelect: false,
-                                                canEndNotMax: false,
-                                                selectPermanentCoroutine: SelectPermanentCoroutine,
-                                                afterSelectPermanentCoroutine: null,
-                                                mode: SelectPermanentEffect.Mode.Custom,
-                                                cardEffect: activateClass);
-
-                                            selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
-                                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                                            IEnumerator SelectPermanentCoroutine(Permanent permanent)
-                                            {
-                                                Permanent selectedPermanent = permanent;
-
-                                                yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
-                                            }
-                                        }
-                                    }
+                                    Permanent selectedPermanent = permanent;
+
+                                    yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
                                 }
                             }
-                        }
-                    
+                        }   
                     }
                 }
             }
             #endregion
 
             #region Security Effect
-
             if (timing == EffectTiming.SecuritySkill)
             {
                 cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
             }
-
             #endregion
 
             return cardEffects;