Lewisaaronwelch 9 months ago
parent
commit
8b4c321fab

+ 4 - 2
Assets/CardEffect/BT23/Black/BT23_054.cs

@@ -43,7 +43,7 @@ namespace DCGO.CardEffects.BT23
 
             #region OP/WD Shared
 
-            bool SharedOpponentDigimon(Permanent permanent)
+            bool SharedOwnerDigimon(Permanent permanent)
             {
                 return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
                        (permanent.TopCard.HasRoyalKnightTraits || permanent.TopCard.HasCSTraits);
@@ -51,6 +51,8 @@ namespace DCGO.CardEffects.BT23
 
             IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
             {
+                yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
+
                 Permanent selectedPermanent = null;
 
                 #region Select Permanent
@@ -58,7 +60,7 @@ namespace DCGO.CardEffects.BT23
                 SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
                 selectPermanentEffect.SetUp(
                     selectPlayer: card.Owner,
-                    canTargetCondition: SharedOpponentDigimon,
+                    canTargetCondition: SharedOwnerDigimon,
                     canTargetCondition_ByPreSelecetedList: null,
                     canEndSelectCondition: null,
                     maxCount: 1,

+ 81 - 86
Assets/CardEffect/BT23/Black/BT23_057.cs

@@ -50,29 +50,10 @@ namespace DCGO.CardEffects.BT23
 
                 bool CardCondition(CardSource cardSource)
                 {
-                    if (cardSource == card)
-                    {
-                        if (CardEffectCommons.IsExistOnHand(cardSource))
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return cardSource == card;
                 }
 
-                bool CanNoSelect(CardSource cardSource)
-                {
-                    if (cardSource != null)
-                    {
-                        if (cardSource.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
-                        {
-                            return false;
-                        }
-                    }
-
-                    return true;
-                }
+                bool CanNoSelect(CardSource cardSource) => CardEffectCommons.UniversalRootCanNoSelectCondition(cardSource);
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
@@ -81,22 +62,14 @@ namespace DCGO.CardEffects.BT23
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnHand(card))
-                    {
-                        if (CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectReductionCardCondition) >= 3)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectReductionCardCondition) >= 3;
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
                     List<CardSource> selectedCards = new List<CardSource>();
 
-                    if (CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectReductionCardCondition) >= 6)
+                    if (CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectReductionCardCondition) >= 3)
                     {
                         bool noSelect = CanNoSelect(CardEffectCommons.GetCardFromHashtable(_hashtable));
 
@@ -111,7 +84,7 @@ namespace DCGO.CardEffects.BT23
                             canNoSelect: () => noSelect,
                             selectCardCoroutine: SelectCardCoroutine,
                             afterSelectCardCoroutine: null,
-                            message: "Select cards to add to the top your deck\n(cards will be placed back to the top of the deck so that cards with lower numbers are on top).",
+                            message: "Select cards to add to your deck\n(cards will be placed back to your deck so that cards with lower numbers are on top).",
                             maxCount: maxCount,
                             canEndNotMax: false,
                             isShowOpponent: true,
@@ -133,79 +106,98 @@ namespace DCGO.CardEffects.BT23
                         if (selectedCards.Count == 3)
                         {
                             selectedCards.Reverse();
-                            yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(selectedCards));
-                        }
-                    }
 
-                    if (card.Owner.CanReduceCost(null, card))
-                    {
-                        ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
-                    }
 
-                    ChangeCostClass changeCostClass = new ChangeCostClass();
-                    changeCostClass.SetUpICardEffect("Play Cost -1", CanUseCondition1, card);
-                    changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-                    card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
+                            List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
+                            {
+                                new SelectionElement<bool>(message: $"Top of deck", value : true, spriteIndex: 0),
+                                new SelectionElement<bool>(message: $"Bottom of deck", value : false, spriteIndex: 1),
+                            };
 
-                    bool CanUseCondition1(Hashtable hashtable)
-                    {
-                        return true;
-                    }
+                            string selectPlayerMessage = "Return cards to top or bottom of deck?";
+                            string notSelectPlayerMessage = "The opponent is choosing to return cards to top or bottom of deck.";
 
-                    int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-                    {
-                        if (CardSourceCondition(cardSource))
-                        {
-                            if (RootCondition(root))
+                            GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
+                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+
+                            bool topOfDeck = GManager.instance.userSelectionManager.SelectedBoolValue;
+                            if (topOfDeck)
+                                yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(selectedCards));
+                            else
+                                yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(selectedCards));
+
+                            if (card.Owner.CanReduceCost(null, card))
+                            {
+                                ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
+                            }
+
+                            ChangeCostClass changeCostClass = new ChangeCostClass();
+                            changeCostClass.SetUpICardEffect("Play Cost -1", CanUseCondition1, card);
+                            changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
+                            card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
+
+                            bool CanUseCondition1(Hashtable hashtable)
                             {
-                                if (PermanentsCondition(targetPermanents))
+                                return true;
+                            }
+
+                            int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
+                            {
+                                if (CardSourceCondition(cardSource))
                                 {
-                                    int targetCost = 0;
+                                    if (RootCondition(root))
+                                    {
+                                        if (PermanentsCondition(targetPermanents))
+                                        {
+                                            int targetCost = 0;
+
+                                            if (selectedCards.Count >= 3)
+                                                targetCost += 5;
+
+                                            Cost -= targetCost;
+                                        }
+                                    }
+                                }
 
-                                    if (selectedCards.Count >= 3)
-                                        targetCost += 5;
+                                return Cost;
+                            }
 
