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

bryweludramon, blast DNA fixes, removed mega digimon assembly

mbunch_kascope 2 лет назад
Родитель
Сommit
53f3a2d17f

+ 14 - 5
Assets/CardEffect/EX6/Black/BryweLudramon_EX6_044.cs

@@ -273,13 +273,15 @@ namespace DCGO.CardEffects.EX6
                         canNotBeRemovedClass.SetUpICardEffect("Can't leave battle area except by deletion effect", CanUseProtectionCondition, card);
                         canNotBeRemovedClass.SetUpCanNotBeRemovedClass(permanentCondition: PermanentCondition);
                         canNotBeRemovedClass.SetIsInheritedEffect(true);
-                        selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotBeRemovedClass);
+
+                        if(!cardEffects.Contains(canNotBeRemovedClass))
+                            cardEffects.Add(canNotBeRemovedClass);
 
                         bool CanUseProtectionCondition(Hashtable hashtable)
                         {
-                            if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
+                            if (CardEffectCommons.IsOpponentTurn(card))
                             {
-                                if (selectedPermanent.TopCard.CardNames.Contains("Ragnalordmon"))
+                                if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
                                 {
                                     if (!CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card)))
                                     {
@@ -293,11 +295,18 @@ namespace DCGO.CardEffects.EX6
 
                         bool PermanentCondition(Permanent permanent)
                         {
+
                             if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
                             {
-                                if (permanent == selectedPermanent)
+                                if (permanent == selectedPermanent) 
                                 {
-                                    return true;
+                                    if (selectedPermanent.TopCard != card)
+                                    {
+                                        if (selectedPermanent.TopCard.CardNames.Contains("RagnaLoardmon"))
+                                        {
+                                            return true;
+                                        }
+                                    }
                                 }
                             }
 

+ 272 - 39
Assets/CardEffect/EX6/White/Mega_Digimon_Assembly_EX6_072.cs

@@ -24,7 +24,7 @@ namespace DCGO.CardEffects.EX6
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent.TopCard.Level == 6) >= 1)
+                    if (card.Owner.Enemy.GetBattleAreaDigimons().Count((permanent) => permanent.TopCard.Level == 6) >= 1)
                     {
                         return true;
                     }
@@ -47,7 +47,249 @@ namespace DCGO.CardEffects.EX6
             #region Main
             if (timing == EffectTiming.OptionSkill)
             {
-                
+                //COPY from blast DNA
+                /*if (card == null) return null;
+                if (!CardEffectCommons.IsExistOnHand(card)) return null;
+                if (card.Owner.GetBattleAreaPermanents().Count == 0) return null;
+                if (card.Owner.HandCards.Count < 2) return null;
+
+                List<Permanent> fieldPermanents = card.Owner.GetBattleAreaDigimons();
+                List<Permanent> permanentSources = new List<Permanent>();
+                List<CardSource> handSources = new List<CardSource>();
+
+                foreach (BlastDNACondition DNACondition in blastDNAConditions)
+                {
+                    DNACondition.Permanents = fieldPermanents.Filter(permanent => permanent.TopCard.ContainsCardName(DNACondition.Name));
+                    DNACondition.CardSources = card.Owner.HandCards.Filter(cardSource => cardSource.ContainsCardName(DNACondition.Name));
+
+                    permanentSources.AddRange(DNACondition.Permanents);
+                    handSources.AddRange(DNACondition.CardSources);
+                }
+
+                FilterDNAPermanents();
+                FilterDNAHandSources();
+
+                void FilterDNAPermanents()
+                {
+                    if (blastDNAConditions[0].Permanents.Count == 1)
+                        blastDNAConditions[1].Permanents = blastDNAConditions[0].Permanents.Except(blastDNAConditions[1].Permanents).ToList();
+
+                    if (blastDNAConditions[1].Permanents.Count == 1)
+                        blastDNAConditions[0].Permanents = blastDNAConditions[1].Permanents.Except(blastDNAConditions[0].Permanents).ToList();
+                }
+
+                void FilterDNAHandSources()
+                {
+                    if (blastDNAConditions[0].CardSources.Count == 1)
+                        blastDNAConditions[1].CardSources = blastDNAConditions[0].CardSources.Except(blastDNAConditions[1].CardSources).ToList();
+
+                    if (blastDNAConditions[1].CardSources.Count == 1)
+                        blastDNAConditions[0].CardSources = blastDNAConditions[1].CardSources.Except(blastDNAConditions[0].CardSources).ToList();
+                }
+
+                bool HasValidDNATargets()
+                {
+                    if (blastDNAConditions[0].Permanents.Count > 0 && blastDNAConditions[1].CardSources.Count > 0)
+                        return true;
+
+                    if (blastDNAConditions[0].CardSources.Count > 0 && blastDNAConditions[1].Permanents.Count > 0)
+                        return true;
+
+                    return false;
+                }*/
+
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("DNA Digivolve", CanUseCondition, card);
+                activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, DataBase.BlastDNADigivolveEffectDiscription());
+
+                bool HasLevel7WithDNA(CardSource cardSource)
+                {
+                    if (cardSource.IsDigimon)
+                    {
+                        if(cardSource.HasLevel && cardSource.Level == 7)
+                        {
+                            if (cardSource.jogressCondition != null)
+                                return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool HasLevel6HandSource(CardSource cardSource)
+                {
+                    if (cardSource.IsDigimon)
+                    {
+                        if (cardSource.HasLevel && cardSource.Level == 6)
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool HasLevel6Permanent(Permanent permanent)
+                {
+                    if (permanent.IsDigimon)
+                    {
+                        if (permanent.TopCard.HasLevel && permanent.Level == 6)
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if(CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card))
+                    {
+                        if(CardEffectCommons.HasMatchConditionOwnersHand(card, HasLevel7WithDNA))
+                        {
+                            if(CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasLevel6Permanent))
+                            {
+                                if (CardEffectCommons.HasMatchConditionOwnersHand(card, HasLevel6HandSource))
+                                {
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable _hashtable)
+                {
+                    CardSource selectedLevel7 = null;
+                    Permanent selectedPermanent = null;
+                    CardSource selectedCardSource = null;
+
+                    int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, HasLevel7WithDNA));
+
+                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                    selectHandEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: HasLevel7WithDNA,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: maxCount,
+                        canNoSelect: false,
+                        canEndNotMax: false,
+                        isShowOpponent: true,
+                        selectCardCoroutine: SelectDNACoroutine,
+                        afterSelectCardCoroutine: null,
+                        mode: SelectHandEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectHandEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+
+                    IEnumerator SelectDNACoroutine(CardSource cardSource)
+                    {
+                        selectedLevel7 = cardSource;
+
+                        yield return null;
+                    }
+
+                    //COpy from Blast DNA
+                    /*
+                    int maxCount = Math.Min(1, permanentSources.Count);
+
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                    selectPermanentEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: CanSelectPermanent,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: maxCount,
+                        canNoSelect: false,
+                        canEndNotMax: false,
+                        selectPermanentCoroutine: SelectPermanentCoroutine,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                    IEnumerator SelectPermanentCoroutine(Permanent permanent)
+                    {
+                        selectedPermanent = permanent;
+
+                        foreach (string name in selectedPermanent.TopCard.CardNames)
+                        {
+                            handSources = handSources.Filter(source => !source.ContainsCardName(name));
+                        }
+
+                        maxCount = Math.Min(1, handSources.Count);
+
+                        SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                        selectHandEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectHandSource,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: maxCount,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            isShowOpponent: true,
+                            selectCardCoroutine: SelectCardCoroutine,
+                            afterSelectCardCoroutine: null,
+                            mode: SelectHandEffect.Mode.Custom,
+                            cardEffect: activateClass);
+
+                        selectHandEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve.");
+
+                        yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+                    }
+
+                    IEnumerator SelectCardCoroutine(CardSource cardSource)
+                    {
+                        selectedCardSource = cardSource;
+
+                        Permanent playedPermanent;
+                        int frameID = -1;
+
+                        foreach (FieldCardFrame fieldCardFrame in selectedCardSource.Owner.fieldCardFrames)
+                        {
+                            if (card.CanPlayCardTargetFrame(fieldCardFrame, false, null))
+                            {
+                                if (fieldCardFrame.IsEmptyFrame())
+                                {
+                                    frameID = fieldCardFrame.FrameID;
+                                    break;
+                                }
+                            }
+                        }
+
+                        if (0 <= frameID && frameID < card.Owner.fieldCardFrames.Count)
+                        {
+                            playedPermanent = new Permanent(new List<CardSource>() { selectedCardSource }) { IsSuspended = false };
+
+                            yield return ContinuousController.instance.StartCoroutine(CardObjectController.CreateNewPermanent(playedPermanent, frameID));
+                        }
+
+                        int[] JogressEvoRootsFrameIDs = { selectedPermanent.PermanentFrame.FrameID, selectedCardSource.PermanentOfThisCard().PermanentFrame.FrameID };
+
+                        PlayCardClass playCard = new PlayCardClass(
+                            cardSources: new List<CardSource>() { card },
+                            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
 
@@ -66,17 +308,11 @@ namespace DCGO.CardEffects.EX6
 
                 bool CanSelectCardCondition(CardSource cardSource)
                 {
-                    if (cardSource != null)
+                    if (cardSource.IsDigimon)
                     {
-                        if (cardSource.IsDigimon)
+                        if (cardSource.HasLevel && cardSource.Level == 6)
                         {
-                            if (cardSource.Owner == card.Owner)
-                            {
-                                if (cardSource.HasLevel && cardSource.Level == 6)
-                                {
-                                    return true;
-                                }
-                            }
+                            return true;
                         }
                     }
 
@@ -103,37 +339,34 @@ namespace DCGO.CardEffects.EX6
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
-                    if (isExistOnField(card))
+                    if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
                     {
-                        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: () => false,
-                                selectCardCoroutine: null,
-                                afterSelectCardCoroutine: null,
-                                message: "Select 1 Digimon 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());
-                        }
+                        int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
 
-                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
+                        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                        selectCardEffect.SetUp(
+                            canTargetCondition: CanSelectCardCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            canNoSelect: () => false,
+                            selectCardCoroutine: null,
+                            afterSelectCardCoroutine: null,
+                            message: "Select 1 Digimon 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());
                     }
+
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
                 }
             }        
             #endregion

+ 1 - 1
Assets/Editor/AttachCardData.cs

@@ -12,7 +12,7 @@ public class AttachCardData : MonoBehaviour
     {
         List<CEntity_Base> List = GetAsset.LoadAll<CEntity_Base>("Assets/CardBaseEntity/");
 
-        List<string> UnimplementedCardSpriteNames = new List<string>() { "P-147", "P-137", "P-138", "P-139", "P-140", "P-141", "P-142" };
+        List<string> UnimplementedCardSpriteNames = new List<string>() { "P-147", "P-137", "P-138", "P-139", "P-140", "P-141", "P-142", "EX6-072" };
 
         foreach (GameObject obj in Selection.gameObjects)
         {

+ 7 - 0
Assets/Scripts/CardEffectCommons/GameContextDeterminarion.cs

@@ -368,6 +368,13 @@ public partial class CardEffectCommons
     }
     #endregion
 
+    #region How many cards there are in the owner's hand that satisfy the condition
+    public static int MatchConditionOwnersCardCountInHand(CardSource card, Func<CardSource, bool> CanSelectCardCondition)
+    {
+        return card.Owner.HandCards.Count(CanSelectCardCondition);
+    }
+    #endregion
+
     #region Whether there is at least 1 permanent in the owner's Battle Area that satisfies the condition
     public static bool HasMatchConditionOwnersPermanent(CardSource card, Func<Permanent, bool> CanSelectPermanentCondition)
     {

+ 21 - 13
Assets/Scripts/CardEffectFactory/KeyWordEffects/BlastDNADigivolution.cs

@@ -177,7 +177,7 @@ public partial class CardEffectFactory
                     mode: SelectHandEffect.Mode.Custom,
                     cardEffect: activateClass);
 
-                selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve.");
+                selectHandEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve.");
 
                 yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
             }
@@ -210,18 +210,26 @@ public partial class CardEffectFactory
                 
                 int[] JogressEvoRootsFrameIDs = { selectedPermanent.PermanentFrame.FrameID, selectedCardSource.PermanentOfThisCard().PermanentFrame.FrameID };
 
-                PlayCardClass playCard = new PlayCardClass(
-                    cardSources: new List<CardSource>() { card },
-                    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());
+                if (card.CanPlayJogress(true))
+                {
+                    PlayCardClass playCard = new PlayCardClass(
+                        cardSources: new List<CardSource>() { card },
+                        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());
+                }
+                else
+                {
+                    yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCard(selectedCardSource, false));
+                }
+                
             }
         }
 

+ 1 - 1
Assets/Scripts/CardObjectController.cs

@@ -601,7 +601,7 @@ public class CardObjectController : MonoBehaviour
         }
     }
 
-    static IEnumerator AddHandCard(CardSource cardSource, bool isDraw)
+    public static IEnumerator AddHandCard(CardSource cardSource, bool isDraw)
     {
         cardSource.Init();
         cardSource.SetFace();