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

Card fixes, player name save with filter

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

+ 35 - 22
Assets/CardEffect/BT17/Black/Armageddemon_BT17_060.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 
 namespace DCGO.CardEffects.BT17
@@ -233,10 +234,10 @@ namespace DCGO.CardEffects.BT17
 
                 bool CanSelectCardInTrash(CardSource source)
                 {
-                    if (source.EqualsCardName("Diaboromon"))
+                    if (source.HasText("Diaboromon"))
                         return true;
 
-                    if (source.CardTraits.Contains("Unidentified"))
+                    if (source.ContainsTraits("Unidentified"))
                         return true;
 
                     return false;
@@ -255,6 +256,28 @@ namespace DCGO.CardEffects.BT17
                     return false;
                 }
 
+                bool CanEndSelectCostCondition(List<CardSource> cardSources)
+                {
+                    if (card.BasePlayCostFromEntity - cardSources.Count > card.Owner.MaxMemoryCost)
+                        return false;
+
+                    return true;
+                }
+
+                bool CanNoSelect(CardSource cardSource)
+                {
+                    if (cardSource != null)
+                    {
+                        if (cardSource.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
+                        {
+                            return false;
+                        }
+                    }
+
+                    return true;
+                }
+
+
                 bool CanUseCondition(Hashtable hashtable)
                 {
                     if (CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition))
@@ -267,26 +290,16 @@ namespace DCGO.CardEffects.BT17
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.HasMatchConditionOpponentsCardInTrash(card, CanSelectCardInTrash);
+                    return CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
-                    if (CardEffectCommons.HasMatchConditionOpponentsCardInTrash(card, CanSelectCardInTrash))
-                    {
-                        bool CanNoSelect = true;
-                        List<CardSource> selectedCards = new List<CardSource>();
-
-                        CardSource Card = CardEffectCommons.GetCardFromHashtable(_hashtable);
-
-                        if (Card != null)
-                        {
-                            if (Card.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > Card.Owner.MaxMemoryCost)
-                            {
-                                CanNoSelect = false;
-                            }
-                        }
+                    bool canNoSelect = CanNoSelect(CardEffectCommons.GetCardFromHashtable(_hashtable));
+                    List<CardSource> selectedCards = new List<CardSource>();
 
+                    if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash))
+                    {
                         int maxCount = 13;
 
                         SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
@@ -294,13 +307,13 @@ namespace DCGO.CardEffects.BT17
                         selectCardEffect.SetUp(
                             canTargetCondition: CanSelectCardInTrash,
                             canTargetCondition_ByPreSelecetedList: null,
-                            canEndSelectCondition: null,
-                            canNoSelect: () => CanNoSelect,
+                            canEndSelectCondition: CanEndSelectCostCondition,
+                            canNoSelect: () => canNoSelect,
                             selectCardCoroutine: null,
                             afterSelectCardCoroutine: SelectCardCoroutine,
                             message: "Select up to 13 cards to bottom of deck.",
                             maxCount: maxCount,
-                            canEndNotMax: false,
+                            canEndNotMax: true,
                             isShowOpponent: true,
                             mode: SelectCardEffect.Mode.Custom,
                             root: SelectCardEffect.Root.Trash,
@@ -408,10 +421,10 @@ namespace DCGO.CardEffects.BT17
 
                 bool CanSelectCardInTrash(CardSource source)
                 {
-                    if (source.EqualsCardName("Diaboromon"))
+                    if (source.HasText("Diaboromon"))
                         return true;
 
-                    if (source.CardTraits.Contains("Unidentified"))
+                    if (source.ContainsTraits("Unidentified"))
                         return true;
 
                     return false;

+ 1 - 4
Assets/CardEffect/BT17/Black/DoomsdayClock_BT17_100.cs

@@ -244,10 +244,7 @@ namespace DCGO.CardEffects.BT17
 
                 bool CanSelectCardCondition(CardSource cardSource)
                 {
-                    if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
-                        return cardSource.EqualsCardName("Doomsday Clock");
-
-                    return false;
+                    return cardSource.EqualsCardName("Doomsday Clock");
                 }
 
                 bool CanUseCondition(Hashtable hashtable)

+ 6 - 3
Assets/CardEffect/BT17/Black/Infermon_BT17_055.cs

@@ -154,11 +154,14 @@ namespace DCGO.CardEffects.BT17
 
                 bool IsDiaboromon(Permanent permanent)
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    if(CardEffectCommons.IsOwnerPermanent(permanent, card))
                     {
-                        return permanent.TopCard.ContainsCardName("Diaboromon");
+                        if (permanent.IsDigimon)
+                        {
+                            return permanent.TopCard.ContainsCardName("Diaboromon");
+                        }
                     }
-
+                    
                     return false;
                 }
 

+ 1 - 1
Assets/CardEffect/BT17/Black/Keramon_BT17_053.cs

@@ -71,7 +71,7 @@ namespace DCGO.CardEffects.BT17
                             payCost: false,
                             reduceCostTuple: null,
                             fixedCostTuple: null,
-                            ignoreDigivolutionRequirementFixedCost: -1,
+                            ignoreDigivolutionRequirementFixedCost: 0,
                             isHand: true,
                             activateClass: activateClass,
                             successProcess: null));

