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

Few card updates, changes to min-max cost

mbunch_kascope 2 лет назад
Родитель
Сommit
06d250676d

+ 1 - 0
.gitignore

@@ -9,6 +9,7 @@
 /[Bb]uilds/
 /[Ll]ogs/
 /[Uu]ser[Ss]ettings/
+/[Ll]fs/[Tt]mp/
 
 # MemoryCaptures can get excessive in size.
 # They also could contain extremely sensitive data

+ 1 - 1
Assets/CardEffect/BT15/Black/Numemon_X_Antibody_BT15_057.cs

@@ -175,7 +175,7 @@ public class Numemon_X_Antibody_BT15_057 : CEntity_Effect
 
             bool CanActivateCondition(Hashtable hashtable)
             {
-                if (CardEffectCommons.CanActivateOnDeletion(card))
+                if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
                 {
                     if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource)))
                     {

+ 1 - 1
Assets/CardEffect/LM/Purple/Gammamon_LM_016.cs

@@ -133,7 +133,7 @@ namespace DCGO.CardEffects.LM
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.CanActivateOnDeletion(card))
+                    if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
                     {
                         if (card.Owner.HandCards.Count >= 1)
                         {

+ 126 - 113
Assets/CardEffect/P/Blue/Veemon_P_117.cs

@@ -5,175 +5,188 @@ using System.Linq;
 using Photon;
 using System;
 using Photon.Pun;
-public class Veemon_P_117 : CEntity_Effect
+
+namespace DCGO.CardEffects.P
 {
-    public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+    public class Veemon_P_117 : CEntity_Effect
     {
-        List<ICardEffect> cardEffects = new List<ICardEffect>();
-
-        #region Activate Cost Reduciton
-        ActivateClass costReduceClass = new ActivateClass();
-        costReduceClass.SetUpICardEffect("Digivolution Cost -1", CanUseReduceCondition, card);
-        costReduceClass.SetUpActivateClass(CanActivateCostReductionCondition, ActivateCostReductionCoroutine, 1, false, EffectDiscription2());
-        costReduceClass.SetIsInheritedEffect(true);
-        costReduceClass.SetNotShowUI(true);
-        costReduceClass.SetIsBackgroundProcess(true);
-        costReduceClass.SetHashString("DigivolutionCost-1_P_117");
-
-        string EffectDiscription2()
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
         {
-            return "[Your Turn] [Once Per Turn] When this Digimon would digivolve into a Digimon card with the [Free] trait, if you have a Tamer, reduce the digivolution cost by 1.";
-        }
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Activate Cost Reduciton
+            ActivateClass costReduceClass = new ActivateClass();
+            costReduceClass.SetUpICardEffect("Digivolution Cost -1", CanUseReduceCondition, card);
+            costReduceClass.SetUpActivateClass(CanActivateCostReductionCondition, ActivateCostReductionCoroutine, 2, false, EffectDiscription2());
+            //costReduceClass.SetIsInheritedEffect(true);
+            //costReduceClass.SetNotShowUI(true);
+            //costReduceClass.SetIsBackgroundProcess(true);
+            costReduceClass.SetHashString("DigivolutionCost-1_P_117");
+
+            string EffectDiscription2()
+            {
+                return "[Your Turn] [Once Per Turn] When this Digimon would digivolve into a Digimon card with the [Free] trait, if you have a Tamer, reduce the digivolution cost by 1.";
+            }
 
-        bool CardSourceCondition(CardSource cardSource)
-        {
-            return cardSource.CardTraits.Contains("Free");
-        }
+            bool CardSourceCondition(CardSource cardSource)
+            {
+                return cardSource.CardTraits.Contains("Free");
+            }
 
-        bool CanUseReduceCondition(Hashtable hashtable)
-        {
-            if (CardEffectCommons.IsExistOnBattleArea(card))
+            bool CanUseReduceCondition(Hashtable hashtable)
             {
-                if (CardEffectCommons.IsOwnerTurn(card))
+                if (CardEffectCommons.IsExistOnBattleArea(card))
                 {
                     if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolveOfCard(hashtable, CardSourceCondition, card))
                     {
                         return true;
                     }
                 }
+
+
+                return false;
             }
 
-            return false;
-        }
+            bool CanActivateCostReductionCondition(Hashtable hashtable)
+            {
+                if (CardEffectCommons.IsOwnerTurn(card))
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        return true;
+                    }
+                }
 
-        bool CanActivateCostReductionCondition(Hashtable hashtable)
-        {
-            if (CardEffectCommons.IsExistOnBattleArea(card))
+
+                return false;
+            }
+
+            IEnumerator ActivateCostReductionCoroutine(Hashtable _hashtable)
             {
-                return true;
+                yield return null;
             }
 
-            return false;
-        }
 
-        IEnumerator ActivateCostReductionCoroutine(Hashtable _hashtable)
-        {
-            yield return null;
-        }
 
-        if (timing == EffectTiming.OnEnterFieldAnyone)
-        {
-            cardEffects.Add(costReduceClass);
-        }
-        #endregion
 
-        #region Cost reduction
-        if (timing == EffectTiming.None)
-        {
-            ChangeCostClass changeCostClass = new ChangeCostClass();
-            changeCostClass.SetUpICardEffect($"Digivolution Cost -1", CanUseCondition, card);
-            changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
-            cardEffects.Add(changeCostClass);
+            if (timing == EffectTiming.BeforePayCost)
+            {
+                cardEffects.Add(costReduceClass);
+            }
+            #endregion
 
-            bool CanUseCondition(Hashtable hashtable)
+            #region Cost reduction
+            if (timing == EffectTiming.None)
             {
-                if (CardEffectCommons.IsExistOnBattleArea(card))
+                ChangeCostClass changeCostClass = new ChangeCostClass();
+                changeCostClass.SetUpICardEffect($"Digivolution Cost -1", CanUseCondition, card);
+                changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
+                cardEffects.Add(changeCostClass);
+
+                bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsOwnerTurn(card))
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
+                        if (CardEffectCommons.IsOwnerTurn(card))
                         {
-                            return true;
+                            if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
+                            {
+                                if (!card.cEntity_EffectController.isOverMaxCountPerTurn(costReduceClass, costReduceClass.MaxCountPerTurn))
+                                {
+                                    return true;
+                                }
+                            }
                         }
                     }
-                }
 
