Quellcode durchsuchen

Implement EX12-076 Susanoomon

hooperk vor 2 Monaten
Ursprung
Commit
4770a37f75

+ 196 - 0
Assets/Scripts/CardEffect/EX12/Yellow/EX12_076.cs

@@ -0,0 +1,196 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Unity.Mathematics;
+
+// Susanoomon
+namespace DCGO.CardEffects.EX12
+{
+    public class EX12_076 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Alternate Digivolution Requirement
+            if (timing == EffectTiming.None)
+            {
+                static bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.HasHybridTraits
+                            || targetPermanent.TopCard.HasShambalaTraits
+                            || targetPermanent.TopCard.HasTSTraits;
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null, level: 6));
+            }
+            #endregion
+
+            #region Static Keywords
+            #region Rush
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
+            }
+            #endregion
+
+            #region Raid
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
+            }
+            #endregion
+
+            #region Blocker
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
+            }
+            #endregion
+            #endregion
+
+            #region Shared Functions
+
+            bool IsOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
+
+            int DigivolutionCardColors() => card.PermanentOfThisCard().DigivolutionCardsColors.Count;
+
+            #endregion
+
+            #region Shared OP/WD
+            string SharedEffectName = "Give all enemy Digimon -3K DP per color in digivolution cards util end of turn";
+
+            CardEffectFactory.ActivateClassesForSharedEffects
+            (ref cardEffects, timing, card,
+                SharedEffectName,
+                SharedActivateCoroutine,
+                SharedEffectDescription,
+                optional: false,
+                onPlay: true,
+                whenDigivolving: true);
+
+            string SharedEffectDescription(string tag)
+            {
+                return $"[{tag}] To all of your opponent's Digimon, give -3000 DP for the turn for each color this Digimon's digivolution cards.";
+            }
+
+            IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                int dpChange = -3000 * DigivolutionCardColors();
+
+                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
+                        permanentCondition: IsOpponentsDigimon,
+                        changeValue: dpChange,
+                        effectDuration: EffectDuration.UntilOwnerTurnEnd,
+                        activateClass: activateClass));
+            }
+            #endregion
+
+            #region When Attacking
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                ActivateClass activateClass = CardEffectFactory.WhenAttackingClass(
+                    card, 
+                    "Place 1 Enemy in Security, if 4+ colours in digivolution cards, Trash their security and recover 1",
+                    ActivateCoroutine,
+                    EffectDescription(),
+                    optional: false,
+                    maxCountPerTurn: 1,
+                    hashValue: "EX12_076_WA"
+                    );
+                cardEffects.Add(activateClass);
+
+                string EffectDescription() 
+                    => "[When Attacking] [Once Per Turn] Place 1 of your opponent's Digimon as the top security card. Then, if this Digimon has 4 or more colors in its digivolution cards, trash their top security card and <Recovery +1>.";
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+                {
+                    if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
+                    {
+                        SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: IsOpponentsDigimon,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: 1,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            selectPermanentCoroutine: null,
+                            afterSelectPermanentCoroutine: null,
+                            mode: SelectPermanentEffect.Mode.PutSecurityTop,
+                            cardEffect: activateClass);
+
+                        selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to place as top security", "The opponent is selecting 1 Digimon to place as top security");
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                    }
+
+                    if (DigivolutionCardColors() >= 4)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                            player: card.Owner.Enemy,
+                            destroySecurityCount: 1,
+                            cardEffect: activateClass,
+                            fromTop: true).DestroySecurity());
+
+                        yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
+                    }
+                }
+            }
+            #endregion
+
+            #region Assembly
+            if (timing == EffectTiming.None)
+            {
+                AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
+                addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card);
+                addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
+                addAssemblyConditionClass.SetNotShowUI(true);
+                cardEffects.Add(addAssemblyConditionClass);
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return true;
+                }
+
+                AssemblyCondition GetAssembly(CardSource cardSource)
+                {
+                    if (cardSource == card)
+                    {
+                        AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition);
+
+                        bool CanSelectCardCondition(CardSource cardSource)
+                        {
+                            return cardSource != null
+                                && cardSource.Owner == card.Owner
+                                && (cardSource.HasHybridTraits || cardSource.HasShambalaTraits);
+                        }
+
+                        bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
+                        {
+                            List<CardSource> AllCards = cardSources.Clone();
+
+                            AllCards.Add(cardSource);
+
+                            return AllCards.Count == Combinations.GetUniqueNameCardCount(AllCards);
+                        }
+
+                        AssemblyCondition assemblyCondition = new AssemblyCondition(
+                            element: element,
+                            CanTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
+                            selectMessage: "8 [Hybrid]/[Shambala] Trait cards w/ different names",
+                            elementCount: 8,
+                            reduceCost: 9);
+
+                        return assemblyCondition;
+                    }
+
+                    return null;
+                }
+            }
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 11 - 0
Assets/Scripts/CardEffect/EX12/Yellow/EX12_076.cs.meta

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

+ 29 - 0
Assets/Scripts/Script/CardSource.cs

@@ -3572,6 +3572,23 @@ public class CardSource : MonoBehaviour
 
     #endregion
 
+    #region whether this card has "Hybrid" trait
+
+    public bool HasHybridTraits
+    {
+        get
+        {
+            if (CardTraits.Contains("Hybrid"))
+            {
+                return true;
+            }
+
+            return false;
+        }
+    }
+
+    #endregion
+
     #region whether this card has "SEEKERS" trait
 
     public bool HasSeekersTraits
@@ -3758,6 +3775,18 @@ public class CardSource : MonoBehaviour
 
     #endregion
 
+    #region whether this card has "Shambala" trait
+
+    public bool HasShambalaTraits
+    {
+        get
+        {
+            return EqualsTraits("Shambala");
+        }
+    }
+
+    #endregion
+
     #region whether this card has "Unidentified" trait
 
     public bool HasUnidentifiedTraits