Procházet zdrojové kódy

Merge pull request #1190 from DCGO2/task/st23-09

ST23-09
hooperk před 4 měsíci
rodič
revize
9bf4bcda80

+ 216 - 0
Assets/Scripts/CardEffect/ST23/Green/ST23_09.cs

@@ -0,0 +1,216 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+// Atratusmon/Eclipse Impact
+namespace DCGO.CardEffects.ST23
+{
+    public class ST23_09 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Digimon Effects
+
+            #region Alt Digivolution
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent permanent)
+                {
+                    return permanent.TopCard.HasGlowingDawnTraits;
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 5));
+            }
+            #endregion
+
+            #region Security Attack +1
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
+            }
+            #endregion
+
+            #region Blocker
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
+            }
+            #endregion
+
+            #region Reboot
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
+            }
+            #endregion
+
+            #region Shared WD / WA
+
+            string SharedHashString = "ST23_09_WD_WA";
+
+            string SharedEffectName = "immune to digimon effects, delete 1 lowest DP digimon";
+
+            string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] Your opponent's Digimon effects don't affect this Digimon until their turn ends. Then, delete 1 of your opponent's Digimon with the lowest DP.";
+
+            IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                #region Give Digimon Effect Immunity
+
+                Permanent thisPermanent = card.PermanentOfThisCard();
+
+                thisPermanent.UntilOpponentTurnEndEffects.Add((_timing) => PermanentEffectFactory.DigimonEffectImmunity(thisPermanent));
+
+                yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(thisPermanent));
+
+                #endregion
+
+                #region Delete 1 Lowest DP Digimon
+
+                bool PermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
+                }
+
+                if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
+                {
+                    int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, PermanentCondition));
+                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                    selectPermanentEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: PermanentCondition,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: maxCount,
+                        canNoSelect: false,
+                        canEndNotMax: false,
+                        selectPermanentCoroutine: null,
+                        afterSelectPermanentCoroutine: null,
+                        mode: SelectPermanentEffect.Mode.Destroy,
+                        cardEffect: activateClass);
+
+                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
+
+                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                }
+
+                #endregion
+            }
+
+            CardEffectFactory.ActivateClassesForSharedEffects
+                (ref cardEffects, timing, card,
+                    SharedEffectName,
+                    SharedActivateCoroutine,
+                    SharedEffectDescription,
+                    optional: false,
+                    maxCountPerTurn: 1,
+                    hashValue: SharedHashString,
+                    whenDigivolving: true,
+                    whenAttacking: true);
+
+            #endregion
+
+            #endregion
+
+            #region Option Effects
+
+            #region Ignore Colour Requirement
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
+
+                bool CardCondition(CardSource cardSource)
+                {
+                    return cardSource.HasBeatBreakTraits;
+                }
+            }
+            #endregion
+
+            #region Main
+            if (timing == EffectTiming.OptionSkill)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Suspend 1 opponent's digimon, bounce 1 of their highest DP suspended digimon to bottom deck", CanUseCondition, card);
+                activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                    => "[Main] Suspend 1 of your opponent's Digimon. Then, return 1 of your opponent's suspended Digimon with the highest DP to the bottom of the deck.";
+
+                bool CanUseCondition(Hashtable hashtable)
+                    => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
+
+                bool CanSelectSuspendPermamentCondition(Permanent permanent)
+                    => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
+
+                bool CanSelectBouncePermamentCondition(Permanent permanent)
+                    => CardEffectCommons.IsMaxDP(permanent, card.Owner.Enemy, CanBouncePermamentCondition);
+
+                bool CanBouncePermamentCondition(Permanent permanent)
+                    => permanent.IsSuspended;
+
+                IEnumerator ActivateCoroutine(Hashtable _hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectSuspendPermamentCondition))
+                    {
+                        int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectSuspendPermamentCondition));
+                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectSuspendPermamentCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: maxCount,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            selectPermanentCoroutine: null,
+                            afterSelectPermanentCoroutine: null,
+                            mode: SelectPermanentEffect.Mode.Tap,
+                            cardEffect: activateClass);
+
+                        selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend", "The opponent is selecting 1 Digimon to suspend");
+
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                    }
+
+                    if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectBouncePermamentCondition))
+                    {
+                        int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectBouncePermamentCondition));
+                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectBouncePermamentCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: maxCount,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            selectPermanentCoroutine: null,
+                            afterSelectPermanentCoroutine: null,
+                            mode: SelectPermanentEffect.Mode.PutLibraryBottom,
+                            cardEffect: activateClass);
+
+                        selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck", "The opponent is selecting 1 Digimon to bottom deck");
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                    }
+                }
+            }
+            #endregion
+
+            #region Arts Digivolution
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
+            }
+            #endregion
+
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 11 - 0
Assets/Scripts/CardEffect/ST23/Green/ST23_09.cs.meta

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

