Просмотр исходного кода

Add Digitama and Level 3 cardEffects

Andrej Erdelsky 2 лет назад
Родитель
Сommit
c4aa7f9110

+ 383 - 0
Assets/CardEffect/BT17/Red/Agumon_BT17_007.cs

@@ -0,0 +1,383 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System.Linq;
+using System;
+using Photon.Pun;
+
+namespace DCGO.CardEffects.BT17
+{
+    public class Agumon_BT17_007 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Alternate Digivolution
+
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.CardNames.Contains("Koromon");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false,
+                    card: card, condition: null));
+            }
+
+            #endregion
+
+            #region Start of Your Main Phase
+
+            if (timing == EffectTiming.OnStartMainPhase)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect(
+                    "Return 1 card with [Garurumon]/[Greymon]/[Omnimon] in its name from your trash to the hand",
+                    CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
+                    EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[Start of Your Main Phase] If you have a Tamer with [Tai Kamiya] in its name, return 1 card with [Garurumon]/[Greymon]/[Omnimon] in its name from your trash to the hand.";
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    if (cardSource.IsDigimon)
+                    {
+                        if (cardSource.ContainsCardName("Garurumon") ||
+                            cardSource.ContainsCardName("Greymon") ||
+                            cardSource.ContainsCardName("Omnimon"))
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool OwnTamerPermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
+                    {
+                        if (permanent.IsTamer)
+                        {
+                            if (permanent.TopCard.ContainsCardName("Tai Kamiya"))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (CardEffectCommons.IsOwnerTurn(card))
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, OwnTamerPermanentCondition))
+                        {
+                            if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, OwnTamerPermanentCondition))
+                    {
+                        if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
+                        {
+                            int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
+
+                            SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                            selectCardEffect.SetUp(
+                                canTargetCondition: CanSelectCardCondition,
+                                canTargetCondition_ByPreSelecetedList: null,
+                                canEndSelectCondition: null,
+                                canNoSelect: () => false,
+                                selectCardCoroutine: null,
+                                afterSelectCardCoroutine: null,
+                                message: "Select 1 card to add to your hand.",
+                                maxCount: maxCount,
+                                canEndNotMax: false,
+                                isShowOpponent: true,
+                                mode: SelectCardEffect.Mode.AddHand,
+                                root: SelectCardEffect.Root.Trash,
+                                customRootCardList: null,
+                                canLookReverseCard: true,
+                                selectPlayer: card.Owner,
+                                cardEffect: activateClass);
+
+                            yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                        }
+                    }
+                }
+            }
+
+            #endregion
+
+            #region End of Your Turn - ESS
+
+            if (timing == EffectTiming.OnEndTurn)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
+                    EffectDescription());
+                activateClass.SetIsInheritedEffect(true);
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[End of Your Turn] This Digimon and another of your Digimon may DNA digivolve into a Digimon card in the hand.";
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    if (cardSource != null)
+                    {
+                        if (cardSource.IsDigimon)
+                        {
+                            if (cardSource.Owner == card.Owner)
+                            {
+                                if (cardSource.CanPlayJogress(true))
+                                {
+                                    if (isExistOnField(card))
+                                    {
+                                        if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
+                                        {
+                                            return true;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (isExistOnField(card))
+                    {
+                        return true;
+                    }
+
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (CardEffectCommons.IsOwnerTurn(card))
+                        {
+                            if (card.Owner.HandCards.Count >= 1)
+                            {
+                                if (CardEffectCommons.HasMatchConditionOwnersPermanent(card,
+                                        (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
+                                {
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (isExistOnField(card))
+                    {
+                        if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
+                        {
+                            if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
+                            {
+                                List<CardSource> selectedCards = new List<CardSource>();
+
+                                int maxCount = 1;
+
+                                SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                                selectHandEffect.SetUp(
+                                    selectPlayer: card.Owner,
+                                    canTargetCondition: CanSelectCardCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    maxCount: maxCount,
+                                    canNoSelect: true,
+                                    canEndNotMax: false,
+                                    isShowOpponent: true,
+                                    selectCardCoroutine: SelectCardCoroutine,
+                                    afterSelectCardCoroutine: null,
+                                    mode: SelectHandEffect.Mode.Custom,
+                                    cardEffect: activateClass);
+
+                                selectHandEffect.SetUpCustomMessage("Select 1 card to DNA digivolve.",
+                                    "The opponent is selecting 1 card to DNA digivolve.");
+                                selectHandEffect.SetNotShowCard();
+
+                                yield return StartCoroutine(selectHandEffect.Activate());
+
+                                IEnumerator SelectCardCoroutine(CardSource cardSource)
+                                {
+                                    selectedCards.Add(cardSource);
+
+                                    yield return null;
+                                }
+
+                                if (selectedCards.Count >= 1)
+                                {
+                                    foreach (CardSource selectedCard in selectedCards)
+                                    {
+                                        if (selectedCard.CanPlayJogress(true) &&
+                                            selectedCard.CanJogressFromTargetPermanent(card.PermanentOfThisCard(),
+                                                true))
+                                        {
+                                            JogressEvoRootsFrameIDs = Array.Empty<int>();
+
+                                            yield return GManager.instance.photonWaitController.StartWait(
+                                                "Agumon_BT17_007");
+
+                                            if (card.Owner.isYou || GManager.instance.IsAI)
+                                            {
+                                                GManager.instance.selectJogressEffect.SetUp_SelectDigivolutionRoots
+                                                (card: selectedCard,
+                                                    isLocal: true,
+                                                    isPayCost: true,
+                                                    canNoSelect: true,
+                                                    endSelectCoroutine_SelectDigivolutionRoots:
+                                                    EndSelectCoroutineSelectDigivolutionRoots,
+                                                    noSelectCoroutine: null);
+
+                                                GManager.instance.selectJogressEffect.SetUpCustomPermanentConditions(
+                                                    new Func<Permanent, bool>[]
+                                                        { (permanent) => permanent == card.PermanentOfThisCard() });
+
+                                                yield return ContinuousController.instance.StartCoroutine(
+                                                    GManager.instance.selectJogressEffect.SelectDigivolutionRoots());
+
+                                                IEnumerator EndSelectCoroutineSelectDigivolutionRoots(
+                                                    List<Permanent> permanents)
+                                                {
+                                                    permanents = permanents.Distinct().ToList();
+
+                                                    if (permanents.Count == 2)
+                                                    {
+                                                        JogressEvoRootsFrameIDs = new int[2];
+
+                                                        for (int i = 0; i < permanents.Count; i++)
+                                                        {
+                                                            if (i < JogressEvoRootsFrameIDs.Length)
+                                                            {
+                                                                JogressEvoRootsFrameIDs[i] =
+                                                                    permanents[i].PermanentFrame.FrameID;
+                                                            }
+                                                        }
+                                                    }
+
+                                                    if (!permanents.Contains(card.PermanentOfThisCard()))
+                                                    {
+                                                        JogressEvoRootsFrameIDs = Array.Empty<int>();
+                                                    }
+
+                                                    yield return null;
+                                                }
+
+                                                photonView.RPC("SetJogressEvoRootsFrameIDs", RpcTarget.All,
+                                                    JogressEvoRootsFrameIDs);
+                                            }
+
+                                            else
+                                            {
+                                                GManager.instance.commandText.OpenCommandText(
+                                                    "The opponent is choosing a card to DNA digivolve.");
+                                            }
+
+                                            yield return new WaitWhile(() => !endSelect);
+                                            endSelect = false;
+
+                                            GManager.instance.commandText.CloseCommandText();
+                                            yield return new WaitWhile(() =>
+                                                GManager.instance.commandText.gameObject.activeSelf);
+
+                                            if (JogressEvoRootsFrameIDs.Length == 2)
+                                            {
+                                                yield return ContinuousController.instance.StartCoroutine(GManager
+                                                    .instance.GetComponent<Effects>()
+                                                    .ShowCardEffect(new List<CardSource>() { selectedCard },
+                                                        "Played Card", true, true));
+
+                                                PlayCardClass playCard = new PlayCardClass(
+                                                    cardSources: new List<CardSource>() { selectedCard },
+                                                    hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
+                                                    payCost: true,
+                                                    targetPermanent: null,
+                                                    isTapped: false,
+                                                    root: SelectCardEffect.Root.Hand,
+                                                    activateETB: true);
+
+                                                playCard.SetJogress(JogressEvoRootsFrameIDs);
+
+                                                yield return ContinuousController.instance.StartCoroutine(
+                                                    playCard.PlayCard());
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+            #endregion
+
+            return cardEffects;
+        }
+
+        #region Photon DNA ESS
+
+        bool endSelect;
+        int[] JogressEvoRootsFrameIDs = Array.Empty<int>();
+
+        [PunRPC]
+        public void SetJogressEvoRootsFrameIDs(int[] jogressEvoRootsFrameIDs)
+        {
+            this.JogressEvoRootsFrameIDs = jogressEvoRootsFrameIDs;
+            endSelect = true;
+        }
+
+        #endregion
+    }
+}

+ 11 - 0
Assets/CardEffect/BT17/Red/Agumon_BT17_007.cs.meta

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

+ 197 - 0
Assets/CardEffect/BT17/Red/Flamemon_BT17_009.cs

@@ -0,0 +1,197 @@
+using System.Collections;
+using System.Collections.Generic;
+
+namespace DCGO.CardEffects.BT17
+{
+    public class Flamemon_BT17_009 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region On Play
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
+                    EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Hybrid]/[Ten Warriors] trait and 1 Tamer card with an inherited effect among them to the hand. Return the rest to the bottom of the deck.";
+                }
+
+                bool CanSelectDigimonCardCondition(CardSource cardSource)
+                {
+                    if (cardSource.IsDigimon)
+                    {
+                        if (cardSource.ContainsTraits("Hybrid") ||
+                            cardSource.ContainsTraits("Ten Warriors") ||
+                            cardSource.ContainsTraits("TenWarriors"))
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanSelectTamerCardCondition(CardSource cardSource)
+                {
+                    if (cardSource.IsTamer)
+                    {
+                        if (cardSource.HasInheritedEffect)
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (card.Owner.LibraryCards.Count >= 1)
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    yield return ContinuousController.instance.StartCoroutine(
+                        CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
+                            revealCount: 3,
+                            simplifiedSelectCardConditions:
+                            new SimplifiedSelectCardConditionClass[]
+                            {
+                                new(
+                                    canTargetCondition: CanSelectDigimonCardCondition,
+                                    message: "Select 1 Digimon card with the [Hybrid]/[Ten Warriors] trait.",
+                                    mode: SelectCardEffect.Mode.AddHand,
+                                    maxCount: 1,
+                                    selectCardCoroutine: null),
+                                new(
+                                    canTargetCondition: CanSelectTamerCardCondition,
+                                    message: "Select 1 Tamer card with an inherited effect.",
+                                    mode: SelectCardEffect.Mode.AddHand,
+                                    maxCount: 1,
+                                    selectCardCoroutine: null),
+                            },
+                            remainingCardsPlace: RemainingCardsPlace.DeckBottom,
+                            activateClass: activateClass
+                        ));
+                }
+            }
+
+            #endregion
+
+            #region On Deletion - ESS
+
+            if (timing == EffectTiming.OnDestroyedAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Play 1 Tamer from hand", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
+                    EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[On Play] You may play 1 Tamer card with inherited effects from your hand without paying the cost.";
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    if (cardSource.IsTamer)
+                    {
+                        if (cardSource.HasInheritedEffect)
+                        {
+                            if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false,
+                                    cardEffect: activateClass))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
+                    {
+                        if (card.Owner.HandCards.Count >= 1)
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    List<CardSource> selectedCards = new List<CardSource>();
+
+                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                    selectHandEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: CanSelectCardCondition,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: 1,
+                        canNoSelect: true,
+                        canEndNotMax: false,
+                        isShowOpponent: true,
+                        selectCardCoroutine: SelectCardCoroutine,
+                        afterSelectCardCoroutine: null,
+                        mode: SelectHandEffect.Mode.Custom,
+                        cardEffect: activateClass);
+
+                    selectHandEffect.SetUpCustomMessage("Select 1 Tamer card to play.",
+                        "The opponent is selecting 1 Tamer card to play.");
+                    selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
+
+                    yield return StartCoroutine(selectHandEffect.Activate());
+
+                    IEnumerator SelectCardCoroutine(CardSource cardSource)
+                    {
+                        selectedCards.Add(cardSource);
+                        yield return null;
+                    }
+
+                    yield return ContinuousController.instance.StartCoroutine(
+                        CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
+                            payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
+                }
+            }
+
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 11 - 0
Assets/CardEffect/BT17/Red/Flamemon_BT17_009.cs.meta

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

+ 91 - 0
Assets/CardEffect/BT17/Red/Gigimon_BT17_001.cs

@@ -0,0 +1,91 @@
+using System.Collections;
+using System.Collections.Generic;
+using System;
+
+namespace DCGO.CardEffects.BT17
+{
+    public class Gigimon_BT17_001 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region When Attacking - ESS
+
+            if (timing == EffectTiming.OnAllyAttack)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Pay 1 to delete opponents' Digimon with 3000 DP or less",
+                    CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
+                    EffectDescription());
+                activateClass.SetIsInheritedEffect(true);
+                activateClass.SetHashString("Pay1Delete3000DP_BT17_001");
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[When Attacking] By paying 1 cost, delete 1 of your opponent's Digimon with 3000 DP or less.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
+                }
+
+                bool CanSelectOpponentPermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    {
+                        if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition);
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(
+                            card.Owner.AddMemory(-1, activateClass));
+
+                        int maxCount = Math.Min(1,
+                            CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
+
+                        SelectPermanentEffect selectPermanentEffect =
+                            GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectOpponentPermanentCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: maxCount,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            selectPermanentCoroutine: null,
+                            afterSelectPermanentCoroutine: null,
+                            mode: SelectPermanentEffect.Mode.Destroy,
+                            cardEffect: activateClass);
+
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                    }
+                }
+            }
+
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 11 - 0
Assets/CardEffect/BT17/Red/Gigimon_BT17_001.cs.meta

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

+ 199 - 0
Assets/CardEffect/BT17/Red/Guilmon_BT17_008.cs

@@ -0,0 +1,199 @@
+using System.Collections;
+using System.Collections.Generic;
+using System;
+
+namespace DCGO.CardEffects.BT17
+{
+    public class Guilmon_BT17_008 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Your Turn
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect(
+                    "Delete 1 of your opponent's Digimon with 3000 DP or less, or gain 1 memory", CanUseCondition,
+                    card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
+                    EffectDescription());
+                activateClass.SetHashString("Delete3000Gain1Memory_BT17_008");
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[Your Turn] [Once Per Turn] When one of your [Calumon] or Tamers with [Takato Matsuki] in their name is played, delete 1 of your opponent's Digimon with 3000 DP or less. If this effect didn't delete, gain 1 memory.";
+                }
+
+                bool PlayedPermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
+                    {
+                        if (permanent.IsDigimon)
+                        {
+                            if (permanent.TopCard.ContainsCardName("Calumon"))
+                            {
+                                return true;
+                            }
+                        }
+
+                        if (permanent.IsTamer)
+                        {
+                            if (permanent.TopCard.ContainsCardName("Takato Matsuki"))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanSelectOpponentPermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
+                    {
+                        if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (CardEffectCommons.IsOwnerTurn(card))
+                        {
+                            if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    List<Permanent> deleteTargetPermanents = new List<Permanent>();
+
+                    if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
+                    {
+                        int maxCount = Math.Min(1,
+                            CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
+
+                        SelectPermanentEffect selectPermanentEffect =
+                            GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                        selectPermanentEffect.SetUp(
+                            selectPlayer: card.Owner,
+                            canTargetCondition: CanSelectOpponentPermanentCondition,
+                            canTargetCondition_ByPreSelecetedList: null,
+                            canEndSelectCondition: null,
+                            maxCount: maxCount,
+                            canNoSelect: false,
+                            canEndNotMax: false,
+                            selectPermanentCoroutine: null,
+                            afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
+                            mode: SelectPermanentEffect.Mode.Custom,
+                            cardEffect: activateClass);
+
+                        selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
+                            "The opponent is selecting 1 Digimon to delete.");
+
+                        yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+
+                        IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
+                        {
+                            deleteTargetPermanents = permanents.Clone();
+                            yield return null;
+                        }
+                    }
+
+                    yield return ContinuousController.instance.StartCoroutine(
+                        CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
+                            targetPermanents: deleteTargetPermanents, activateClass: activateClass,
+                            successProcess: null, failureProcess: FailureProcess));
+
+                    IEnumerator FailureProcess()
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(
+                            card.Owner.AddMemory(1, activateClass));
+                    }
+                }
+            }
+
+            #endregion
+
+            #region All Turns - ESS
+
+            if (timing == EffectTiming.None)
+            {
+                ChangeDPDeleteEffectMaxDPClass changeDPDeleteEffectMaxDPClass = new ChangeDPDeleteEffectMaxDPClass();
+                changeDPDeleteEffectMaxDPClass.SetUpICardEffect("Maximum DP of DP-based deletion effects gets +2000 DP if 0 or less memory",
+                    CanUseCondition, card);
+                changeDPDeleteEffectMaxDPClass.SetUpChangeDPDeleteEffectMaxDPClass(changeMaxDP: ChangeMaxDP);
+                changeDPDeleteEffectMaxDPClass.SetIsInheritedEffect(true);
+                cardEffects.Add(changeDPDeleteEffectMaxDPClass);
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    if (isExistOnField(card))
+                    {
+                        if (card.Owner.MemoryForPlayer <= 0)
+                        {
+                            if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+
+                    return false;
+                }
+
+                int ChangeMaxDP(int maxDP, ICardEffect cardEffect)
+                {
+                    if (cardEffect != null)
+                    {
+                        if (cardEffect.EffectSourceCard != null)
+                        {
+                            if (cardEffect.EffectSourceCard.Owner == card.Owner)
+                            {
+                                maxDP += 2000;
+                            }
+                        }
+                    }
+
+                    return maxDP;
+                }
+            }
+
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 11 - 0
Assets/CardEffect/BT17/Red/Guilmon_BT17_008.cs.meta

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