Browse Source

Add level 6 cardEffects

Need to remake collision to use permanent conditions
Andrej Erdelsky 1 năm trước cách đây
mục cha
commit
1f961478cc

+ 2 - 2
Assets/CardBaseEntity/BT18/Purple/Digimon/LordKnightmon-BT18-083.asset

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:b70407676aedfe91ad70b5cca0682459d4c6e6c029d27837aa7b6bb1d6bd0e33
-size 1446
+oid sha256:f50124dacc31eb1d7ddb5a3ab2e6f27a7a5c65d3c4a15b90505a4c36f9d03beb
+size 1449

+ 2 - 2
Assets/CardBaseEntity/BT18/Purple/Digimon/LordKnightmon-BT18-083_P1.asset

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:2970202aeec3b4f21c6edd76526686af79bd44d3b375a627a13adac5ef1cbd83
-size 1452
+oid sha256:37fbc7ae962f1c664fe33d23ae0ea7906d2163c55cba02b9437b30298b21e5e6
+size 1455

+ 184 - 0
Assets/CardEffect/BT18/Purple/LordKnightmonAce_BT18_083.cs

@@ -0,0 +1,184 @@
+using System.Collections;
+using System.Collections.Generic;
+
+namespace DCGO.CardEffects.BT18
+{
+    public class LordKnightmonAce_BT18_083 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Ace - Blast Digivolve
+
+            if (timing == EffectTiming.OnCounterTiming)
+            {
+                cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
+            }
+
+            #endregion
+
+            #region When Digivolving
+
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Play Digimon from hand or trash without paying the cost", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
+                cardEffects.Add(activateClass);
+
+                string EffectDescription()
+                {
+                    return
+                        "[When Digivolving] You may play 1 level 5 or lower Digimon card with [Knightmon] in its text from your hand or trash without paying the cost.";
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
+                }
+
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 5 &&
+                           cardSource.HasText("Knightmon");
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition) ||
+                            CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition));
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
+                    bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+
+                    if (canSelectHand || canSelectTrash)
+                    {
+                        if (canSelectHand && canSelectTrash)
+                        {
+                            List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
+                            {
+                                new(message: "From hand", value: true, spriteIndex: 0),
+                                new(message: "From trash", value: false, spriteIndex: 1),
+                            };
+
+                            string selectPlayerMessage = "From which area do you play a card?";
+                            string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
+
+                            GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
+                                selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
+                                notSelectPlayerMessage: notSelectPlayerMessage);
+                        }
+                        else
+                        {
+                            GManager.instance.userSelectionManager.SetBool(canSelectHand);
+                        }
+
+                        yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
+                            .WaitForEndSelect());
+
+                        bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
+
+                        List<CardSource> selectedCards = new List<CardSource>();
+
+                        IEnumerator SelectCardCoroutine(CardSource cardSource)
+                        {
+                            selectedCards.Add(cardSource);
+                            yield return null;
+                        }
+
+                        if (fromHand)
+                        {
+                            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 card to play.", "The opponent is selecting 1 card to play.");
+                            selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
+
+                            yield return StartCoroutine(selectHandEffect.Activate());
+                        }
+
+                        else
+                        {
+                            SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
+
+                            selectCardEffect.SetUp(
+                                canTargetCondition: CanSelectCardCondition,
+                                canTargetCondition_ByPreSelecetedList: null,
+                                canEndSelectCondition: null,
+                                canNoSelect: () => true,
+                                selectCardCoroutine: SelectCardCoroutine,
+                                afterSelectCardCoroutine: null,
+                                message: "Select 1 card to play.",
+                                maxCount: 1,
+                                canEndNotMax: false,
+                                isShowOpponent: true,
+                                mode: SelectCardEffect.Mode.Custom,
+                                root: SelectCardEffect.Root.Trash,
+                                customRootCardList: null,
+                                canLookReverseCard: true,
+                                selectPlayer: card.Owner,
+                                cardEffect: activateClass);
+
+                            selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
+                            selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
+
+                            yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
+                        }
+
+                        yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
+                            cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
+                            root: fromHand ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash,
+                            activateETB: true));
+                    }
+                }
+            }
+
+            #endregion
+
+            #region All Turns
+
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) &&
+                           permanent.DP <= card.PermanentOfThisCard().DP;
+                }
+
+                bool CanUseCondition()
+                {
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
+                }
+                
+                // Change to Collision
+                cardEffects.Add(CardEffectFactory.BlockerStaticEffect(
+                    permanentCondition: PermanentCondition,
+                    isInheritedEffect: false,
+                    card: card,
+                    condition: CanUseCondition));
+            }
+
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 0 - 0
Assets/CardEffect/BT18/Purple/LordKnightmon_BT18_083.cs.meta → Assets/CardEffect/BT18/Purple/LordKnightmonAce_BT18_083.cs.meta


