Jelajahi Sumber

Update AD1-024 show player if card was played by effect

hooperk 4 bulan lalu
induk
melakukan
d4f921715d
1 mengubah file dengan 94 tambahan dan 59 penghapusan
  1. 94 59
      Assets/Scripts/CardEffect/AD1/Blue/AD1_024.cs

+ 94 - 59
Assets/Scripts/CardEffect/AD1/Blue/AD1_024.cs

@@ -125,7 +125,8 @@ namespace DCGO.CardEffects.AD1
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("May suspend 1 enemy Digimon and unsuspend. May bottom deck suspended enemy Digimon", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
+                activateClass.SetIsSkippable(true);
                 activateClass.SetHashString("AD1_024_AT");
                 cardEffects.Add(activateClass);
 
@@ -149,77 +150,111 @@ namespace DCGO.CardEffects.AD1
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))//first may includes both actions, so if suspend is possible
+                    bool isByEffect = CardEffectCommons.IsByEffect(hashtable, null);
+                    bool executed = false;
+                    string _Message;
+                    if (isByEffect)
                     {
-                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
-                        selectPermanentEffect.SetUp(
-                            selectPlayer: card.Owner,
-                            canTargetCondition: IsOpponentsDigimon,
-                            canTargetCondition_ByPreSelecetedList: null,
-                            canEndSelectCondition: null,
-                            maxCount: 1,
-                            canNoSelect: true,
-                            canEndNotMax: false,
-                            selectPermanentCoroutine: null,
-                            afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
-                            mode: SelectPermanentEffect.Mode.Tap,
-                            cardEffect: activateClass);
-
-                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-
-                        IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
-                        {
-                            if (permanents.Count > 0) yield return ContinuousController.instance.StartCoroutine(
-                                new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
-                            yield return null;
-                        }
+                        _Message = $"Card entered by effect, will you use \"{activateClass.EffectName}\"?";
                     }
-                    else //if nothing to suspend, may still choose to take the action to unsuspend
+                    else
+                    {
+                        _Message = "Card did not enter by effect, Will you use \"May suspend 1 enemy Digimon and unsuspend.\"?";
+                    }
+
+                    List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>()
                     {
-                        string selectPlayerMessage = "Will you unsuspend this card?";
-                        string notSelectPlayerMessage = "The opponent is choosing if they will unsuspend.";
+                        new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
+                        new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
+                    };
+
+                    string selectPlayerMessage1 = _Message;
+
+                    GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: "");
+
+                    yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+
+                    var activate = GManager.instance.userSelectionManager.SelectedBoolValue;
 
-                        List<SelectionElement<bool>> command_SelectCommands = new List<SelectionElement<bool>>()
+                    if (activate)
+                    {
+                        if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))//first may includes both actions, so if suspend is possible
+                        {
+                            SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                            selectPermanentEffect.SetUp(
+                                selectPlayer: card.Owner,
+                                canTargetCondition: IsOpponentsDigimon,
+                                canTargetCondition_ByPreSelecetedList: null,
+                                canEndSelectCondition: null,
+                                maxCount: 1,
+                                canNoSelect: true,
+                                canEndNotMax: false,
+                                selectPermanentCoroutine: null,
+                                afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
+                                mode: SelectPermanentEffect.Mode.Tap,
+                                cardEffect: activateClass);
+
+                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                            IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
+                            {
+                                if (permanents.Count > 0) yield return ContinuousController.instance.StartCoroutine(
+                                    new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
+                                executed = true;
+                                yield return null;
+                            }
+                        }
+                        else //if nothing to suspend, may still choose to take the action to unsuspend
                         {
-                            new SelectionElement<bool>(message: $"Yes", value: true, spriteIndex: 0),
-                            new SelectionElement<bool>(message: $"No", value: false, spriteIndex: 1),
-                        };
+                            string selectPlayerMessage = "Will you unsuspend this card?";
+                            string notSelectPlayerMessage = "The opponent is choosing if they will unsuspend.";
+
+                            List<SelectionElement<bool>> command_SelectCommands = new List<SelectionElement<bool>>()
+                            {
+                                new SelectionElement<bool>(message: $"Yes", value: true, spriteIndex: 0),
+                                new SelectionElement<bool>(message: $"No", value: false, spriteIndex: 1),
+                            };
 
-                        GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: command_SelectCommands, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
+                            GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: command_SelectCommands, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
 
-                        yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
+                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
 
-                        bool unsuspend = GManager.instance.userSelectionManager.SelectedBoolValue;
+                            bool unsuspend = GManager.instance.userSelectionManager.SelectedBoolValue;
 
-                        if (unsuspend)
+                            if (unsuspend)
+                            {
+                                yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
+                                    new List<Permanent>() { card.PermanentOfThisCard() },
+                                    activateClass).Unsuspend());
+                                executed = true;
+                            }
+                        }
+
+                        if (isByEffect && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsSuspendedDigimon))
                         {
-                            yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
-                                new List<Permanent>() { card.PermanentOfThisCard() },
-                                activateClass).Unsuspend());
+                            SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                            selectPermanentEffect.SetUp(
+                                selectPlayer: card.Owner,
+                                canTargetCondition: IsOpponentsSuspendedDigimon,
+                                canTargetCondition_ByPreSelecetedList: null,
+                                canEndSelectCondition: null,
+                                maxCount: 1,
+                                canNoSelect: true,
+                                canEndNotMax: false,
+                                selectPermanentCoroutine: null,
+                                afterSelectPermanentCoroutine: null,
+                                mode: SelectPermanentEffect.Mode.PutLibraryBottom,
+                                cardEffect: activateClass);
+
+                            yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                            executed = true;
                         }
                     }
 
-                    ICardEffect cardEffect = CardEffectCommons.GetCardEffectFromHashtable(hashtable);
-                    if (cardEffect != null && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsSuspendedDigimon))
-                    {
-                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
-                        selectPermanentEffect.SetUp(
-                            selectPlayer: card.Owner,
-                            canTargetCondition: IsOpponentsSuspendedDigimon,
-                            canTargetCondition_ByPreSelecetedList: null,
-                            canEndSelectCondition: null,
-                            maxCount: 1,
-                            canNoSelect: true,
-                            canEndNotMax: false,
-                            selectPermanentCoroutine: null,
-                            afterSelectPermanentCoroutine: null,
-                            mode: SelectPermanentEffect.Mode.PutLibraryBottom,
-                            cardEffect: activateClass);
-
-                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-                    }
+                    if (!executed) activateClass.RemoveUse();
                 }
             }
             #endregion