mbunch_kascope 1 жил өмнө
parent
commit
4940c902f0

+ 14 - 6
Assets/CardEffect/BT20/Black/BT20_087.cs

@@ -75,11 +75,19 @@ namespace DCGO.CardEffects.BT20
 
                 bool DigivolveFromPermanentCondition(Permanent permanent)
                 {
-                    return (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) ||
-                            CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card)) &&
-                           card.Owner.HandCards.Where(DigivolveToCardCondition).Any(cardSource =>
-                               cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass) ||
-                                cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass, isBreedingArea:true));
+                    if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                    {
+                        return card.Owner.HandCards.Where(DigivolveToCardCondition).Any(cardSource =>
+                               cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
+                    }
+
+                    if(CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
+                    {
+                        return card.Owner.HandCards.Where(DigivolveToCardCondition).Any(cardSource =>
+                               cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass, isBreedingArea: true));
+                    }
+
+                    return false;
                 }
 
                 bool DigivolveToCardCondition(CardSource cardSource)
@@ -92,7 +100,7 @@ namespace DCGO.CardEffects.BT20
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card) &&
                            CardEffectCommons.CanActivateSuspendCostEffect(card) &&
-                           CardEffectCommons.HasMatchConditionPermanent(DigivolveFromPermanentCondition);
+                           CardEffectCommons.HasMatchConditionPermanent(DigivolveFromPermanentCondition,true);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)

+ 20 - 8
Assets/CardEffect/BT20/Green/BT20_101.cs

@@ -100,7 +100,7 @@ namespace DCGO.CardEffects.BT20
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Suspend 1 Digimon, Then return 1 to bottom of deck for every 2 suspended", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
                 cardEffects.Add(activateClass);
 
                 string EffectDiscription()
@@ -119,6 +119,12 @@ namespace DCGO.CardEffects.BT20
                            permanent.IsSuspended;
                 }
 
+                bool OpponentsSuspendedDigimon(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
+                           permanent.IsSuspended;
+                }
+
                 bool CanUseCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
@@ -155,17 +161,17 @@ namespace DCGO.CardEffects.BT20
 
                     if (CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon) >= 2)
                     {
-                        int maxCount = Math.Max(0, Mathf.FloorToInt(CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon)/2));
+                        int maxCount = Math.Min(CardEffectCommons.MatchConditionPermanentCount(OpponentsSuspendedDigimon), Mathf.FloorToInt(CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon) / 2));
 
                         SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
 
                         selectPermanentEffect.SetUp(
                             selectPlayer: card.Owner,
-                            canTargetCondition: SuspendedDigimon,
+                            canTargetCondition: OpponentsSuspendedDigimon,
                             canTargetCondition_ByPreSelecetedList: null,
                             canEndSelectCondition: null,
                             maxCount: maxCount,
-                            canNoSelect: false,
+                            canNoSelect: true,
                             canEndNotMax: false,
                             selectPermanentCoroutine: null,
                             afterSelectPermanentCoroutine: null,
@@ -185,7 +191,7 @@ namespace DCGO.CardEffects.BT20
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Suspend 1 Digimon, Then return 1 to bottom of deck for every 2 suspended", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
                 cardEffects.Add(activateClass);
 
                 string EffectDiscription()
@@ -204,6 +210,12 @@ namespace DCGO.CardEffects.BT20
                            permanent.IsSuspended;
                 }
 
+                bool OpponentsSuspendedDigimon(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
+                           permanent.IsSuspended;
+                }
+
                 bool CanUseCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
@@ -241,17 +253,17 @@ namespace DCGO.CardEffects.BT20
 
                     if (CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon) >= 2)
                     {
-                        int maxCount = Math.Max(0, Mathf.FloorToInt(CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon)/2));
+                        int maxCount = Math.Min(CardEffectCommons.MatchConditionPermanentCount(OpponentsSuspendedDigimon), Mathf.FloorToInt(CardEffectCommons.MatchConditionPermanentCount(SuspendedDigimon)/2));
 
                         SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
 
                         selectPermanentEffect.SetUp(
                             selectPlayer: card.Owner,
-                            canTargetCondition: SuspendedDigimon,
+                            canTargetCondition: OpponentsSuspendedDigimon,
                             canTargetCondition_ByPreSelecetedList: null,
                             canEndSelectCondition: null,
                             maxCount: maxCount,
-                            canNoSelect: false,
+                            canNoSelect: true,
                             canEndNotMax: false,
                             selectPermanentCoroutine: null,
                             afterSelectPermanentCoroutine: null,

+ 5 - 1
Assets/CardEffect/BT20/Purple/BT20_098.cs

@@ -132,6 +132,7 @@ namespace DCGO.CardEffects.BT20
                                 {
                                     return cardSource.IsDigimon && cardSource.EqualsTraits("Ghost") &&
                                            cardSource.HasLevel && cardSource.Level == returnedCard.Level &&
+                                           !selectedCardsToPlay.Contains(cardSource) &&
                                            CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false,
                                                cardEffect: activateClass);
                                 }