+ 33 - 10
Assets/Scripts/Script/CardSource.cs

@@ -1,11 +1,10 @@
-using System.Collections.Generic;
-using UnityEngine;
-using System;
 using Photon.Pun;
+using System;
+using System.Collections.Generic;
 using System.Linq;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
-using DCGO.CardEntities;
+using UnityEngine;
 
 public class CardSource : MonoBehaviour
 {
@@ -1536,7 +1535,7 @@ public class CardSource : MonoBehaviour
         if (isOptionOnly)
         {
             return OptionCardColors.Contains(cardColor);
-        } 
+        }
         else if (isDigimonOnly)
         {
             return DigimonCardColors.Contains(cardColor);
@@ -3307,7 +3306,7 @@ public class CardSource : MonoBehaviour
         {
             if (targetPermanent.TopCard != null && !targetPermanent.TopCard.IsToken)
             {
-                if(allowBreeding || !targetPermanent.TopCard.Owner.GetBreedingAreaPermanents().Contains(targetPermanent))
+                if (allowBreeding || !targetPermanent.TopCard.Owner.GetBreedingAreaPermanents().Contains(targetPermanent))
                 {
                     if (this.CanLink(false, allowBreeding)) // Don't check PayCost in CanLink since this method will check again anyway
                     {
@@ -3330,7 +3329,7 @@ public class CardSource : MonoBehaviour
                                 return true;
                             }
                         }
-                }
+                    }
                 }
             }
         }
@@ -4040,7 +4039,7 @@ public class CardSource : MonoBehaviour
         get
         {
             return EqualsTraits("Sea Beast");
-		}
+        }
     }
 
     #endregion
@@ -4064,7 +4063,7 @@ public class CardSource : MonoBehaviour
         get
         {
             return EqualsTraits("Angel");
-		}
+        }
     }
 
     #endregion
@@ -4104,6 +4103,30 @@ public class CardSource : MonoBehaviour
     }
 
     #endregion
+
+    #region whether this card has Glowing Dawn trait
+
+    public bool HasGlowingDawnTraits
+    {
+        get
+        {
+            return EqualsTraits("Glowing Dawn");
+        }
+    }
+
+    #endregion
+
+    #region whether this card has Beat Break trait
+
+    public bool HasBeatBreakTraits
+    {
+        get
+        {
+            return EqualsTraits("BEATBREAK");
+        }
+    }
+
+    #endregion
 }
 
 public class JogressCondition
@@ -4245,7 +4268,7 @@ public class AssemblyCondition
         element.ElementCount = elementCount;
         element.selectMessage = selectMessage;
         element.CanTargetCondition_ByPreSelecetedList = CanTargetCondition_ByPreSelecetedList;
-        this.elements = new List<AssemblyConditionElement>(){ element };
+        this.elements = new List<AssemblyConditionElement>() { element };
         this.elementCount = elementCount;
         this.reduceCost = reduceCost;
     }