Parcourir la source

updates for cards, fixes to app fusion, Build 1.8.2.9

mbunch_kascope il y a 1 an
Parent
commit
768ad23b82

+ 6 - 7
Assets/CardEffect/BT21/Purple/BT21_074.cs

@@ -115,6 +115,9 @@ namespace DCGO.CardEffects.BT21
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
+                    Permanent selectedPermanent = null;
+                    List<CardSource> selectedCards = new List<CardSource>();
+
                     bool canSelectHand = card.Owner.HandCards.Count(CanTuckOrTrash) >= 1;
                     bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanTuckOrTrash);
 
@@ -143,8 +146,6 @@ namespace DCGO.CardEffects.BT21
 
                         bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
 
-                        List<CardSource> selectedCards = new List<CardSource>();
-
                         IEnumerator SelectCardCoroutine(CardSource cardSource)
                         {
                             selectedCards.Add(cardSource);
@@ -231,8 +232,6 @@ namespace DCGO.CardEffects.BT21
 
                             yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
 
-                            Permanent selectedPermanent = null;
-
                             IEnumerator SelectPermanentCoroutine(Permanent permanent)
                             {
                                 selectedPermanent = permanent;
@@ -294,6 +293,8 @@ namespace DCGO.CardEffects.BT21
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
+                    Permanent selectedPermanent = null;
+
                     bool canSelectHand = card.Owner.HandCards.Count(CanTuckOrTrash) >= 1;
                     bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanTuckOrTrash);
 
@@ -410,12 +411,10 @@ namespace DCGO.CardEffects.BT21
 
                             yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
 
-                            Permanent selectedPermanent = null;
-
                             IEnumerator SelectPermanentCoroutine(Permanent permanent)
                             {
                                 selectedPermanent = permanent;
-
+                                UnityEngine.Debug.Log($"PERMENENT SELECTED: {permanent}");
                                 yield return null;
                             }
 

+ 12 - 21
Assets/CardEffect/BT21/Red/BT21_018.cs

@@ -71,36 +71,27 @@ namespace DCGO.CardEffects.BT21
                     {
                         if (source != null && source != card)
                         {
-                            if (source.PermanentOfThisCard().TopCard.EqualsCardName("Gatchmon"))
+                            if (permanent.TopCard.EqualsCardName("Gatchmon"))
                             {
-                                if (source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("Navimon")) || source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("Tweetmon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Navimon") || x.EqualsCardName("Tweetmon")))
                                 {
-                                    if (source.CanAppFusionFromTargetPermanent(permanent, true))
-                                    {
-                                        return true;
-                                    }
+                                    return true;
                                 }
                             }
 
-                            if (source.PermanentOfThisCard().TopCard.EqualsCardName("Navimon"))
+                            if (permanent.TopCard.EqualsCardName("Navimon"))
                             {
-                                if (source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("Gatchmon")) || source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("Tweetmon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Gatchmon") || x.EqualsCardName("Tweetmon")))
                                 {
-                                    if (source.CanAppFusionFromTargetPermanent(permanent, true))
-                                    {
-                                        return true;
-                                    }
+                                    return true;
                                 }
                             }
 
-                            if (source.PermanentOfThisCard().TopCard.EqualsCardName("Tweetmon"))
+                            if (permanent.TopCard.EqualsCardName("Tweetmon"))
                             {
-                                if (source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("Gatchmon")) || source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("Navimon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Gatchmon") || x.EqualsCardName("Navimon")))
                                 {
-                                    if (source.CanAppFusionFromTargetPermanent(permanent, true))
-                                    {
-                                        return true;
-                                    }
+                                    return true;
                                 }
                             }
                         }