+ 4 - 1
Assets/CardEffect/BT17/Black/Tsumemon_BT17_005.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Diagnostics;
 
 namespace DCGO.CardEffects.BT17
 {
@@ -15,6 +16,7 @@ namespace DCGO.CardEffects.BT17
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
                 activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
+                activateClass.SetIsInheritedEffect(true);
                 cardEffects.Add(activateClass);
 
                 string EffectDiscription()
@@ -31,7 +33,8 @@ namespace DCGO.CardEffects.BT17
                 {
                     if(CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
                     {
-                        return card.PermanentOfThisCard().TopCard.ContainsTraits("Unidentified");
+                        if(CardEffectCommons.CanActivateSelfOnDeletionWithContainingTrait(hashtable, "Unidentified", card))
+                            return true;
                     }
 
                     return false;

+ 1 - 2
Assets/CardEffect/BT17/Blue/KendoGarurumon_BT17_023.cs

@@ -22,8 +22,7 @@ namespace DCGO.CardEffects.BT17
 
                 bool PermanentCondition(Permanent targetPermanent)
                 {
-                    return targetPermanent.TopCard.EqualsCardName("Koji  Minamoto") ||
-                           targetPermanent.TopCard.EqualsCardName("KojiMinamoto");
+                    return targetPermanent.TopCard.EqualsCardName("Koji Minamoto");
                 }
 
                 cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(

+ 6 - 17
Assets/CardEffect/BT17/Blue/Strabimon_BT17_020.cs

@@ -126,18 +126,17 @@ namespace DCGO.CardEffects.BT17
 
                 bool CanSelectHandCardCondition(CardSource cardSource)
                 {
-                    if (cardSource.IsTamer)
+                    if (card.Owner.HandCards.Contains(cardSource))
                     {
-                        if (cardSource.HasInheritedEffect)
+                        if (cardSource.IsTamer)
                         {
-                            if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: true,
-                                    cardEffect: activateClass))
+                            if (cardSource.HasInheritedEffect)
                             {
                                 return true;
                             }
                         }
                     }
-
+                    
                     return false;
                 }
 
@@ -160,7 +159,7 @@ namespace DCGO.CardEffects.BT17
 
                     ChangeCostClass changeCostClass = new ChangeCostClass();
                     changeCostClass.SetUpICardEffect($"Play Cost -2", _ => true, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition,
+                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CanSelectHandCardCondition,
                         rootCondition: RootCondition, isUpDown: () => true, isCheckAvailability: () => false,
                         isChangePayingCost: () => true);
                     Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
@@ -178,7 +177,7 @@ namespace DCGO.CardEffects.BT17
 
                     int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
                     {
-                        if (CardSourceCondition(cardSource))
+                        if (CanSelectHandCardCondition(cardSource))
                         {
                             if (RootCondition(root))
                             {
@@ -202,16 +201,6 @@ namespace DCGO.CardEffects.BT17
                         return targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0;
                     }
 
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        if (cardSource.HasPlayCost)
-                        {
-                            return CanSelectHandCardCondition(cardSource);
-                        }
-
-                        return false;
-                    }
-
                     bool RootCondition(SelectCardEffect.Root root)
                     {
                         return true;

+ 31 - 23
Assets/CardEffect/BT17/Green/Antylamon_BT17_049.cs

@@ -65,7 +65,7 @@ namespace DCGO.CardEffects.BT17
                 {
                     if(CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
                     {
-                        if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanPlayCondition))
+                        if (CardEffectCommons.HasMatchConditionOpponentsCardInTrash(card, CanPlayCondition))
                         {
                             return true;
                         }
@@ -81,26 +81,30 @@ namespace DCGO.CardEffects.BT17
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+                    SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
 
-                    selectHandEffect.SetUp(
-                        selectPlayer: card.Owner,
+                    selectCardEffect.SetUp(
                         canTargetCondition: CanPlayCondition,
                         canTargetCondition_ByPreSelecetedList: null,
                         canEndSelectCondition: null,
+                        canNoSelect: () => true,
+                        selectCardCoroutine: null,
+                        afterSelectCardCoroutine: SelectCardCoroutine,
+                        message: "Select 1 card to play.",
                         maxCount: 1,
-                        canNoSelect: true,
                         canEndNotMax: false,
                         isShowOpponent: true,
-                        selectCardCoroutine: null,
-                        afterSelectCardCoroutine: SelectCardCoroutine,
-                        mode: SelectHandEffect.Mode.Custom,
+                        mode: SelectCardEffect.Mode.Custom,
+                        root: SelectCardEffect.Root.Trash,
+                        customRootCardList: null,
+                        canLookReverseCard: true,
+                        selectPlayer: card.Owner,
                         cardEffect: activateClass);
 
-                    selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
-                    selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
+                    selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
+                    selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
 
-                    yield return StartCoroutine(selectHandEffect.Activate());
+                    yield return StartCoroutine(selectCardEffect.Activate());
 
                     IEnumerator SelectCardCoroutine(List<CardSource> cardSources)
                     {
@@ -110,7 +114,7 @@ namespace DCGO.CardEffects.BT17
                                 activateClass: activateClass, 
                                 payCost: false, 
                                 isTapped: false, 
-                                root: SelectCardEffect.Root.Hand, 
+                                root: SelectCardEffect.Root.Trash, 
                                 activateETB: true));
                     }
                 }
@@ -208,26 +212,30 @@ namespace DCGO.CardEffects.BT17
 
                     IEnumerator SuccessProcess()
                     {
-                        SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+                        SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
 
-                        selectHandEffect.SetUp(
-                            selectPlayer: card.Owner,
+                        selectCardEffect.SetUp(
                             canTargetCondition: CanPlayCondition,
                             canTargetCondition_ByPreSelecetedList: null,
                             canEndSelectCondition: null,
+                            canNoSelect: () => true,
+                            selectCardCoroutine: null,
+                            afterSelectCardCoroutine: SelectCardCoroutine,
+                            message: "Select 1 card to play.",
                             maxCount: 1,
-                            canNoSelect: true,
                             canEndNotMax: false,
                             isShowOpponent: true,
-                            selectCardCoroutine: null,
-                            afterSelectCardCoroutine: SelectCardCoroutine,
-                            mode: SelectHandEffect.Mode.Custom,
+                            mode: SelectCardEffect.Mode.Custom,
+                            root: SelectCardEffect.Root.Trash,
+                            customRootCardList: null,
+                            canLookReverseCard: true,
+                            selectPlayer: card.Owner,
                             cardEffect: activateClass);
 
-                        selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
-                        selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
+                        selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
+                        selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
 
-                        yield return StartCoroutine(selectHandEffect.Activate());
+                        yield return StartCoroutine(selectCardEffect.Activate());
                     }
 
                     IEnumerator SelectCardCoroutine(List<CardSource> cardSources)
@@ -238,7 +246,7 @@ namespace DCGO.CardEffects.BT17
                                 activateClass: activateClass,
                                 payCost: false,
                                 isTapped: false,
-                                root: SelectCardEffect.Root.Hand,
+                                root: SelectCardEffect.Root.Trash,
                                 activateETB: true));
                     }
                 }

