Explorar el Código

Changes to Dinobeemon and Paildramon

Pedro Paulo de Almeida Marinho hace 1 año
padre
commit
c9b292ed63
Se han modificado 2 ficheros con 437 adiciones y 8 borrados
  1. 432 0
      Assets/CardEffect/BT20/Purple/BT20_074.cs
  2. 5 8
      Assets/CardEffect/BT20/Red/BT20_016.cs

+ 432 - 0
Assets/CardEffect/BT20/Purple/BT20_074.cs

@@ -0,0 +1,432 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System.Linq;
+using Photon;
+using System;
+using Photon.Pun;
+
+namespace DCGO.CardEffects
+{
+    public class BT20_074 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+           
+            #region DNA Digivolve
+            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 (permanent != null)
+                        {
+                            if (permanent.TopCard != null)
+                            {
+                                if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+
+                                {
+                                            if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
+                                            {
+                                                if (permanent.Levels_ForJogress(card).Contains(4))
+                                                {
+                                                    return true;
+                                                }
+                                            }
+                                }
+                            }
+                        }
+
+                        return false;
+                    }
+
+                    bool PermanentCondition2(Permanent permanent)
+                    {
+                        if (permanent != null)
+                        {
+                            if (permanent.TopCard != null)
+                            {
+                                if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                                {                                
+                                            if (permanent.TopCard.CardColors.Contains(CardColor.Red))
+                                            {
+                                                if (permanent.Levels_ForJogress(card).Contains(4))
+                                                {
+                                                    return true;
+                                                }
+                                            }
+                                }
+                            }
+                        }
+
+                        return false;
+                    }
+
+                    JogressConditionElement[] elements = new JogressConditionElement[]
+                    {
+                        new JogressConditionElement(PermanentCondition1, "a level 4 purple Digimon"),
+
+                        new JogressConditionElement(PermanentCondition2, "a level 4 red Digimon"),
+                    };
+
+                    JogressCondition jogressCondition = new JogressCondition(elements, 0);
+
+                    return jogressCondition;
+                }
+
+                return null;
+            }
+            }
+            
+            #endregion
+            #region On Play
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Return a card, DNA Digivolve into Imperialdramon", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[On Play] You may return 1 Digimon card with [Imperialdramon] in its name or the [Free] trait from your trash to the hand.";
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource){
+                    if (cardSource.EqualsTraits("Free") || cardSource.ContainsCardName("Imperialdramon")){
+                        return true;
+                    }
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
+                    {
+                        int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
+
+                        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                        selectCardEffect.SetUp(
+                            canTargetCondition: CanSelectCardCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            canNoSelect: () => true,
+                            selectCardCoroutine: null,
+                            afterSelectCardCoroutine: null,
+                            message: "Select 1 card to add to your hand.",
+                            maxCount: maxCount,
+                            canEndNotMax: false,
+                            isShowOpponent: true,
+                            mode: SelectCardEffect.Mode.AddHand,
+                            root: SelectCardEffect.Root.Trash,
+                            customRootCardList: null,
+                            canLookReverseCard: true,
+                            selectPlayer: card.Owner,
+                            cardEffect: activateClass);
+
+                        yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                    }
+                }
+            }
+            #endregion
+
+            #region When Digievolving
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Return a card, DNA Digivolve into Imperialdramon", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[On Play] [When Digivolving] You may return 1 Digimon card with [Imperialdramon] in its name or the [Free] trait from your trash to the hand. [All Turns] When any of your [Dinobeemon]/[Paildramon] would be returned to hands or decks, 2 of your Digimon may DNA digivolve into [Imperialdramon: Dragon Mode] in the hand.";
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource){
+                    if (cardSource.EqualsTraits("Free") || cardSource.ContainsCardName("Imperialdramon")){
+                        return true;
+                    }
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
+                    {
+                        int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
+
+                        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                        selectCardEffect.SetUp(
+                            canTargetCondition: CanSelectCardCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            canNoSelect: () => true,
+                            selectCardCoroutine: null,
+                            afterSelectCardCoroutine: null,
+                            message: "Select 1 card to add to your hand.",
+                            maxCount: maxCount,
+                            canEndNotMax: false,
+                            isShowOpponent: true,
+                            mode: SelectCardEffect.Mode.AddHand,
+                            root: SelectCardEffect.Root.Trash,
+                            customRootCardList: null,
+                            canLookReverseCard: true,
+                            selectPlayer: card.Owner,
+                            cardEffect: activateClass);
+
+                        yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                    }
+                }
+            }
+            #endregion
+               
+
+            #region All Turns
+            if(timing == EffectTiming.None){
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("If returned, DNA Digivolve", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetIsInheritedEffect(true);
+                activateClass.SetHashString("Dna Digivolve into Imperialdramon");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription(){
+                    return "[All Turns] When any of your [Dinobeemon]/[Paildramon] would be returned to hands or decks, 2 of your Digimon may DNA digivolve into [Imperialdramon: Dragon Mode] in the hand.";
+                }
+
+                bool isPaildramonOrDinoBeemon(Permanent permanent){
+                    
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                    {
+                        if(permanent.TopCard.EqualsCardName("Dinobeemon") || permanent.TopCard.EqualsCardName("Paildramon"))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                
+               
+                bool CanSelectDNACardCondition(CardSource cardSource)
+                {
+                    if (cardSource.IsDigimon)
+                    {
+                        if (cardSource.CanPlayJogress(true))
+                        {
+                            if (cardSource.EqualsCardName("Imperialdramon: Dragon Mode"))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                }
+
+                bool CanActivateCondition1(Hashtable hashtable)
+                {  
+                    if(CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, isPaildramonOrDinoBeemon)){                  
+                        if (CardEffectCommons.MatchConditionPermanentCount(isPaildramonOrDinoBeemon)>=2){
+                            return true;
+                        }
+                        return false;
+                    }
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    
+                    List<CardSource> selectedCards = new List<CardSource>();
+
+                    int maxCount = 1;
+
+                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                    selectHandEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: CanSelectDNACardCondition,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: maxCount,
+                        canNoSelect: true,
+                        canEndNotMax: false,
+                        isShowOpponent: true,
+                        selectCardCoroutine: SelectCardCoroutine,
+                        afterSelectCardCoroutine: null,
+                        mode: SelectHandEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectHandEffect.SetUpCustomMessage("Select 1 card to DNA digivolve.", "The opponent is selecting 1 card to DNA digivolve.");
+                    selectHandEffect.SetNotShowCard();
+
+                    yield return StartCoroutine(selectHandEffect.Activate());
+
+                    IEnumerator SelectCardCoroutine(CardSource cardSource)
+                    {
+                        selectedCards.Add(cardSource);
+
+                        yield return null;
+                    }
+
+                    if (selectedCards.Count >= 1)
+                    {
+                        foreach (CardSource selectedCard in selectedCards)
+                        {
+                            if (selectedCard.CanPlayJogress(true))
+                            {
+                                _jogressEvoRootsFrameIDs = new int[0];
+
+                                yield return GManager.instance.photonWaitController.StartWait("Dinobeemon_BT20_074");
+
+                                if (card.Owner.isYou || GManager.instance.IsAI)
+                                {
+                                    GManager.instance.selectJogressEffect.SetUp_SelectDigivolutionRoots
+                                                                (card: selectedCard,
+                                                                isLocal: true,
+                                                                isPayCost: true,
+                                                                canNoSelect: true,
+                                                                endSelectCoroutine_SelectDigivolutionRoots: EndSelectCoroutine_SelectDigivolutionRoots,
+                                                                noSelectCoroutine: null);
+
+                                    yield return ContinuousController.instance.StartCoroutine(GManager.instance.selectJogressEffect.SelectDigivolutionRoots());
+
+                                    IEnumerator EndSelectCoroutine_SelectDigivolutionRoots(List<Permanent> permanents)
+                                    {
+                                        if (permanents.Count == 2)
+                                        {
+                                            _jogressEvoRootsFrameIDs = permanents.Distinct().ToArray().Map(permanent => permanent.PermanentFrame.FrameID);
+                                        }
+
+                                        yield return null;
+                                    }
+
+                                    photonView.RPC("SetJogressEvoRootsFrameIDs", RpcTarget.All, _jogressEvoRootsFrameIDs);
+                                }
+
+                                else
+                                {
+                                    GManager.instance.commandText.OpenCommandText("The opponent is choosing a card to DNA digivolve.");
+                                }
+
+                                yield return new WaitWhile(() => !_endSelect);
+                                _endSelect = false;
+
+                                GManager.instance.commandText.CloseCommandText();
+                                yield return new WaitWhile(() => GManager.instance.commandText.gameObject.activeSelf);
+
+                                if (_jogressEvoRootsFrameIDs.Length == 2)
+                                {
+                                    yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { selectedCard }, "Played Card", true, true));
+
+                                    PlayCardClass playCard = new PlayCardClass(
+                                        cardSources: new List<CardSource>() { selectedCard },
+                                        hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
+                                        payCost: true,
+                                        targetPermanent: null,
+                                        isTapped: false,
+                                        root: SelectCardEffect.Root.Hand,
+                                        activateETB: true);
+
+                                    playCard.SetJogress(_jogressEvoRootsFrameIDs);
+
+                                    yield return ContinuousController.instance.StartCoroutine(playCard.PlayCard());
+                                }
+                            }
+                        }
+                    }
+                }
+
+                
+                
+                    
+                
+
+
+            }
+            #endregion
+
+            #region Inherited Effect
+            if (timing == EffectTiming.None)
+            {
+            DisableEffectClass invalidationClass = new DisableEffectClass();
+            invalidationClass.SetUpICardEffect("Ignore Security Effect", CanUseCondition, card);
+            invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
+            invalidationClass.SetIsInheritedEffect(true);
+            cardEffects.Add(invalidationClass);
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return true;
+                }
+
+                bool InvalidateCondition(ICardEffect cardEffect)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card) && cardEffect.EffectSourceCard != null && cardEffect.EffectSourceCard.IsOption && cardEffect.IsSecurityEffect && GManager.instance.attackProcess.AttackingPermanent == card.PermanentOfThisCard()) 
+                    {                                                           
+                        return true;                                            
+                    }
+                    return false;
+                }
+            }
+
+            #endregion    
+        return cardEffects;
+
+        }
+        private bool _endSelect = false;
+        private int[] _jogressEvoRootsFrameIDs = new int[0];
+
+        [PunRPC]
+        public void SetJogressEvoRootsFrameIDs(int[] JogressEvoRootsFrameIDs)
+        {
+            this._jogressEvoRootsFrameIDs = JogressEvoRootsFrameIDs;
+            _endSelect = true;
+        }
+    }
+}

+ 5 - 8
Assets/CardEffect/BT20/Red/BT20_016.cs

@@ -377,14 +377,11 @@ namespace DCGO.CardEffects.BT20
                 }
 
                 bool CanActivateCondition1(Hashtable hashtable)
-                {
-                    if (card.Owner.GetBattleAreaDigimons().Count < 2)
-                        return false;
-
-                    if (card.Owner.HandCards.Count(CanSelectDNACardCondition) < 1)
-                        return false;
-
-                    return true;
+                {                    
+                    if (CardEffectCommons.MatchConditionPermanentCount(isPaildramonOrDinoBeemon)>=2){
+                        return true;
+                    }
+                    return false;
                 }
 
                 IEnumerator ActivateCoroutine1(Hashtable hashtable)