-                return false;
-            }
+                    return false;
+                }
 
-            int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
-            {
-                if (CardSourceCondition(cardSource))
+                int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
                 {
-                    if (RootCondition(root))
+                    if (CardSourceCondition(cardSource))
                     {
-                        if (PermanentsCondition(targetPermanents))
+                        if (RootCondition(root))
                         {
-                            Cost -= 1;
+                            if (PermanentsCondition(targetPermanents))
+                            {
+                                
+                                Cost -= 1;
+                            }
                         }
                     }
-                }
 
-                return Cost;
-            }
+                    return Cost;
+                }
 
-            bool PermanentsCondition(List<Permanent> targetPermanents)
-            {
-                if (targetPermanents != null)
+                bool PermanentsCondition(List<Permanent> targetPermanents)
                 {
-                    if (targetPermanents.Count(PermanentCondition) >= 1)
+                    if (targetPermanents != null)
                     {
-                        return true;
+                        if (targetPermanents.Count(PermanentCondition) >= 1)
+                        {
+                            return true;
+                        }
                     }
+
+                    return false;
                 }
 
-                return false;
-            }
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent == card.PermanentOfThisCard();
+                }
 
-            bool PermanentCondition(Permanent targetPermanent)
-            {
-                return targetPermanent == card.PermanentOfThisCard();
-            }
+                bool RootCondition(SelectCardEffect.Root root)
+                {
+                    return true;
+                }
 
-            bool RootCondition(SelectCardEffect.Root root)
-            {
-                return true;
+                bool isUpDown()
+                {
+                    return true;
+                }
             }
+            #endregion
 
-            bool isUpDown()
+            if (timing == EffectTiming.OnAllyAttack)
             {
-                return true;
-            }
-        }
-        #endregion
-
-        if (timing == EffectTiming.OnAllyAttack)
-        {
-            ActivateClass activateClass = new ActivateClass();
-            activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
-            activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
-            activateClass.SetIsInheritedEffect(true);
-            cardEffects.Add(activateClass);
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
+                activateClass.SetIsInheritedEffect(true);
+                cardEffects.Add(activateClass);
 
-            string EffectDiscription()
-            {
-                return "[When Attacking] If this Digimon has 2 or more colors, <Draw 1> (Draw 1 card from your deck).";
-            }
+                string EffectDiscription()
+                {
+                    return "[When Attacking] If this Digimon has 2 or more colors, <Draw 1> (Draw 1 card from your deck).";
+                }
 
-            bool CanUseCondition(Hashtable hashtable)
-            {
-                return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
-            }
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
+                }
 
