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

fixed issue with Bryweludramon, added blast DNA to ragnaloardmon, added blast DNA, profanity list update

mbunch_kascope 2 лет назад
Родитель
Сommit
3ba3d4be13

+ 31 - 25
Assets/CardEffect/EX6/Black/BryweLudramon_EX6_044.cs

@@ -263,41 +263,47 @@ namespace DCGO.CardEffects.EX6
             #region Opponent's Turn - ESS
             if (timing == EffectTiming.None)
             {
-                Permanent selectedPermanent = card.PermanentOfThisCard();
-
-                CanNotBeRemovedClass canNotBeRemovedClass = new CanNotBeRemovedClass();
-                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);
-
-                bool CanUseProtectionCondition(Hashtable hashtable)
+                if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
+                    if(card.PermanentOfThisCard().TopCard != card)
                     {
-                        if (selectedPermanent.TopCard.CardNames.Contains("Ragnalordmon"))
+                        Permanent selectedPermanent = card.PermanentOfThisCard();
+
+                        CanNotBeRemovedClass canNotBeRemovedClass = new CanNotBeRemovedClass();
+                        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);
+
+                        bool CanUseProtectionCondition(Hashtable hashtable)
                         {
-                            if (!CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card)))
+                            if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
                             {
-                                return true;
+                                if (selectedPermanent.TopCard.CardNames.Contains("Ragnalordmon"))
+                                {
+                                    if (!CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card)))
+                                    {
+                                        return true;
+                                    }
+                                }
                             }
-                        }
-                    }
 
-                    return true;
-                }
+                            return true;
+                        }
 
-                bool PermanentCondition(Permanent permanent)
-                {
-                    if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
-                    {
-                        if (permanent == selectedPermanent)
+                        bool PermanentCondition(Permanent permanent)
                         {
-                            return true;
+                            if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
+                            {
+                                if (permanent == selectedPermanent)
+                                {
+                                    return true;
+                                }
+                            }
+
+                            return false;
                         }
                     }
-
-                    return false;
                 }
             }
             #endregion

+ 6 - 2
Assets/CardEffect/EX6/Red/RagnaLoardmonAce_EX6_011.cs

@@ -11,11 +11,15 @@ namespace DCGO.CardEffects.EX6
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
             
-            #region Blast Digivolve
+            #region Blast DNA Digivolve
             
             if (timing == EffectTiming.OnCounterTiming)
             {
-                cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
+                List<BlastDNACondition> blastDNAConditions = new List<BlastDNACondition>();
+                blastDNAConditions.Add(new BlastDNACondition("Durandamon"));
+                blastDNAConditions.Add(new BlastDNACondition("Bryweludramon"));
+
+                cardEffects.Add(CardEffectFactory.BlastDNADigivolveEffect(card: card, blastDNAConditions: blastDNAConditions, condition: null));
             }
             
             #endregion

+ 259 - 0
Assets/Scripts/CardEffectFactory/KeyWordEffects/BlastDNADigivolution.cs