@@ -113,7 +104,7 @@ namespace DCGO.CardEffects.BT21
                         {
                             if (permanent.TopCard.EqualsCardName("Gatchmon"))
                             {
-                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Navimon")) || permanent.LinkedCards.Find(x => x.EqualsCardName("Tweetmon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Navimon") || x.EqualsCardName("Tweetmon")))
                                 {
                                     return true;
                                 }
@@ -121,7 +112,7 @@ namespace DCGO.CardEffects.BT21
 
                             if (permanent.TopCard.EqualsCardName("Navimon"))
                             {
-                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Gatchmon")) || permanent.LinkedCards.Find(x => x.EqualsCardName("Tweetmon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Gatchmon") || x.EqualsCardName("Tweetmon")))
                                 {
                                     return true;
                                 }
@@ -129,7 +120,7 @@ namespace DCGO.CardEffects.BT21
 
                             if (permanent.TopCard.EqualsCardName("Tweetmon"))
                             {
-                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Gatchmon")) || permanent.LinkedCards.Find(x => x.EqualsCardName("Navimon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Gatchmon") || x.EqualsCardName("Navimon")))
                                 {
                                     return true;
                                 }

+ 15 - 15
Assets/CardEffect/BT21/Red/BT21_022.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Linq;
 
 //Canoweissmon
 namespace DCGO.CardEffects.BT21
@@ -203,6 +204,11 @@ namespace DCGO.CardEffects.BT21
                 string EffectDiscription()
                     => "[All Turns] [Once Per Turn] When this Digimon with [Gammamon] in its text would leave the battle area by your opponent's effects, by trashing 3 Digimon cards from its digivolution cards, it doesn't leave.";
 
+                bool SourceCondition(CardSource source)
+                {
+                    return source.IsDigimon;
+                }
+
                 bool CanUseCondition(Hashtable hashtable)
                 {
                     if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
@@ -224,7 +230,8 @@ namespace DCGO.CardEffects.BT21
                     {
                         if (card.PermanentOfThisCard().TopCard.HasText("Gammamon"))
                         {
-                            return true;
+                            if(card.PermanentOfThisCard().DigivolutionCards.Count(SourceCondition) >= 3)
+                                return true;
                         }
                     }
                     return false;
@@ -239,19 +246,17 @@ namespace DCGO.CardEffects.BT21
                 {
                     Permanent permanent = card.PermanentOfThisCard();
                     List<CardSource> selectedCards = new List<CardSource>();
-                    int trashedamount = 0;
 
-                    int maxCount = Math.Min(1, permanent.DigivolutionCards.Count);
                     SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
                     selectCardEffect.SetUp(
-                                canTargetCondition: null,
+                                canTargetCondition: SourceCondition,
                                 canTargetCondition_ByPreSelecetedList: null,
                                 canEndSelectCondition: null,
                                 canNoSelect: () => true,
-                                selectCardCoroutine: SelectCardCoroutine,
-                                afterSelectCardCoroutine: null,
+                                selectCardCoroutine: null,
+                                afterSelectCardCoroutine: SelectCardCoroutine,
                                 message: "Select digivolution cards to trash",
-                                maxCount: maxCount,
+                                maxCount: 3,
                                 canEndNotMax: false,
                                 isShowOpponent: true,
                                 mode: SelectCardEffect.Mode.Custom,
@@ -266,21 +271,16 @@ namespace DCGO.CardEffects.BT21
 
                     yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
 
-                    IEnumerator SelectCardCoroutine(CardSource cardSource)
+                    IEnumerator SelectCardCoroutine(List<CardSource> cardSources)
                     {
-                        selectedCards.Add(cardSource);
+                        selectedCards = cardSources;
                         yield return null;
                     }
 
-                    if (selectedCards.Count > 0)
+                    if (selectedCards.Count >= 3)
                     {
                         yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(permanent, selectedCards, activateClass).TrashDigivolutionCards());
-                        var trashedCards = permanent.DigivolutionCards.Filter(x => selectedCards.Contains(x)).Count;
-                        trashedamount = trashedCards;
-                    }
 
-                    if (trashedamount >= 3)
-                    {
                         permanent.willBeRemoveField = false;
                         permanent.HideDeleteEffect();
                         permanent.HideHandBounceEffect();

+ 6 - 12
Assets/CardEffect/BT21/Red/BT21_023.cs

@@ -54,25 +54,19 @@ namespace DCGO.CardEffects.BT21
                     {
                         if (source != null && source != card)
                         {
-                            if (source.PermanentOfThisCard().TopCard.EqualsCardName("DoGatchmon"))
+                            if (permanent.TopCard.EqualsCardName("DoGatchmon"))
                             {
-                                if (source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("Timemon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("Timemon")))
                                 {
-                                    if (source.CanAppFusionFromTargetPermanent(permanent, true))
-                                    {
-                                        return true;
-                                    }
+                                    return true;
                                 }
                             }
 
-                            if (source.PermanentOfThisCard().TopCard.EqualsCardName("Timemon"))
+                            if (permanent.TopCard.EqualsCardName("Timemon"))
                             {
-                                if (source.PermanentOfThisCard().LinkedCards.Find(x => x.EqualsCardName("DoGatchmon")))
+                                if (permanent.LinkedCards.Find(x => x.EqualsCardName("DoGatchmon")))
                                 {
-                                    if (source.CanAppFusionFromTargetPermanent(permanent, true))
-                                    {
-                                        return true;
-                                    }
+                                    return true;
                                 }
                             }
                         }

+ 1 - 1
Assets/CardEffect/BT21/Red/BT21_029.cs

@@ -15,7 +15,7 @@ namespace DCGO.CardEffects.BT21
 
             #region Progress
 
-            if (timing == EffectTiming.None)
+            if (timing == EffectTiming.OnAllyAttack || timing == EffectTiming.OnEnterFieldAnyone)
             {
                 bool Condition()
                 {

+ 2 - 0
Assets/CardEffect/BT21/Red/BT21_081.cs

@@ -138,6 +138,8 @@ namespace DCGO.CardEffects.BT21
                                     defenderCondition: (permanent) => true,
                                     cardEffect: activateClass);
 
+                                selectAttackEffect.SetCanNotSelectNotAttack();
+
                                 yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
                             }
                         }

+ 1 - 1
Assets/CardEffect/BT21/Red/BT21_084.cs

@@ -162,7 +162,7 @@ namespace DCGO.CardEffects.BT21
                             if (selectedCard != null && selectedCard.CanAppFusionFromTargetPermanent(selectedPermanent, true))
                             {
                                 PlayCardClass playCardClass = new PlayCardClass(new List<CardSource> { selectedCard }, hashtable, true, selectedPermanent, false, SelectCardEffect.Root.Hand, true);
-                                playCardClass.SetAppFusion(selectedPermanent.PermanentFrame.FrameID, selectedCard);
+                                playCardClass.SetAppFusion(new int[] { selectedPermanent.PermanentFrame.FrameID, selectedPermanent.LinkedCards.IndexOf(selectedCard) });
 
                                 yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
                             }

+ 23 - 22
Assets/CardEffect/BT21/Red/BT21_091.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Diagnostics;
 
 // Spirit Evolution!
 namespace DCGO.CardEffects.BT21
@@ -80,7 +81,7 @@ namespace DCGO.CardEffects.BT21
                             mode: SelectHandEffect.Mode.Discard,
                             cardEffect: activateClass);
 
-                        selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
+                        selectHandEffect.SetUpCustomMessage("Select 1 card to discard.", "The opponent is selecting 1 card to discard.");
                         selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
                         yield return StartCoroutine(selectHandEffect.Activate());
 
@@ -94,11 +95,10 @@ namespace DCGO.CardEffects.BT21
                         }
 
                         if (cardTrashed)
-                        {
                             yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
-                            yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
-                        }
                     }
+
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
                 }
             }
 
@@ -110,7 +110,7 @@ namespace DCGO.CardEffects.BT21
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Your 1 Digimon digivolves", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
                 cardEffects.Add(activateClass);
 
                 string EffectDiscription()
@@ -132,14 +132,7 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.CanDeclareOptionDelayEffect(card))
-                    {
-                        if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
-                        {
-                            return true;
-                        }
-                    }
-                    return false;
+                    return CardEffectCommons.CanDeclareOptionDelayEffect(card);
                 }
 
                 bool PermamentConndition(Permanent permanent)
@@ -168,18 +161,21 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanSelectPermanentCondition(Permanent permanent)
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
                     {
-                        foreach (CardSource cardSource in card.Owner.HandCards)
+                        if (permanent.IsTamer)
                         {
-                            if (CanSelectCardCondition(cardSource))
+                            foreach (CardSource cardSource in card.Owner.HandCards)
                             {
-                                if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
+                                if (CanSelectCardCondition(cardSource))
                                 {
-                                    return true;
+                                    if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
+                                    {
+                                        return true;
+                                    }
                                 }
                             }
-                        }
+                        }                        
                     }
 
                     return false;
@@ -187,16 +183,21 @@ namespace DCGO.CardEffects.BT21
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
+                    bool destroyed = false;
                     yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
 
                     IEnumerator SuccessProcess()
+                    {
+                        destroyed = true;
+                        yield return null;
+                    }
+
+                    if (destroyed)
                     {
                         if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
                         {
                             Permanent selectedPermanent = null;
 
-                            int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
-
                             SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
 
                             selectPermanentEffect.SetUp(
@@ -204,7 +205,7 @@ namespace DCGO.CardEffects.BT21
                                 canTargetCondition: CanSelectPermanentCondition,
                                 canTargetCondition_ByPreSelecetedList: null,
                                 canEndSelectCondition: null,
-                                maxCount: maxCount,
+                                maxCount: 1,
                                 canNoSelect: true,
                                 canEndNotMax: false,
                                 selectPermanentCoroutine: SelectPermanentCoroutine,

+ 2 - 2
Assets/CardEffect/BT21/White/BT21_101.cs

@@ -13,6 +13,8 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Static Effects
+
             #region Alternative Digivolution Condition - Ult.
             if (timing == EffectTiming.None)
             {
@@ -25,8 +27,6 @@ namespace DCGO.CardEffects.BT21
             }
             #endregion
 
-            #region Static Effects
-
             #region App Fusion (Globemon & Charismon)
 
             if (timing == EffectTiming.None)

+ 3 - 3
Assets/CardEffect/BT21/Yellow/BT21_043.cs

@@ -112,7 +112,7 @@ namespace DCGO.CardEffects.BT21
                          yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
                              targetPermanent: permanent,
                              changeValue: -2000,
-                             effectDuration: EffectDuration.UntilEachTurnEnd,
+                             effectDuration: EffectDuration.UntilOpponentTurnEnd,
                              activateClass: activateClass));
                      }                    
                 }