+ 8 - 5
Assets/CardEffect/BT17/Green/Argomon_BT17_048.cs

@@ -181,17 +181,20 @@ namespace DCGO.CardEffects.BT17
 
                 bool HasUnsuspendedRhythm(Permanent permanent)
                 {
-                    if (permanent.IsTamer)
+                    if(CardEffectCommons.IsOwnerPermanent(permanent, card))
                     {
-                        if (permanent.TopCard.EqualsCardName("Rhythm"))
+                        if (permanent.IsTamer)
                         {
-                            if (!permanent.IsSuspended)
+                            if (permanent.TopCard.EqualsCardName("Rhythm"))
                             {
-                                return true;
+                                if (!permanent.IsSuspended)
+                                {
+                                    return true;
+                                }
                             }
                         }
                     }
-
+                   
                     return false;
                 }
 

+ 1 - 1
Assets/CardEffect/BT17/Green/Terriermon_BT17_043.cs

@@ -15,7 +15,7 @@ namespace DCGO.CardEffects.BT17
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
                 activateClass.SetHashString("Suspend1_BT17_043");
                 cardEffects.Add(activateClass);
 

+ 4 - 1
Assets/CardEffect/BT17/Yellow/Kazuchimon_BT17_040.cs

@@ -163,7 +163,10 @@ namespace DCGO.CardEffects.BT17
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                    if(CardEffectCommons.IsOwnerTurn(card))
+                        return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+
+                    return false;
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)