@@ -0,0 +1,259 @@
+using System.Collections;
+using System.Collections.Generic;
+using System;
+using System.Linq;
+using UnityEngine;
+using Photon.Pun;
+
+public class BlastDNACondition
+{
+    public string Name;
+    public List<Permanent> Permanents;
+    public List<CardSource> CardSources;
+
+    public BlastDNACondition(string name)
+    {
+        Name = name;
+        Permanents = new List<Permanent>();
+        CardSources = new List<CardSource>();
+    }
+}
+
+public partial class CardEffectFactory
+{
+    #region Trigger effect of [Blast DNA Digivolve]
+    public static ActivateClass BlastDNADigivolveEffect(CardSource card, List<BlastDNACondition> blastDNAConditions, Func<bool> condition)
+    {
+        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> permanentSources = card.Owner.GetBattleAreaDigimons()
+                    .Clone()
+                    .Filter(permanent => permanent.TopCard.ContainsCardName(blastDNAConditions[0].Name)
+                                      || permanent.TopCard.ContainsCardName(blastDNAConditions[1].Name));
+
+        List<CardSource> handSources = card.Owner.HandCards
+                    .Clone()
+                    .Filter(cardSource => cardSource.ContainsCardName(blastDNAConditions[0].Name)
+                                       || cardSource.ContainsCardName(blastDNAConditions[1].Name));
+
+        ActivateClass activateClass = new ActivateClass();
+        activateClass.SetUpICardEffect("Blast DNA Digivolve", CanUseCondition, card);
+        activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, DataBase.BlastDNADigivolveEffectDiscription());
+        activateClass.SetIsCounterEffect(true);
+
+        bool CanSelectPermanent(Permanent permanent)
+        {
+            return permanentSources.Contains(permanent);
+        }
+
+        bool CanSelectHandSource(CardSource cardSource)
+        {
+            return handSources.Contains(cardSource);
+        }
+
+        bool CanUseCondition(Hashtable hashtable)
+        {
+            Debug.Log($"CAN USE: {CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, permanent => CardEffectCommons.IsOpponentPermanent(permanent, card))}");
+            if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, permanent => CardEffectCommons.IsOpponentPermanent(permanent, card)))
+            {
+                Debug.Log($"CAN USE: {card.Owner.HandCards.Contains(card)}");
+                if (card.Owner.HandCards.Contains(card))
+                {
+                    if (condition == null || condition())
+                    {
+                        Debug.Log($"CAN USE: TRUE");
+                        return true;
+                    }
+                }
+            }
+
+            return false;
+        }
+
+        bool CanActivateCondition(Hashtable hashtable)
+        {
+            Debug.Log($"CAN ACTIVATE: {card.Owner.HandCards.Contains(card)}");
+            if (card.Owner.HandCards.Contains(card))
+            {
+                Debug.Log($"CAN ACTIVATE: {CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanent)}");
+                if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanent))
+                {
+                    if (condition == null || condition())
+                    {
+                        Debug.Log($"CAN ACTIVATE: TRUE");
+                        return true;
+                    }
+                }
+            }
+
+            return false;
+        }
+
+        IEnumerator ActivateCoroutine(Hashtable _hashtable)
+        {
+            Permanent selectedPermanent = null;
+            CardSource selectedCardSource = null;
+
+            /*permanentSources.ForEach(permanent =>
+            {
+                if (permanent.TopCard.ContainsCardName(blastDNAConditions[0].Name))
+                    blastDNAConditions[0].Permanents.Add(permanent);
+
+                if (permanent.TopCard.ContainsCardName(blastDNAConditions[1].Name))
+                    blastDNAConditions[1].Permanents.Add(permanent);
+            });
+
+            handSources.ForEach(cardSource =>
+            {
+                if (cardSource.ContainsCardName(blastDNAConditions[0].Name))
+                    blastDNAConditions[0].CardSources.Add(cardSource);
+
+                if (cardSource.ContainsCardName(blastDNAConditions[1].Name))
+                    blastDNAConditions[1].CardSources.Add(cardSource);
+            });*/
+            Debug.Log("ACTIVATE COROUTINE");
+
+            yield return null;
+            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;
+
+                Debug.Log($"BLAST DNA: Selected Permanent: {selectedPermanent}");
+
+                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);
+
+                selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to DNA digivolve.", "The opponent is selecting 1 Digimon to DNA digivolve.");
+
+                yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
+
+                yield return null;
+            }
+
+            IEnumerator SelectCardCoroutine(CardSource cardSource)
+            {
+                selectedCardSource = cardSource;
+
+                Debug.Log($"BLAST DNA: Selected Cardsource: {selectedCardSource}");
+
+                PlayCardClass playCardClass = new PlayCardClass(
+                        cardSources: new List<CardSource>() { selectedCardSource },
+                        hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
+                        payCost: false,
+                        targetPermanent: null,
+                        isTapped: false,
+                        root: SelectCardEffect.Root.Hand,
+                        activateETB: false);
+
+                yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
+
+                yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { card }, "Played Card", true, true));
+
+                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());
+            }
+
+            #region Blast Digivolve
+            /*Permanent selectedPermanent = null;
+
+            int maxCount = 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: maxCount,
+                canNoSelect: false,
+                canEndNotMax: false,
+                selectPermanentCoroutine: SelectPermanentCoroutine,
+                afterSelectPermanentCoroutine: null,
+                mode: SelectPermanentEffect.Mode.Custom,
+                cardEffect: activateClass);
+
+            selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "The opponent is selecting 1 Digimon to digivolve.");
+
+            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+            IEnumerator SelectPermanentCoroutine(Permanent permanent)
+            {
+                selectedPermanent = permanent;
+
+                yield return null;
+            }
+
+            if (selectedPermanent != null)
+            {
+                if (card.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, false, activateClass))
+                {
+                    PlayCardClass playCardClass = new PlayCardClass(
+                        cardSources: new List<CardSource>() { card },
+                        hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
+                        payCost: false,
+                        targetPermanent: selectedPermanent,
+                        isTapped: false,
+                        root: SelectCardEffect.Root.Hand,
+                        activateETB: true);
+
+                    yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
+                }
+            }*/
+            #endregion
+        }
+
+        return activateClass;
+    }
+    #endregion
+
+}