@@ -183,7 +183,7 @@ namespace DCGO.CardEffects.BT21
                          yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
                              targetPermanent: permanent,
                              changeValue: -2000,
-                             effectDuration: EffectDuration.UntilEachTurnEnd,
+                             effectDuration: EffectDuration.UntilOpponentTurnEnd,
                              activateClass: activateClass));
                      }                 
                 }
@@ -255,7 +255,7 @@ namespace DCGO.CardEffects.BT21
                         yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
                             targetPermanent: permanent,
                             changeValue: -2000,
-                            effectDuration: EffectDuration.UntilEachTurnEnd,
+                            effectDuration: EffectDuration.UntilOpponentTurnEnd,
                             activateClass: activateClass));
                     }
                 }

+ 5 - 2
Assets/CardEffect/LM/Black/LM_014.cs

@@ -91,9 +91,12 @@ namespace DCGO.CardEffects.LM
                 {
                     if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        if (CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => true))
+                        if (CardEffectCommons.IsOpponentTurn(card))
                         {
-                            return true;
+                            if (CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => true))
+                            {
+                                return true;
+                            }
                         }
                     }
 

+ 3 - 10
Assets/CardEffect/LM/Blue/LM_041.cs

@@ -48,14 +48,7 @@ namespace DCGO.CardEffects.LM
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
-                    {
-                        if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
-                        {
-                            return true;
-                        }
-                    }
-                    return false;
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
@@ -224,7 +217,7 @@ namespace DCGO.CardEffects.LM
                 {
                     if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
                     {
-                        if (permanent.IsDigimon && permanent.IsTamer)
+                        if (permanent.IsDigimon || permanent.IsTamer)
                         {
                             return true;
                         }
@@ -320,7 +313,7 @@ namespace DCGO.CardEffects.LM
                 {
                     if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
                     {
-                        if (permanent.IsDigimon && permanent.IsTamer)
+                        if (permanent.IsDigimon || permanent.IsTamer)
                         {
                             return true;
                         }

+ 2 - 2
Assets/CardEffect/LM/Red/LM_039.cs

@@ -144,7 +144,7 @@ namespace DCGO.CardEffects.LM
 
                         IEnumerator SelectPermanentCoroutine(Permanent permanent)
                         {
-                            Permanent selectedPermanent = permanent;
+                            selectedPermanent = permanent;
                             yield return null;
                         }
 
@@ -241,7 +241,7 @@ namespace DCGO.CardEffects.LM
 
                         IEnumerator SelectPermanentCoroutine(Permanent permanent)
                         {
-                            Permanent selectedPermanent = permanent;
+                            selectedPermanent = permanent;
                             yield return null;
                         }
 

+ 5 - 24
Assets/CardEffect/P/Green/P_185.cs

@@ -141,13 +141,9 @@ namespace DCGO.CardEffects.P
             {
                 int count()
                 {
-                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        List<CardSource> cards = card.PermanentOfThisCard().DigivolutionCards;
-                        var colourCount = Combinations.GetDifferenetColorCardCount(cards);
-                        var newDP = colourCount * 1000;
-
-                        return newDP;
+                        return card.PermanentOfThisCard().DigivolutionCardsColors.Count;
                     }
 
                     return 0;
@@ -155,14 +151,9 @@ namespace DCGO.CardEffects.P
 
                 bool Condition()
                 {
-                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
-                }
-
-                bool PermanentCondition(Permanent permanent)
-                {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        if (permanent == card.PermanentOfThisCard())
+                        if (count() >= 1)
                         {
                             return true;
                         }
@@ -171,17 +162,7 @@ namespace DCGO.CardEffects.P
                     return false;
                 }
 
-                cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
-                permanentCondition: PermanentCondition,
-                changeValue: count(),
-                isInheritedEffect: false,
-                card: card,
-                condition: Condition,
-                effectName: EffectDiscription));
-                string EffectDiscription()
-                {
-                    return "[All Turns] This Digimon gets +1000 DP for each color in its digivolution cards.";
-                }
+                cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(changeValue: () => 1000 * count(), isInheritedEffect: false, card: card, condition: Condition));
             }
 
             #endregion

+ 7 - 3
Assets/CardEffect/P/Purple/P_187.cs

@@ -198,9 +198,13 @@ namespace DCGO.CardEffects.P
 
                                 if (selectedPermanent.TopCard.Owner.CanAddSecurity(activateClass))
                                 {
-                                    yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedPermanent.TopCard, position));
-                                    yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateRecoveryEffect(selectedPermanent.TopCard.Owner));
-                                    yield return ContinuousController.instance.StartCoroutine(new IAddSecurity(selectedPermanent.TopCard.Owner).AddSecurity());
+                                    yield return ContinuousController.instance.StartCoroutine(new IPutSecurityPermanent(selectedPermanent, CardEffectCommons.CardEffectHashtable(activateClass), toTop: position).PutSecurity());
+
+                                    yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
+                                        player: card.Owner.Enemy,
+                                        destroySecurityCount: 1,
+                                        cardEffect: activateClass,
+                                        fromTop: true).DestroySecurity());
                                 }
                             }
                         }