+ 0 - 43
Assets/CardEffect/BT18/Purple/LordKnightmon_BT18_083.cs

@@ -1,43 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-
-namespace DCGO.CardEffects.BT18
-{
-    public class LordKnightmon_BT18_083 : CEntity_Effect
-    {
-        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
-        {
-            List<ICardEffect> cardEffects = new List<ICardEffect>();
-
-            if (timing == EffectTiming.None)
-            {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
-                cardEffects.Add(activateClass);
-
-                string EffectDiscription()
-                {
-                    return "";
-                }
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return true;
-                }
-
-                bool CanActivateCondition(Hashtable hashtable)
-                {
-                    return true;
-                }
-
-                IEnumerator ActivateCoroutine(Hashtable hashtable)
-                {
-                    yield return null;
-                }
-            }
-
-            return cardEffects;
-        }
-    }
-}

+ 59 - 12
Assets/CardEffect/BT18/Purple/Zanbamon_BT18_085.cs

@@ -1,5 +1,6 @@
-using System.Collections;
+using System;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace DCGO.CardEffects.BT18
 {
@@ -9,34 +10,80 @@ namespace DCGO.CardEffects.BT18
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Shared
+
+            int OpponentTrashColorCount()
+            {
+                List<CardColor> cardColors = new List<CardColor>();
+
+                foreach (CardSource cardSource in card.Owner.Enemy.TrashCards)
+                {
+                    cardColors.AddRange(cardSource.CardColors);
+                }
+
+                cardColors = cardColors.Distinct().ToList();
+
+                return cardColors.Count;
+            }
+
+            #endregion
+
+            #region Digivolution Cost Reduction
+
             if (timing == EffectTiming.None)
             {
-                ActivateClass activateClass = new ActivateClass();
-                activateClass.SetUpICardEffect("", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
-                cardEffects.Add(activateClass);
+                bool Condition()
+                {
+                    return !CardEffectCommons.IsExistOnField(card);
+                }
 
-                string EffectDiscription()
+                bool PermanentCondition(Permanent targetPermanent)
                 {
-                    return "";
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card);
                 }
 
-                bool CanUseCondition(Hashtable hashtable)
+                bool CardSourceCondition(CardSource cardSource)
                 {
-                    return true;
+                    return cardSource == card;
                 }
 
-                bool CanActivateCondition(Hashtable hashtable)
+                bool RootCondition(SelectCardEffect.Root root)
                 {
                     return true;
                 }
 
-                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect<Func<int>>(
+                    changeValue: () => -OpponentTrashColorCount(),
+                    permanentCondition: PermanentCondition,
+                    cardCondition: CardSourceCondition,
+                    rootCondition: RootCondition,
+                    isInheritedEffect: false,
+                    card: card,
+                    condition: Condition,
+                    setFixedCost: false));
+            }
+
+            #endregion
+
+            #region Your Turn
+
+            if (timing == EffectTiming.None)
+            {
+                bool Condition()
                 {
-                    yield return null;
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                           CardEffectCommons.IsOwnerTurn(card);
                 }
+
+                cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: OpponentTrashColorCount() / 2,
+                    isInheritedEffect: false, card: card, condition: Condition));
+
+                cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000 * (OpponentTrashColorCount() / 2),
+                    isInheritedEffect: false, card: card, condition: Condition));
             }
 
+            #endregion
+
             return cardEffects;
         }
     }

+ 1 - 1
Assets/Scripts/CardEffectCommons/KeyWordEffects/Collision.cs

@@ -7,7 +7,7 @@ using UnityEngine;
 public partial class CardEffectCommons
 {
     #region Target 1 Digimon gains [Collision]
-    public static IEnumerator GainCollosion(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass)
+    public static IEnumerator GainCollision(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass)
     {
         if (targetPermanent == null) yield break;
         if (!IsPermanentExistsOnBattleArea(targetPermanent)) yield break;