Explorar o código

Update ST20_06.cs

x89rt2 hai 3 meses
pai
achega
6cceb09d4b
Modificáronse 1 ficheiros con 41 adicións e 4 borrados
  1. 41 4
      Assets/Scripts/CardEffect/ST20/Yellow/ST20_06.cs

+ 41 - 4
Assets/Scripts/CardEffect/ST20/Yellow/ST20_06.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using static UnityEngine.UIElements.UxmlAttributeDescription;
 
 //ST20 Angewomon
 namespace DCGO.CardEffects.ST20
@@ -245,15 +246,38 @@ namespace DCGO.CardEffects.ST20
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Gain alliance then attack", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
+                activateClass.SetIsSkippableFunction(IsSkippable);
                 activateClass.SetHashString("alliance-attack-ST20_06");
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
                     return "[Your Turn][Once Per Turn] When your other Digimon are played or digivolve, if any of them have the [ADVENTURE] trait, 1 of your Digimon gains <Alliance> for the turn. Then, 1 of your Digimon may attack.";
                 }
 
+                bool IsSkippable(Hashtable hashtable)
+                {
+                    List<Permanent> etbPermanents = new List<Permanent>();
+                    List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
+
+                    if (hashtables != null)
+                    {
+                        foreach (Hashtable hashtable1 in hashtables)
+                        {
+                            Permanent permanent = CardEffectCommons.GetPermanentFromHashtable(hashtable1);
+
+                            if (permanent != null)
+                                etbPermanents.Add(permanent);
+                        }
+
+                        etbPermanents = etbPermanents.Filter(MyDigimonAdventurePlayedDigid);
+                    }
+
+                    return etbPermanents.Count > 0
+                        && CardEffectCommons.HasMatchConditionPermanent(MyDigimonAlliance);
+                }
+
                 bool MyDigimonAdventurePlayedDigid(Permanent permanent)
                 {
                     return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
@@ -307,6 +331,8 @@ namespace DCGO.CardEffects.ST20
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
+                    bool Used = false;
+
                     List<Permanent> etbPermanents = new List<Permanent>();
                     List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
 
@@ -348,8 +374,10 @@ namespace DCGO.CardEffects.ST20
 
                             IEnumerator SelectBoostedDigimon(Permanent target)
                             {
-                                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: target, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass)); ;
+                                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: target, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
                             }
+
+                            Used = true;
                         }
                     }
 
@@ -392,8 +420,17 @@ namespace DCGO.CardEffects.ST20
                                 defenderCondition: _ => true,
                                 cardEffect: activateClass);
 
+                            selectAttackEffect.SetAfterOnAttackCoroutine(AfterOnAttackCoroutine);
+
                             yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
                         }
+                        
+                        IEnumerator AfterOnAttackCoroutine() { Used = true; yield return null; }
+                    }
+
+                    if (Used)
+                    {
+                        activateClass.RemoveUse();
                     }
                 }
             }
@@ -414,4 +451,4 @@ namespace DCGO.CardEffects.ST20
             return cardEffects;
         }
     }
-}
+}