+ 19 - 12
Assets/CardEffect/P/Red/P_182.cs

@@ -146,24 +146,31 @@ namespace DCGO.CardEffects.P
 
             #region All Turns
 
-            if (timing == EffectTiming.None)
+            if (timing == EffectTiming.OnEnterFieldAnyone || timing == EffectTiming.WhenRemoveField)
             {
+                if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                {
+                    Permanent thisPermanent = card.PermanentOfThisCard();
+
+                    if(Condition())
+                        thisPermanent.AddBoost(new Permanent.DPBoost("P_182", count(), Condition));
+                    else
+                        thisPermanent.RemoveBoost("P_182");
+                }
+
                 int count()
                 {
                     if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
                     {
 
-                        List<CardSource> cards = card.Owner.FieldPermanents
-                        .Where(x => x.IsDigimon || x.IsTamer)
-                        .Select(x => x.TopCard)
-                        .Concat(card.Owner.Enemy.FieldPermanents
-                            .Where(x => x.IsDigimon || x.IsTamer)
-                            .Select(x => x.TopCard))
-                        .ToList();
+                        List<CardSource> cards = card.Owner.GetBattleAreaPermanents()
+                        .Concat(card.Owner.Enemy.GetBattleAreaPermanents()).ToList()
+                        .Map(card => card.TopCard)
+                        .Where(x => x.IsDigimon || x.IsTamer).ToList();
+
                         var colourCount = Combinations.GetDifferenetColorCardCount(cards);
                         var newDP = colourCount * 1000;
 
-
                         return newDP;
                     }
 
@@ -172,10 +179,10 @@ namespace DCGO.CardEffects.P
 
                 bool Condition()
                 {
-                    return CardEffectCommons.IsExistOnBattleArea(card);
+                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
                 }
 
-                bool PermanentCondition(Permanent permanent)
+                /*bool PermanentCondition(Permanent permanent)
                 {
                     if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
                     {
@@ -198,7 +205,7 @@ namespace DCGO.CardEffects.P
                 string EffectDiscription()
                 {
                     return "[All Turns] This Digimon gets +1000 DP for each color Digimon and Tamers have.";
-                }
+                }*/
             }
 
             #endregion

+ 34 - 16
Assets/Scripts/CardController.cs

@@ -140,11 +140,11 @@ public class PlayCardClass
         }
     }
 