+ 11 - 0
Assets/Scripts/CardEffectFactory/KeyWordEffects/BlastDNADigivolution.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 01922fb0f5402a542abd0e589ea28edc
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 7 - 0
Assets/Scripts/CardEffectInterfaces.cs

@@ -404,6 +404,13 @@ public interface IAddJogressLevelsEffect
 }
 #endregion
 
+#region "Add names for DNA digivolution" effect
+public interface IAddDNANamesEffect
+{
+    List<string> GetDNANames(CardSource cardSource, Permanent permanent);
+}
+#endregion
+
 #region "Change the min memory to end turn" effect
 public interface IChangeEndTurnMinMemoryEffect
 {

+ 5 - 0
Assets/Scripts/DataBase.cs

@@ -499,6 +499,11 @@ public class DataBase : MonoBehaviour
         return "[Hand] [Counter] <Blast Digivolve> (Your Digimon may digivolve into this card without paying the cost).";
     }
 
+    public static string BlastDNADigivolveEffectDiscription()
+    {
+        return "[Hand] [Counter] <Blast DNA Digivolve> (One of your specified Digimon and 1 of the specified card in the hand may DNA Digivolve into this card.)";
+    }
+
     public static string FortitudeEffectDiscription()
     {
         return "<Fortitude> (When this Digimon with digivolution cards is deleted, play this card without paying the cost).";

+ 61 - 4
Assets/Scripts/Permanent.cs

@@ -3,6 +3,8 @@ using System.Collections.Generic;
 using UnityEngine;
 using System;
 using System.Linq;
+using static Cinemachine.DocumentationSortingAttribute;
+
 public class Permanent
 {
     public Permanent(List<CardSource> cardSources)
@@ -2507,7 +2509,7 @@ public class Permanent
     }
     #endregion
 
-    #region ジョグレスで扱うレベル
+    #region Levels handled by Jogress
     public List<int> Levels_ForJogress(CardSource cardSource)
     {
         List<int> levels = new List<int>();
@@ -2519,12 +2521,12 @@ public class Permanent
                 levels.Add(this.Level);
             }
 
-            #region "ジョグレス進化で扱うレベルを追加する"効果
+            #region Effect of "adding levels handled by jogless evolution"
             foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
             {
                 foreach (Permanent permanent in player.GetFieldPermanents())
                 {
-                    #region 場のパーマネントの効果
+                    #region Effects of permanents in play
                     foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
                     {
                         if (cardEffect is IAddJogressLevelsEffect)
@@ -2541,7 +2543,7 @@ public class Permanent
                     #endregion
                 }
 
-                #region プレイヤーの効果
+                #region player effect
                 foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
                 {
                     if (cardEffect is IAddJogressLevelsEffect)
@@ -2564,6 +2566,61 @@ public class Permanent
     }
     #endregion
 
+    #region Names handled by Jogress
+    public List<string> Names_ForDNA(CardSource cardSource)
+    {
+        List<string> names = new List<string>();
+
+        if (cardSource != null)
+        {
+            foreach(string name in cardSource.CardNames)
+                names.Add(name);
+
+            #region Effect of "adding names handled by DNA evolution"
+            foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
+            {
+                foreach (Permanent permanent in player.GetFieldPermanents())
+                {
+                    #region Effects of permanents in play
+                    foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
+                    {
+                        if (cardEffect is IAddDNANamesEffect)
+                        {
+                            if (cardEffect.CanUse(null))
+                            {
+                                foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
+                                {
+                                    names.Add(name);
+                                }
+                            }
+                        }
+                    }
+                    #endregion
+                }
+
+                #region player effect
+                foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
+                {
+                    if (cardEffect is IAddDNANamesEffect)
+                    {
+                        if (cardEffect.CanUse(null))
+                        {
+                            foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
+                            {
+                                names.Add(name);
+                            }
+                        }
+                    }
+                }
+                #endregion
+            }
+            #endregion
+        }
+
+        return names;
+    }
+    #endregion
+
     #region バトルで消滅したか
     public bool IsDestroyedByBattle { get; set; } = false;
     #endregion

+ 2 - 0
Assets/Scripts/ProfanityFilter/ProfanityList.cs

@@ -1082,6 +1082,8 @@ namespace ProfanityFilter
              "neonazi",
              "nig nog",
              "nigaboo",
+             "nigg",
+             "n1gg",
              "nigg3r",
              "nigg4h",
              "nigga",