+ 56 - 0
Assets/Scripts/CardEffectCommons/CanUseEffects/OnDeletion.cs

@@ -4,6 +4,7 @@ using System;
 using System.Linq;
 using UnityEngine;
 using UnityEditor.Rendering;
+using static UnityEngine.Rendering.DebugUI;
 
 public partial class CardEffectCommons
 {
@@ -210,6 +211,61 @@ public partial class CardEffectCommons
     }
     #endregion
 
+    #region Can activate [On Deletion] effect that can activate if the permanent conains specific trait
+    public static bool CanActivateSelfOnDeletionWithContainingTrait(Hashtable hashtable, string name, CardSource card)
+    {
+        return CanActivateOnDeletionWithContainingTrait(
+            hashtable: hashtable,
+            name: name,
+            cardCondition: cardSource => cardSource == card
+        );
+    }
+
+    public static bool CanActivateOnDeletionWithContainingTrait(
+        Hashtable hashtable,
+        string name,
+        Func<CardSource, bool> cardCondition)
+    {
+        List<Hashtable> hashtables = GetHashtablesFromHashtable(hashtable);
+        if (hashtables != null)
+        {
+            foreach (Hashtable hashtable1 in hashtables)
+            {
+                if (hashtable1 != null)
+                {
+                    List<CardSource> CardSources = GetCardSourcesFromHashtable(hashtable1);
+                    if (CardSources != null)
+                    {
+                        if (CardSources.Some(cardSource => cardCondition == null || cardCondition(cardSource)))
+                        {
+                            foreach (DictionaryEntry entry in hashtable1)
+                            {
+                                Debug.Log($"{entry.Key}, {entry.Value}");
+                            }
+                            if (hashtable1.ContainsKey("TopCard"))
+                            {
+                                if (hashtable1["TopCard"] is CardSource)
+                                {
+                                    CardSource topCard = (CardSource)hashtable1["TopCard"];
+                                    if (topCard != null)
+                                    {
+                                        if (topCard.ContainsTraits(name))
+                                        {
+                                            return true;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        Debug.Log("CAN ACTIVATE: Line 3");
+        return false;
+    }
+    #endregion
+
     #region Can activate [On Deletion] effect that can activate if the permanent has specific colors
     public static bool CanActivateSelfOnDeletionWithCardColors(Hashtable hashtable, Func<List<CardColor>, bool> cardColorCondition, CardSource card)
     {

+ 1 - 1
Assets/Scripts/ContinuousController.cs

@@ -478,7 +478,7 @@ public class ContinuousController : MonoBehaviour
 
         set
         {
-            _playerName = value;
+            _playerName = DeckData.ValidateDeckName(value);
         }
     }