-    public void SetAppFusion(int AppFusionFrameID, CardSource card)
+    public void SetAppFusion(int[] AppFusionFrameID)
     {
-        if (0 <= AppFusionFrameID && AppFusionFrameID <= card.Owner.fieldCardFrames.Count - 1)
+        if (AppFusionFrameID != null)
         {
-            _appFusionFrameID = AppFusionFrameID;
+            _appFusionFrameIDs = AppFusionFrameID.CloneArray(); ;
         }
     }
 
@@ -204,7 +204,7 @@ public class PlayCardClass
     int _reducedCost = 0;
     int[] _jogressEvoRootsFrameIDs = null;
     int _burstTamerFrameID = -1;
-    int _appFusionFrameID = -1;
+    int[] _appFusionFrameIDs = null;
     bool _addSecurityEndOption = false;
     bool _isBreedingArea = false;
 
@@ -248,22 +248,21 @@ public class PlayCardClass
 
     bool IsAppFusion(CardSource card)
     {
-        CardSource linkCard = GManager.instance.selectAppFusionEffect.selectedLink;
+       CardSource linkCard = LinkedCard(card);
 
         if (linkCard != null)
         {
             if (card.appFusionCondition != null)
             {
-                if (card.appFusionCondition.linkedCondition != null)
+                if (card.appFusionCondition.digimonCondition != null)
                 {
-                    if (card.appFusionCondition.digimonCondition(GManager.instance.selectAppFusionEffect.EvoRoot.PermanentOfThisCard()))
+                    Permanent digimon = card.Owner.fieldCardFrames[_appFusionFrameIDs[0]].GetFramePermanent();
+
+                    if (card.appFusionCondition.linkedCondition != null)
                     {
-                        if (card.appFusionCondition.linkedCondition != null)
+                        if (card.appFusionCondition.linkedCondition(digimon, linkCard))
                         {
-                            if (card.appFusionCondition.linkedCondition(GManager.instance.selectAppFusionEffect.EvoRoot.PermanentOfThisCard(), linkCard))
-                            {
-                                return true;
-                            }
+                            return true;
                         }
                     }
                 }
@@ -273,6 +272,26 @@ public class PlayCardClass
         return false;
     }
 
+    CardSource LinkedCard(CardSource card)
+    {
+        if (_appFusionFrameIDs != null && _appFusionFrameIDs.Length == 2)
+        {
+            if (0 <= _appFusionFrameIDs[0] && _appFusionFrameIDs[0] <= card.Owner.fieldCardFrames.Count - 1)
+            {
+                Permanent targetPermanent = card.Owner.fieldCardFrames[_appFusionFrameIDs[0]].GetFramePermanent();
+
+                if(targetPermanent.LinkedCards.Count > _appFusionFrameIDs[1])
+                {
+                    CardSource link = targetPermanent.LinkedCards[_appFusionFrameIDs[1]];
+                    return link;
+                }
+            }
+        }
+            
+
+        return null;
+    }
+
     public IEnumerator PlayCard()
     {
         bool burstDigivolved = false;
@@ -725,15 +744,14 @@ public class PlayCardClass
 
             if (IsAppFusion(card))
             {
-                yield return ContinuousController.instance.StartCoroutine(GManager.instance.selectAppFusionEffect.AddToSources());
+                yield return ContinuousController.instance.StartCoroutine(GManager.instance.selectAppFusionEffect.AddToSources(LinkedCard(card)));
 
                 if (!GManager.instance.selectAppFusionEffect.LinkAdded)
                 {
-                    _appFusionFrameID = -1;
+                    _appFusionFrameIDs = new int[0];
 
-                    yield return ContinuousController.instance.StartCoroutine(SelectCost());
+                    yield return ContinuousController.instance.StartCoroutine(SelectCost());                    
                 }
-
                 else
                 {
                     appFusion = true;

+ 10 - 1
Assets/Scripts/CardSource.cs

@@ -2602,26 +2602,35 @@ public class CardSource : MonoBehaviour
     #region whether target permanent can App Fusion into this card
     public bool CanAppFusionFromTargetPermanent(Permanent targetPermanent, bool PayCost)
     {
+        UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {targetPermanent}");
         if (targetPermanent != null)
         {
+            UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {targetPermanent.TopCard}");
             if (targetPermanent.TopCard != null)
             {
+                UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {appFusionCondition}");
                 if (appFusionCondition != null)
                 {
+                    UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {this.CanNotEvolve(targetPermanent)}");
                     if (!this.CanNotEvolve(targetPermanent))
                     {
+                        UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {appFusionCondition.digimonCondition(targetPermanent)}");
                         if (appFusionCondition.digimonCondition(targetPermanent))
-                        { 
+                        {
+                            UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {targetPermanent.LinkedCards.Count}");
                             foreach (CardSource linkedCard in targetPermanent.LinkedCards)
                             {
+                                UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {appFusionCondition.linkedCondition(targetPermanent, linkedCard)}");
                                 if (appFusionCondition.linkedCondition(targetPermanent, linkedCard))
                                 {
+                                    UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {PayCost}");
                                     if (PayCost)
                                     {
                                         int cost = appFusionCondition.cost;
 
                                         cost = GetChangedCostItselef(cost, SelectCardEffect.Root.Hand, new List<Permanent>() { targetPermanent }, checkAvailability: true);
 
+                                        UnityEngine.Debug.Log($"CAN APP FUSE ON TARGET: {Owner.MaxMemoryCost} < {cost}");
                                         if (Owner.MaxMemoryCost < cost)
                                         {
                                             return false;

+ 27 - 18
Assets/Scripts/FieldPermanentCard.cs

@@ -445,34 +445,43 @@ public class FieldPermanentCard : MonoBehaviour
             SetCardSuspended(updateIsTapped);
 
             //DP
-            if (ThisPermanent.IsDigimon && ThisPermanent.DP >= 0)
+            if (ThisPermanent.IsDigimon)
             {
-                DPText.transform.parent.gameObject.SetActive(true);
+                int DP = ThisPermanent.DP;
 
-                if(DPText.text != ThisPermanent.DP.ToString())
-                    DPText.text = ThisPermanent.DP.ToString();
-
-                for (int i = 0; i < DPBackground_color.Count; i++)
+                if (DP >= 0)
                 {
-                    CardColor cardColor = CardColor.None;
+                    DPText.transform.parent.gameObject.SetActive(true);
+
+                    if (DPText.text != DP.ToString())
+                        DPText.text = DP.ToString();
 
-                    if (i < ThisPermanent.TopCard.CardColors.Count)
+                    for (int i = 0; i < DPBackground_color.Count; i++)
                     {
-                        cardColor = ThisPermanent.TopCard.CardColors[i];
-                        float fillAmount = (float)((i + 1) / (float)ThisPermanent.TopCard.CardColors.Count);
+                        CardColor cardColor = CardColor.None;
 
-                        if (DPBackground_color[i].color != DataBase.CardColor_ColorLightDictionary[cardColor])
-                            DPBackground_color[i].color = DataBase.CardColor_ColorLightDictionary[cardColor];
+                        if (i < ThisPermanent.TopCard.CardColors.Count)
+                        {
+                            cardColor = ThisPermanent.TopCard.CardColors[i];
+                            float fillAmount = (float)((i + 1) / (float)ThisPermanent.TopCard.CardColors.Count);
 
-                        DPBackground_color[i].fillAmount = fillAmount;
-                        DPBackground_color[i].gameObject.SetActive(true);
-                    }
+                            if (DPBackground_color[i].color != DataBase.CardColor_ColorLightDictionary[cardColor])
+                                DPBackground_color[i].color = DataBase.CardColor_ColorLightDictionary[cardColor];
 
-                    else
-                    {
-                        DPBackground_color[i].gameObject.SetActive(false);
+                            DPBackground_color[i].fillAmount = fillAmount;
+                            DPBackground_color[i].gameObject.SetActive(true);
+                        }
+
+                        else
+                        {
+                            DPBackground_color[i].gameObject.SetActive(false);
+                        }
                     }
                 }
+                else
+                {
+                    DPText.transform.parent.gameObject.SetActive(false);
+                }                
             }
 
             else

+ 37 - 2
Assets/Scripts/Permanent.cs

@@ -474,6 +474,14 @@ public class Permanent
                 }
                 #endregion
 
+                #region DP Boosts
+                foreach(DPBoost boost in Boosts)
+                {
+                    if (boost.Condition())
+                        DP += boost.DP;
+                }
+                #endregion
+
                 DP += LinkedDP;
 
                 if (DP < 0)
@@ -488,7 +496,34 @@ public class Permanent
 
     public int LinkedDP { get; set; }
 
-    public int DPBoost { get; set; }
+    public List<DPBoost> Boosts = new List<DPBoost>();
+
+    public void AddBoost(DPBoost boost)
+    {
+        if (Boosts.Any(x => x.ID == boost.ID))
+            Boosts.First(x => x.ID == boost.ID).DP = boost.DP;
+        else
+            Boosts.Add(boost);            
+    }
+
+    public void RemoveBoost(string ID)
+    {
+        if (Boosts.Any(x => x.ID == ID))
+            Boosts.Remove(Boosts.First(x => x.ID == ID));
+    }
+    public class DPBoost
+    {
+        public DPBoost(string id, int dp, Func<bool> cond)
+        {
+            ID = id;
+            DP = dp;
+            Condition = cond;
+        }
+
+        public string ID = "";
+        public int DP = 0;
+        public Func<bool> Condition = null;
+    }
     #endregion
 
     #region Will it not receive negative DP effect?
@@ -1277,7 +1312,7 @@ public class Permanent
                                     continue;
                                 }
 
-                                if(isTopCard && !cardEffect.IsInheritedEffect && !cardSource.IsLinked)
+                                if(isTopCard && !cardEffect.IsInheritedEffect && !cardEffect.IsLinkedEffect)
                                 {
                                     _EffectList.Add(cardEffect);
                                 }

+ 14 - 8
Assets/Scripts/SelectAppFusionEffect.cs

@@ -217,18 +217,24 @@ public class SelectAppFusionEffect : MonoBehaviour
         }
     }
 
-    public IEnumerator AddToSources()
+    public IEnumerator AddToSources(CardSource link)
     {
         LinkAdded = false;
 
-        if (selectedLink != null)
+        if (link != null)
         {
-            yield return ContinuousController.instance.StartCoroutine(EvoRoot.PermanentOfThisCard().RemoveLinkedCard(selectedLink));
-            yield return ContinuousController.instance.StartCoroutine(EvoRoot.PermanentOfThisCard().AddDigivolutionCardsTop(new List<CardSource> { selectedLink, EvoRoot }, null));
-            //yield return ContinuousController.instance.StartCoroutine(EvoRoot.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource> { selectedLink }, null, true));
-            //yield return ContinuousController.instance.StartCoroutine(EvoRoot.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource> { EvoRoot }, null, true));
-            
-            LinkAdded = true;
+            if(link.PermanentOfThisCard() != null)
+            {
+                Permanent linkPermanent = link.PermanentOfThisCard();
+
+                if (link.Owner.GetBattleAreaDigimons().Contains(linkPermanent))
+                {
+                    yield return ContinuousController.instance.StartCoroutine(EvoRoot.PermanentOfThisCard().RemoveLinkedCard(selectedLink));
+                    yield return ContinuousController.instance.StartCoroutine(EvoRoot.PermanentOfThisCard().AddDigivolutionCardsTop(new List<CardSource> { selectedLink, EvoRoot }, null));
+
+                    LinkAdded = true;
+                }
+            }
         }
     }
 }

+ 24 - 12
Assets/Scripts/TurnStateMachine.cs

@@ -828,7 +828,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
     int TargetFrameID { get; set; } = 0;
     int[] JogressEvoRootsFrameIDs { get; set; } = new int[0];
     int BurstTamerFrameID { get; set; } = 0;
-    int AppFusionFrameID { get; set; } = 0;
+    int[] AppFusionFrameIDs { get; set; } = new int[0];
     ICardEffect UseCardEffect { get; set; } = null;
     Permanent AttackingPermanent { get; set; } = null;
     Permanent DefendingPermanent { get; set; } = null;
@@ -1212,9 +1212,9 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                     playCard.SetBurst(BurstTamerFrameID, PlayCard);
                 }
 
-                if (0 <= AppFusionFrameID && AppFusionFrameID <= gameContext.TurnPlayer.fieldCardFrames.Count - 1)
+                if (AppFusionFrameIDs != null && AppFusionFrameIDs.Length == 2)
                 {
-                    playCard.SetAppFusion(AppFusionFrameID, PlayCard);
+                    playCard.SetAppFusion(AppFusionFrameIDs);
                 }
 
 
@@ -1321,7 +1321,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
             TargetFrameID = -1;
             JogressEvoRootsFrameIDs = new int[0];
             BurstTamerFrameID = -1;
-            AppFusionFrameID = -1;
+            AppFusionFrameIDs = new int[0];
             UseCardEffect = null;
             AttackingPermanent = null;
             DefendingPermanent = null;
@@ -2385,7 +2385,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                                                             IEnumerator _EndSelectCoroutine_SelectDigivolutionRoots(List<Permanent> permanents)
                                                             {
                                                                 yield return null;
-                                                                photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[] { permanents[0].PermanentFrame.FrameID, permanents[1].PermanentFrame.FrameID }, -1, -1);
+                                                                photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[] { permanents[0].PermanentFrame.FrameID, permanents[1].PermanentFrame.FrameID }, -1, new int[0]);
                                                             }
 
                                                             IEnumerator _NoSelectCoroutine()
@@ -2436,7 +2436,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                                                             IEnumerator EndSelectCoroutine_SelectTamer(Permanent permanent)
                                                             {
                                                                 yield return null;
-                                                                photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[0], permanent.PermanentFrame.FrameID, -1);
+                                                                photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[0], permanent.PermanentFrame.FrameID, new int[0]);
                                                             }
 
                                                             IEnumerator _NoSelectCoroutine()
@@ -2488,7 +2488,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                                                                 yield return null;
 
                                                                 //int sourceIndex = fieldCardFrame.GetFramePermanent().LinkedCards.IndexOf(cardSource);
-                                                                photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[0], -1, fieldCardFrame.FrameID);
+                                                                photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[0], -1, new int[] { targetPermanent.PermanentFrame.FrameID, targetPermanent.LinkedCards.IndexOf(cardSource)});
                                                             }
 
                                                             IEnumerator _NoSelectCoroutine()
@@ -2505,7 +2505,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                                                     #region usually evolves
                                                     void Digivolution()
                                                     {
-                                                        photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[0], -1, -1);
+                                                        photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, fieldCardFrame.FrameID, new int[0], -1, new int[0]);
                                                     }
                                                     #endregion
 
@@ -2555,7 +2555,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                                             GManager.instance.You.playMatCardFrame.RemoveClickTarget();
                                             GManager.instance.You.playMatCardFrame.Frame.transform.parent.gameObject.SetActive(false);
 
-                                            photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, handCard.cardSource.PreferredFrame().FrameID, new int[0], -1, -1);
+                                            photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, handCard.cardSource.PreferredFrame().FrameID, new int[0], -1, new int[0]);
                                             selected = true;
 
                                             return;