@@ -143,7 +144,10 @@ namespace DCGO.CardEffects.BT20
 
                                 bool RemoveOptionsAlreadySelected(List<CardSource> cardSources, CardSource cardSource)
                                 {
-                                    return !cardSources.Contains(cardSource);
+                                    if (cardSources.Contains(cardSource))
+                                        return false;
+
+                                    return true;
                                 }
 
                                 selectCardEffect.SetUp(

+ 4 - 12
Assets/CardEffect/BT20/Red/BT20_019.cs

@@ -113,7 +113,9 @@ namespace DCGO.CardEffects.BT20
                                     CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
                                     canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects.", CanUseConditionImmunity, card);
                                     canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
-                                    immunityPermanent.UntilEachTurnEndEffects.Add(GetCardEffect);
+                                    immunityPermanent.UntilEachTurnEndEffects.Add((_timing) => canNotAffectedClass);
+
+                                    yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(immunityPermanent));
 
                                     bool CanUseConditionImmunity(Hashtable hashtable)
                                     {
@@ -124,7 +126,7 @@ namespace DCGO.CardEffects.BT20
                                     {
                                         if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
                                         {
-                                            if (card.Owner == cardSource.Owner)
+                                            if (cardSource == immunityPermanent.TopCard)
                                             {
                                                 return true;
                                             }
@@ -142,16 +144,6 @@ namespace DCGO.CardEffects.BT20
 
                                         return false;
                                     }
-
-                                    ICardEffect GetCardEffect(EffectTiming _timing)
-                                    {
-                                        if (_timing == EffectTiming.None)
-                                        {
-                                            return canNotAffectedClass;
-                                        }
-                                        return null;
-                                    }
-
                                 }
                             }
                             #endregion

+ 9 - 10
Assets/Scripts/AttackProcess.cs

@@ -146,23 +146,22 @@ public class AttackProcess : MonoBehaviourPunCallbacks
             // target arrow
             if (DefendingPermanent == null)
             {
-                if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
-                {
-                    yield return GManager.instance.OnTargetArrow(
+                yield return GManager.instance.OnTargetArrow(
                         AttackingPermanent.PermanentFrame.GetLocalCanvasPosition() + AttackingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
                         GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.SecurityAttackLocalCanvasPosition + GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.playerUIObjectParent.localPosition,
                         null,
                         null);
-                }
             }
-
             else
             {
-                yield return GManager.instance.OnTargetArrow(
-                    AttackingPermanent.PermanentFrame.GetLocalCanvasPosition() + AttackingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
-                    DefendingPermanent.PermanentFrame.GetLocalCanvasPosition() + DefendingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
-                    null,
-                    null);
+                if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
+                {
+                    yield return GManager.instance.OnTargetArrow(
+                        AttackingPermanent.PermanentFrame.GetLocalCanvasPosition() + AttackingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
+                        DefendingPermanent.PermanentFrame.GetLocalCanvasPosition() + DefendingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
+                        null,
+                        null);
+                }
             }
 
             // activate cutin effects

+ 1 - 1
Assets/Scripts/CardEffectCommons/CanUseEffects/OnDeletion.cs

@@ -101,7 +101,7 @@ public partial class CardEffectCommons
     }
     #endregion
 
