Эх сурвалжийг харах

Implemented Petrification Token

Lewisaaronwelch 1 жил өмнө
parent
commit
0bcbfba243

+ 89 - 0
Assets/CardEffect/BT21/Red/BT21_029_token.cs

@@ -0,0 +1,89 @@
+using System.Collections;
+using System.Collections.Generic;
+
+namespace DCGO.CardEffects.Tokens
+{
+    public class BT21_029_token : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Cant Suspend
+
+            if (timing == EffectTiming.None)
+            {
+                bool CanUseCondition()
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (CardEffectCommons.IsOwnerTurn(card))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                cardEffects.Add(CardEffectFactory.CantSuspendStaticEffect(
+                    permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
+                    isInheritedEffect: false,
+                    card: card,
+                    condition: CanUseCondition,
+                    effectName: "[Your Turn] This Digimon can't suspend."
+                ));
+            }
+
+            #endregion
+
+            #region On Deletion
+
+            if (timing == EffectTiming.OnDestroyedAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Trash top security", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[On Deletion] Trash your top security card.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        if (CardEffectCommons.CanTriggerOnDeletion(hashtable, card))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                        player: card.Owner,
+                        destroySecurityCount: 1,
+                        cardEffect: activateClass,
+                        fromTop: true).DestroySecurity());
+                }
+            }
+
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 11 - 0
Assets/CardEffect/BT21/Red/BT21_029_token.cs.meta

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

+ 14 - 0
Assets/Scripts/CardEffectCommons.cs

@@ -332,6 +332,20 @@ public partial class CardEffectCommons
             ));
     }
 
+    #region Play 1 [Petrification] Token
+
+    public static IEnumerator PlayPetrificationToken(ICardEffect activateClass)
+    {
+        yield return ContinuousController.instance.StartCoroutine(PlayToken(
+            tokenData: ContinuousController.instance.PetrificationToken,
+            activateClass: activateClass,
+            isOwnerPermanent: false,
+            isTapped: false
+            ));
+    }
+
+    #endregion
+
     #region Security effect of "add this card to hand"
     public static IEnumerator AddThisCardToHand(CardSource card1, ICardEffect activateClass)
     {

+ 22 - 0
Assets/Scripts/ContinuousController.cs

@@ -118,6 +118,7 @@ public class ContinuousController : MonoBehaviour
     public CEntity_Base RapidmonToken { get; private set; }
     public CEntity_Base PipeFoxToken { get; private set; }
     public CEntity_Base AthoRenePorToken { get; private set; }
+    public CEntity_Base PetrificationToken { get; private set; }
     public CardRestriction BanList { get; private set; } = new CardRestriction(new List<CardLimitCount>(), new List<BannedPair>());
 
     void LoadBanList()
@@ -436,6 +437,27 @@ public class ContinuousController : MonoBehaviour
         };
 
         await AthoRenePorToken.GetCardSprite();
+
+        PetrificationToken = new CEntity_Base()
+        {
+            cardColors = new List<CardColor>() { CardColor.White },
+            PlayCost = -1,
+            Level = 0,
+            CardName_JPN = "",
+            CardName_ENG = "Petrification",
+            Form_JPN = new List<string>(),
+            Form_ENG = new List<string>(),
+            Attribute_JPN = new List<string>(),
+            Attribute_ENG = new List<string>(),
+            Type_JPN = new List<string>(),
+            Type_ENG = new List<string>(),
+            CardSpriteName = "BT21-029-token",
+            cardKind = CardKind.Digimon,
+            DP = 3000,
+            CardEffectClassName = "BT21_029_token"
+        };
+
+        await PetrificationToken.GetCardSprite();
     }
 
     public static ContinuousController instance = null;