@@ -2592,7 +2592,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                                         GManager.instance.You.playMatCardFrame.RemoveClickTarget();
                                         GManager.instance.You.playMatCardFrame.Frame.transform.parent.gameObject.SetActive(false);
 
-                                        photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, 0, new int[0], -1, -1);
+                                        photonView.RPC("SetPlayCard", RpcTarget.All, handCard.cardSource.CardIndex, 0, new int[0], -1, new int[0]);
                                         selected = true;
 
                                         return;
@@ -3092,7 +3092,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
 
     #region Play card decision
     [PunRPC]
-    public void SetPlayCard(int cardIndex, int TargetFrameID, int[] JogressEvoRootsFrameIDs, int BurstTamerFrameID, int AppFusionFrameID)
+    public void SetPlayCard(int cardIndex, int TargetFrameID, int[] JogressEvoRootsFrameIDs, int BurstTamerFrameID, int[] AppFusionFrameIDs)
     {
         PlayCard = gameContext.ActiveCardList[cardIndex];
         this.TargetFrameID = TargetFrameID;
@@ -3111,7 +3111,19 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
         }
 
         this.BurstTamerFrameID = BurstTamerFrameID;
-        this.AppFusionFrameID = AppFusionFrameID;
+
+        if (AppFusionFrameIDs != null)
+        {
+            if (AppFusionFrameIDs.Length == 2)
+            {
+                this.AppFusionFrameIDs = new int[AppFusionFrameIDs.Length];
+
+                for (int i = 0; i < AppFusionFrameIDs.Length; i++)
+                {
+                    this.AppFusionFrameIDs[i] = AppFusionFrameIDs[i];
+                }
+            }
+        }
     }
     #endregion