Przeglądaj źródła

Merge pull request #104 from DCGO2/BT21-Red-029-029_Token

Bt21 Red -  029 + Token
Michael8818 1 rok temu
rodzic
commit
b44f6aedb4

+ 259 - 0
Assets/CardEffect/BT21/Red/BT21_029.cs

@@ -0,0 +1,259 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+// Medusamon
+namespace DCGO.CardEffects
+{
+    public class BT21_029 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Static Effects
+
+            #region Progress
+
+            if (timing == EffectTiming.None)
+            {
+                // to be implemented
+            }
+
+            #endregion
+
+            #region Sec +1
+
+            if (timing == EffectTiming.None)
+            {
+                cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(
+                changeValue: 1,
+                isInheritedEffect: false,
+                card: card,
+                condition: null));
+            }
+
+            #endregion
+
+            #endregion
+
+            #region When Digivolving/End of Attack Shared
+
+            bool CanSelectPermanentCondition(Permanent permanent)
+            {
+                if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                {
+                    if (CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy))
+                    {
+                        return true;
+                    }
+                }
+                return false;
+            }
+
+            IEnumerator WDAndEoAActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
+                SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                selectPermanentEffect.SetUp(
+                    selectPlayer: card.Owner,
+                    canTargetCondition: CanSelectPermanentCondition,
+                    canTargetCondition_ByPreSelecetedList: null,
+                    canEndSelectCondition: null,
+                    maxCount: maxCount,
+                    canNoSelect: true,
+                    canEndNotMax: false,
+                    selectPermanentCoroutine: null,
+                    afterSelectPermanentCoroutine: null,
+                    mode: SelectPermanentEffect.Mode.Destroy,
+                    cardEffect: activateClass);
+
+                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+            }
+
+            #endregion
+
+            #region When Digivolving
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Delete lowest DP Digimon", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, hashtable => WDAndEoAActivateCoroutine(hashtable, activateClass), 1, true, EffectDiscription());
+                activateClass.SetHashString("Delete_BT21_029");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                    => "[When Digivolving] [Once Per Turn] You may delete 1 of your opponent's lowest DP Digimon.";
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+            }
+
+            #endregion
+
+            #region End of Attack
+
+            if (timing == EffectTiming.OnEndAttack)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Delete lowest DP Digimon", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, hashtable => WDAndEoAActivateCoroutine(hashtable, activateClass), 1, true, EffectDiscription());
+                activateClass.SetHashString("Delete_BT21_029");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                    => "[End of Attack] [Once Per Turn] You may delete 1 of your opponent's lowest DP Digimon.";
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        if (CardEffectCommons.CanTriggerOnEndAttack(hashtable, card))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+            }
+
+            #endregion
+
+            #region All Turns Shared
+
+            IEnumerator AllTurnsSharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPetrificationToken(activateClass));
+            }
+
+            #endregion
+
+            #region All Turns - When Opponent Digimon Deleted
+
+            if (timing == EffectTiming.OnDestroyedAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Play 1 [Petrification Token]", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, hashtable => AllTurnsSharedActivateCoroutine(hashtable, activateClass), 1, false, EffectDiscription());
+                activateClass.SetHashString("PlayToken_BT21_029");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[All Turns] [Once Per Turn] When any of your opponent's Digimon are deleted, they play 1 [Petrification] Token";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+
+                bool PermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+            }
+
+            #endregion
+
+            #region All Turns - When Opponent Security Stack Removed
+
+            if (timing == EffectTiming.OnLoseSecurity)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Play 1 [Petrification Token]", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, hashtable => AllTurnsSharedActivateCoroutine(hashtable, activateClass), 1, false, EffectDiscription());
+                activateClass.SetHashString("PlayToken_BT21_029");
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[All Turns] [Once Per Turn] When opponents security stack is removed from, they play 1 [Petrification] Token";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, PlayerCondition))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+
+                bool PlayerCondition(Player player)
+                {
+                    if (player == card.Owner.Enemy)
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+            }
+
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

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

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

+ 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: 

+ 19 - 1
Assets/Scripts/CardEffectCommons.cs

@@ -322,7 +322,9 @@ public partial class CardEffectCommons
     }
     #endregion
 
-    public static IEnumerator PlayAthoRenePorToken (ICardEffect activateClass)
+    #region Play 1 [AthoRenePor] Token
+
+    public static IEnumerator PlayAthoRenePorToken(ICardEffect activateClass)
     {
         yield return ContinuousController.instance.StartCoroutine(PlayToken(
             tokenData: ContinuousController.instance.AthoRenePorToken,
@@ -332,6 +334,22 @@ public partial class CardEffectCommons
             ));
     }
 
+    #endregion
+
+    #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;