-            bool CanActivateCondition(Hashtable hashtable)
-            {
-                if (CardEffectCommons.IsExistOnBattleArea(card))
+                bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (card.PermanentOfThisCard().TopCard.CardColors.Count >= 2)
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        return true;
+                        if (card.PermanentOfThisCard().TopCard.CardColors.Count >= 2)
+                        {
+                            return true;
+                        }
                     }
+
+                    return false;
                 }
 
-                return false;
+                IEnumerator ActivateCoroutine(Hashtable _hashtable)
+                {
+                    yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
+                }
             }
 
-            IEnumerator ActivateCoroutine(Hashtable _hashtable)
-            {
-                yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
-            }
+            return cardEffects;
         }
-
-        return cardEffects;
     }
-}
+}

+ 5 - 2
Assets/Scripts/CardEffectCommons/GameContextDeterminarion.cs

@@ -9,9 +9,12 @@ public partial class CardEffectCommons
     #region Whether the card is in the field
     public static bool IsExistOnField(CardSource card)
     {
-        if (card.PermanentOfThisCard() != null)
+        if(card != null)
         {
-            return true;
+            if (card.PermanentOfThisCard() != null)
+            {
+                return true;
+            }
         }
 
         return false;

+ 15 - 5
Assets/Scripts/CardEffectCommons/MinMax_DP_Cost_Level/Cost/IsMaxCost.cs

@@ -16,11 +16,21 @@ public partial class CardEffectCommons
         if (!permanent.IsDigimon && !permanent.IsTamer) return false;
         if (!permanent.TopCard.HasPlayCost) return false;
 
-        List<int> costs = permanent.TopCard.Owner.GetBattleAreaPermanents().Filter(permanent1 =>
-            (permanent1.IsDigimon || permanent1.IsTamer)
-            && (IsDigimonOnly && permanent1.IsDigimon)
-            && permanent1.TopCard.HasPlayCost)
-            .Map(permanent1 => permanent1.TopCard.GetCostItself);
+        List<Permanent> permanents = permanent.TopCard.Owner.GetBattleAreaPermanents();
+        List<int> costs = new List<int>();
+
+        if (IsDigimonOnly)
+        {
+            costs = permanent.TopCard.Owner.GetBattleAreaPermanents().Filter(permanent1 =>
+                permanent1.IsDigimon && permanent1.TopCard.HasPlayCost)
+                .Map(permanent1 => permanent1.TopCard.GetCostItself);
+        }
+        else
+        {
+            costs = permanent.TopCard.Owner.GetBattleAreaPermanents().Filter(permanent1 =>
+                (permanent1.IsDigimon || permanent1.IsTamer) && permanent1.TopCard.HasPlayCost)
+                .Map(permanent1 => permanent1.TopCard.GetCostItself);
+        }
 
         return costs.Count >= 1 && permanent.TopCard.GetCostItself == costs.Max();
     }

+ 15 - 5
Assets/Scripts/CardEffectCommons/MinMax_DP_Cost_Level/Cost/IsMinCost.cs

@@ -16,11 +16,21 @@ public partial class CardEffectCommons
         if (!permanent.IsDigimon && !permanent.IsTamer) return false;
         if (!permanent.TopCard.HasPlayCost) return false;
 
-        List<int> costs = permanent.TopCard.Owner.GetBattleAreaPermanents().Filter(permanent1 =>
-            (permanent1.IsDigimon || permanent1.IsTamer)
-            && (IsDigimonOnly && permanent1.IsDigimon)
-            && permanent1.TopCard.HasPlayCost)
-            .Map(permanent1 => permanent1.TopCard.GetCostItself);
+        List<Permanent> permanents = permanent.TopCard.Owner.GetBattleAreaPermanents();
+        List<int> costs = new List<int>();
+
+        if (IsDigimonOnly)
+        {
+            costs = permanent.TopCard.Owner.GetBattleAreaPermanents().Filter(permanent1 =>
+                permanent1.IsDigimon && permanent1.TopCard.HasPlayCost)
+                .Map(permanent1 => permanent1.TopCard.GetCostItself);
+        }
+        else
+        {
+            costs = permanent.TopCard.Owner.GetBattleAreaPermanents().Filter(permanent1 =>
+                (permanent1.IsDigimon || permanent1.IsTamer) && permanent1.TopCard.HasPlayCost)
+                .Map(permanent1 => permanent1.TopCard.GetCostItself);
+        }
 
         return costs.Count >= 1 && permanent.TopCard.GetCostItself == costs.Min();
     }