-        #region Whether TopCard is in trash when check [On Deletion] effect
+    #region Whether TopCard is in trash when check [On Deletion] effect
     public static bool IsTopCardInTrashOnDeletion(Hashtable hashtable)
     {
         List<Hashtable> hashtables = GetHashtablesFromHashtable(hashtable);

+ 23 - 6
Assets/Scripts/CardEffectCommons/KeyWordEffects/Partition.cs

@@ -40,22 +40,33 @@ public partial class CardEffectCommons
     #endregion
 
     #region Effect process of [Partition]
-    public static IEnumerator PartitionProcess(ICardEffect activateClass, Permanent permanent, List<CardSource> firstSources, List<CardSource> secondSources)
+    public static IEnumerator PartitionProcess(ICardEffect activateClass, Permanent permanent, List<CardSource> firstSources, List<CardSource> secondSources,  List<PartitionCondition> partitionConditions)
     {
-        yield return ContinuousController.instance.StartCoroutine(new PartitionClass(permanent).Partition(activateClass, firstSources, secondSources));
+        yield return ContinuousController.instance.StartCoroutine(new PartitionClass(permanent, partitionConditions).Partition(activateClass, firstSources, secondSources));
     }
     #endregion
 
     #region Partition class
     public class PartitionClass
     {
-        public PartitionClass(Permanent permanent)
+        public PartitionClass(Permanent permanent, List<PartitionCondition> conditions)
         {
             _permanent = permanent;
+            _conditions = conditions;
         }
 
         Permanent _permanent = null;
+        List<PartitionCondition> _conditions = new List<PartitionCondition>();
 
+        string GetConditionColors(PartitionCondition condition)
+        {
+            string str = condition.Color.ToString();
+
+            if (condition.hasTwoColor)
+                str += "/" + condition.Color2.ToString();
+
+            return str;
+        }
 
         public IEnumerator Partition(ICardEffect activateClass, List<CardSource> firstSources, List<CardSource> secondSources)
         {
@@ -71,10 +82,14 @@ public partial class CardEffectCommons
                     return true;
                 }
 
+                string colorsToGrab = "";
+
                 if (_permanent.TopCard != null)
                 {
                     if (firstSources.Count > 1)
                     {
+                        colorsToGrab = GetConditionColors(_conditions[0]);
+
                         SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
                         selectCardEffect.SetUp(
                                 canTargetCondition: CanSelectCondition,
@@ -83,7 +98,7 @@ public partial class CardEffectCommons
                                 canNoSelect: () => false,
                                 selectCardCoroutine: SelectCardCoroutine,
                                 afterSelectCardCoroutine: null,
-                                message: "Select card to play",
+                                message: $"Select 1 {colorsToGrab} Digimon to play",
                                 maxCount: 1,
                                 canEndNotMax: false,
                                 isShowOpponent: false,
@@ -100,7 +115,9 @@ public partial class CardEffectCommons
                         selectedCards.AddRange(firstSources);
 
                     if(secondSources.Count > 1)
-                    { 
+                    {
+                        colorsToGrab = GetConditionColors(_conditions[1]);
+
                         SelectCardEffect selectSecondCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
                         selectSecondCardEffect.SetUp(
                                 canTargetCondition: CanSelectCondition,
@@ -109,7 +126,7 @@ public partial class CardEffectCommons
                                 canNoSelect: () => false,
                                 selectCardCoroutine: SelectCardCoroutine,
                                 afterSelectCardCoroutine: null,
-                                message: "Select card to play",
+                                message: $"Select 1 {colorsToGrab} Digimon to play",
                                 maxCount: 1,
                                 canEndNotMax: false,
                                 isShowOpponent: false,

+ 9 - 9
Assets/Scripts/CardEffectFactory/KeyWordEffects/Partition.cs

@@ -71,15 +71,15 @@ public partial class CardEffectFactory
 
         if (partitionConditions[0].hasTwoColor)
         {
-            sourceOneCard = targetPermanent.cardSources
+            sourceOneCard = targetPermanent.DigivolutionCards
                 .Clone()
                 .Filter(source =>
-                    source.CardColors.Contains(partitionConditions[0].Color) || source.CardColors.Contains(partitionConditions[0].Color2)
+                    (source.CardColors.Contains(partitionConditions[0].Color) || source.CardColors.Contains(partitionConditions[0].Color2))
                     && (source.HasLevel && source.Level == partitionConditions[0].Level));
         }
         else
         {
-            sourceOneCard = targetPermanent.cardSources
+            sourceOneCard = targetPermanent.DigivolutionCards
                 .Clone()
                 .Filter(source =>
                     source.CardColors.Contains(partitionConditions[0].Color)
@@ -88,19 +88,19 @@ public partial class CardEffectFactory
 
         if (partitionConditions[1].hasTwoColor)
         {
-            sourceTwoCard = targetPermanent.cardSources
+            sourceTwoCard = targetPermanent.DigivolutionCards
                 .Clone()
                 .Filter(source =>
-                    source.CardColors.Contains(partitionConditions[1].Color) || source.CardColors.Contains(partitionConditions[1].Color2)
+                    (source.CardColors.Contains(partitionConditions[1].Color) || source.CardColors.Contains(partitionConditions[1].Color2))
                     && (source.HasLevel && source.Level == partitionConditions[1].Level));
         }
         else
         {
-            sourceTwoCard = targetPermanent.cardSources
+            sourceTwoCard = targetPermanent.DigivolutionCards
                 .Clone()
                 .Filter(source =>
-                    source.CardColors.Contains(partitionConditions[1].Color)
-                    && (source.HasLevel && source.Level == partitionConditions[1].Level));
+                    source.CardColors.Contains(partitionConditions[1].Color) && 
+                    (source.HasLevel && source.Level == partitionConditions[1].Level));
         }
 
         ActivateClass activateClass = new ActivateClass();
@@ -151,7 +151,7 @@ public partial class CardEffectFactory
             if (sourceTwoCard.Count == 1)
                 sourceOneCard = sourceOneCard.Except(sourceTwoCard).ToList();
 
-            return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard);
+            return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard, partitionConditions);
         }
 
         return activateClass;

+ 2 - 0
Assets/Scripts/CardSource.cs

@@ -51,6 +51,7 @@ public class CardSource : MonoBehaviour
         IsFlipped = false;
 
         GManager.OnCardFlippedChanged?.Invoke();
+        GManager.OnSecurityStackChanged?.Invoke(Owner);
     }
     #endregion
 
@@ -60,6 +61,7 @@ public class CardSource : MonoBehaviour
         IsFlipped = true;
 
         GManager.OnCardFlippedChanged?.Invoke();
+        GManager.OnSecurityStackChanged?.Invoke(Owner);
     }
     #endregion
 

+ 1 - 1
ProjectSettings/ProjectSettings.asset

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:78bcecd14fdeaa2605a26274dadce193d5f097638d96463e19b326f905c46a5c
+oid sha256:990d0160a2d524cf29d040a3bac18a3534227f4473141fe03fd4760e8f97ac05
 size 20168