-                                    Cost -= targetCost;
+                            bool PermanentsCondition(List<Permanent> targetPermanents)
+                            {
+                                if (targetPermanents == null)
+                                {
+                                    return true;
+                                }
+                                else
+                                {
+                                    if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
+                                    {
+                                        return true;
+                                    }
                                 }
+
+                                return false;
                             }
-                        }
 
-                        return Cost;
-                    }
+                            bool CardSourceCondition(CardSource cardSource)
+                            {
+                                return cardSource == card;
+                            }
 
-                    bool PermanentsCondition(List<Permanent> targetPermanents)
-                    {
-                        if (targetPermanents == null)
-                        {
-                            return true;
-                        }
-                        else
-                        {
-                            if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
+                            bool RootCondition(SelectCardEffect.Root root)
                             {
                                 return true;
                             }
-                        }
-
-                        return false;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        return cardSource == card;
-                    }
 
-                    bool RootCondition(SelectCardEffect.Root root)
-                    {
-                        return true;
-                    }
+                            bool isUpDown()
+                            {
+                                return true;
+                            }
 
-                    bool isUpDown()
-                    {
-                        return true;
+                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
+                        }
                     }
 
-                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
                 }
             }
 
@@ -305,6 +297,7 @@ namespace DCGO.CardEffects.BT23
             #endregion
 
             #region OP/WD Shared
+
             string SharedEffectDiscription(string tag)
             {
                 return $"[{tag}] You may play 1 [Hinukamuy] Token. (Digimon/White/6000 DP/<Alliance> <Reboot> <Blocker>) Then, delete 1 of your opponent's Digimon with a play cost of 6 or less. For each of your other Digimon, add 3 to this effect's play cost maximum.";
@@ -370,6 +363,7 @@ namespace DCGO.CardEffects.BT23
             #endregion
 
             #region On Play
+
             if (timing == EffectTiming.OnEnterFieldAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();
@@ -386,6 +380,7 @@ namespace DCGO.CardEffects.BT23
             #endregion
 
             #region When Digivolving
+
             if (timing == EffectTiming.OnEnterFieldAnyone)
             {
                 ActivateClass activateClass = new ActivateClass();

+ 1 - 2
Assets/CardEffect/BT23/Blue/BT23_024.cs

@@ -315,8 +315,7 @@ namespace DCGO.CardEffects.BT23
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
-                           CardEffectCommons.IsOwnerTurn(card) &&
-                           card.PermanentOfThisCard().CanUnsuspend && 
+                           card.PermanentOfThisCard().CanUnsuspend &&
                            card.PermanentOfThisCard().IsSuspended;
                 }
 

+ 1 - 1
Assets/CardEffect/BT23/Red/BT23_009.cs

@@ -47,7 +47,7 @@ namespace DCGO.CardEffects.BT23
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("1 digimon gains 4K DP", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
                 activateClass.SetHashString("BT23-009_WL");
                 cardEffects.Add(activateClass);
 

+ 17 - 3
Assets/Scripts/CardEffectCommons/GameContextDeterminarion.cs

@@ -1,8 +1,6 @@
-using System.Collections;
-using System.Collections.Generic;
 using System;
+using System.Collections.Generic;
 using System.Linq;
-using UnityEngine;
 
 public partial class CardEffectCommons
 {
@@ -744,4 +742,20 @@ public partial class CardEffectCommons
     }
 
     #endregion
+
+    #region Universial Root Can No Select Condition
+
+    public static bool UniversalRootCanNoSelectCondition(CardSource cardSource)
+    {
+        if (cardSource.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) return false;
+        if (cardSource.PayingCost(SelectCardEffect.Root.Trash, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) return false;
+        if (cardSource.PayingCost(SelectCardEffect.Root.DigivolutionCards, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) return false;
+        if (cardSource.PayingCost(SelectCardEffect.Root.Library, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) return false;
+        if (cardSource.PayingCost(SelectCardEffect.Root.DigivolutionCards, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) return false;
+        if (cardSource.PayingCost(SelectCardEffect.Root.LinkedCards, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) return false;
+        if (cardSource.PayingCost(SelectCardEffect.Root.Security, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost) return false;
+        return true;
+    }
+
+    #endregion
 }