Ver código fonte

final updates, justimon X still needs fixed

mbunch_kascope 1 ano atrás
pai
commit
c4995a5341

+ 1 - 0
Assets/CardEffect/EX2/Black/EX2_038.cs

@@ -25,6 +25,7 @@ namespace DCGO.CardEffects.EX2
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
+                    UnityEngine.Debug.Log($"CAN USE CONDITION: {CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)}");
                     return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
                 }
 

+ 21 - 12
Assets/CardEffect/EX8/Black/EX8_054.cs

@@ -39,8 +39,6 @@ namespace DCGO.CardEffects.EX8
             #region When Attacking
             if (timing == EffectTiming.OnAllyAttack)
             {
-                List<ICardEffect> candidateEffects = new List<ICardEffect>();
-
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Activate 1 [When Digivolving] effect", CanUseCondition, card);
                 activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
@@ -69,23 +67,19 @@ namespace DCGO.CardEffects.EX8
                 {
                     if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
-                        candidateEffects = new List<ICardEffect>();
-
                         foreach (CardSource source in card.PermanentOfThisCard().DigivolutionCards)
                         {
-                            if (source.ContainsCardName("Justimon"))
+                            if (!source.ContainsCardName("Justimon"))
                                 continue;
 
                             List<ICardEffect> effects = source.EffectList(EffectTiming.OnEnterFieldAnyone)
                             .Clone()
                             .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsWhenDigivolving);
 
-                            candidateEffects.AddRange(effects);
-                        }
-                        
 
-                        if (candidateEffects.Count >= 1)
-                        {
+                            if (effects.Count == 0)
+                                continue;
+
                             return true;
                         }
                     }
@@ -97,6 +91,20 @@ namespace DCGO.CardEffects.EX8
                 {
                     if (CardEffectCommons.IsExistOnBattleArea(card))
                     {
+                        List<ICardEffect> candidateEffects = new List<ICardEffect>();
+
+                        foreach (CardSource source in card.PermanentOfThisCard().DigivolutionCards)
+                        {
+                            if (!source.ContainsCardName("Justimon"))
+                                continue;
+
+                            List<ICardEffect> effects = source.EffectList(EffectTiming.OnEnterFieldAnyone)
+                            .Clone()
+                            .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsWhenDigivolving);
+
+                            candidateEffects.AddRange(effects);
+                        }
+
                         if (candidateEffects.Count >= 1)
                         {
                             ICardEffect selectedEffect = null;
@@ -105,7 +113,6 @@ namespace DCGO.CardEffects.EX8
                             {
                                 selectedEffect = candidateEffects[0];
                             }
-
                             else
                             {
                                 List<SkillInfo> skillInfos = candidateEffects
@@ -156,7 +163,9 @@ namespace DCGO.CardEffects.EX8
                                 {
                                     if (selectedEffect.EffectSourceCard.PermanentOfThisCard() != null)
                                     {
-                                        Hashtable effectHashtable = CardEffectCommons.WhenDigivolvingCheckHashtableOfCard(selectedEffect.EffectSourceCard);
+                                        Hashtable effectHashtable = CardEffectCommons.WhenDigivolvingCheckHashtableOfCard(card);
+
+                                        UnityEngine.Debug.Log($"CAN USE: {selectedEffect.CanUseCondition(effectHashtable)}");
 
                                         if (selectedEffect.CanUse(effectHashtable))
                                         {

+ 27 - 29
Assets/CardEffect/EX8/Black/EX8_055.cs

@@ -10,8 +10,6 @@ namespace DCGO.CardEffects.EX8
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            int totalSourceCount = 0;
-
             #region Fragment
             if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
             {
@@ -43,35 +41,35 @@ namespace DCGO.CardEffects.EX8
                            (source.EqualsTraits("Mineral") || source.EqualsTraits("Rock"));
                 }
 
-                bool CanSelectPermanentCondition(Permanent permanent)
+                bool HasProperAmountOfSources()
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                    int totalSourceCount = 0;
+
+                    foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
                     {
                         totalSourceCount += permanent.DigivolutionCards.Count(HasProperTrait);
-                        if (totalSourceCount >= 1)
-                        {
-                            return true;
-                        }
                     }
 
+                    return totalSourceCount >= 3;
+                }
+
+                bool CanSelectPermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                        return permanent.DigivolutionCards.Count(HasProperTrait) >= 1;
+
                     return false;
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
+                    return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                        {
-                            if (totalSourceCount >= 3)
-                                return true;
-                        }
-                    }
+                        return HasProperAmountOfSources();
 
                     return false;
                 }
@@ -125,17 +123,23 @@ namespace DCGO.CardEffects.EX8
                            (source.EqualsTraits("Mineral") || source.EqualsTraits("Rock"));
                 }
 
-                bool CanSelectPermanentCondition(Permanent permanent)
+                bool HasProperAmountOfSources()
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                    int totalSourceCount = 0;
+
+                    foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
                     {
                         totalSourceCount += permanent.DigivolutionCards.Count(HasProperTrait);
-                        if (totalSourceCount >= 1)
-                        {
-                            return true;
-                        }
                     }
 
+                   return totalSourceCount >= 3;
+                }
+
+                bool CanSelectPermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
+                        return permanent.DigivolutionCards.Count(HasProperTrait) >= 1;
+
                     return false;
                 }
 
@@ -147,13 +151,7 @@ namespace DCGO.CardEffects.EX8
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     if (CardEffectCommons.IsExistOnBattleArea(card))
-                    {
-                        if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                        {
-                            if (totalSourceCount >= 3)
-                                return true;
-                        }
-                    }
+                        return HasProperAmountOfSources();
 
                     return false;
                 }

+ 1 - 1
Assets/CardEffect/EX8/Blue/EX8_068.cs

@@ -97,7 +97,7 @@ namespace DCGO.CardEffects.EX8
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    if (card.Owner.SecurityCards.Count > 1)
+                    if (card.Owner.SecurityCards.Count >= 1)
                     {
                         // Add your bottom security card to the hand
                         CardSource bottomCard = card.Owner.SecurityCards[^1];

+ 4 - 2
Assets/CardEffect/EX8/Green/EX8_045.cs

@@ -236,7 +236,8 @@ namespace DCGO.CardEffects.EX8
                 bool KeywordCondition()
                 {
                     return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
-                           card.PermanentOfThisCard().DP > card.Owner.Enemy.GetBattleAreaDigimons().Map(p => p.DP).Max();
+                           (card.Owner.Enemy.GetBattleAreaDigimons().Count == 0 || 
+                           card.PermanentOfThisCard().DP > card.Owner.Enemy.GetBattleAreaDigimons().Map(p => p.DP).Max());
                 }
 
                 cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1,
@@ -250,7 +251,8 @@ namespace DCGO.CardEffects.EX8
                 bool KeywordCondition()
                 {
                     return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
-                           card.PermanentOfThisCard().DP > card.Owner.Enemy.GetBattleAreaDigimons().Map(p => p.DP).Max();
+                           (card.Owner.Enemy.GetBattleAreaDigimons().Count == 0 ||
+                           card.PermanentOfThisCard().DP > card.Owner.Enemy.GetBattleAreaDigimons().Map(p => p.DP).Max());
                 }
 
                 cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: KeywordCondition));

+ 7 - 4
Assets/CardEffect/EX8/Green/EX8_069.cs

@@ -58,11 +58,14 @@ namespace DCGO.CardEffects.EX8
                 {
                     if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
                     {
-                        if (cardSource == cardSource.PermanentOfThisCard().TopCard)
+                        if (cardSource.Owner == card.Owner)
                         {
-                            if (PermanentCondition(cardSource.PermanentOfThisCard()))
+                            if (cardSource == cardSource.PermanentOfThisCard().TopCard)
                             {
-                                return true;
+                                if (PermanentCondition(cardSource.PermanentOfThisCard()))
+                                {
+                                    return true;
+                                }
                             }
                         }
                     }
@@ -109,7 +112,7 @@ namespace DCGO.CardEffects.EX8
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    if (card.Owner.SecurityCards.Count > 1)
+                    if (card.Owner.SecurityCards.Count >= 1)
                     {
                         // Add your bottom security card to the hand
                         CardSource bottomCard = card.Owner.SecurityCards[^1];

+ 68 - 51
Assets/CardEffect/EX8/Purple/EX8_059.cs

@@ -325,79 +325,96 @@ namespace DCGO.CardEffects.EX8
 
                                 if (selectedPermanent != null)
                                 {
-                                    ActivateClass activateClass1 = new ActivateClass();
-                                    activateClass1.SetUpICardEffect("Trash 1 card in your hand.", GivenEffectCanUseCondition, selectedPermanent.TopCard);
-                                    activateClass1.SetUpActivateClass(
-                                        GivenEffectCanActivateCondition,
-                                        GivenEffectActivateCoroutine,
-                                        -1,
-                                        false, GivenEffectDescription());
-                                    activateClass1.SetEffectSourcePermanent(selectedPermanent);
-                                    selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
-
                                     if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
                                     {
                                         yield return ContinuousController.instance.StartCoroutine(GManager.instance
                                             .GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
                                     }
 
-                                    string GivenEffectDescription()
+                                    AddSkillClass addSkillClass = new AddSkillClass();
+                                    addSkillClass.SetUpICardEffect("Trash 1 card in your hand", CanUseCondition1, card);
+                                    addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
+
+                                    card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => addSkillClass);
+
+                                    bool CanUseCondition1(Hashtable hashtable)
                                     {
-                                        return "[On Deletion] Trash 1 card in your hand.";
+                                        return true;
                                     }
 
-                                    bool GivenEffectCanUseCondition(Hashtable hashtable)
+                                    bool CardSourceCondition(CardSource cardSource)
                                     {
-                                        return CardEffectCommons.CanTriggerOnDeletion(hashtable, selectedPermanent.TopCard);
+                                        return (cardSource == selectedPermanent.TopCard) &&
+                                               !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
                                     }
 
-                                    bool GivenEffectCanActivateCondition(Hashtable hashtable1)
+                                    List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
                                     {
-                                        if (CardEffectCommons.CanActivateOnDeletion(selectedPermanent.TopCard))
+
+                                        if (_timing == EffectTiming.OnDestroyedAnyone)
                                         {
-                                            if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
+                                            ActivateClass activateClass1 = new ActivateClass();
+                                            activateClass1.SetUpICardEffect("Trash 1 card in your hand.", GivenEffectCanUseCondition, cardSource);
+                                            activateClass1.SetUpActivateClass(GivenEffectCanActivateCondition, GivenEffectActivateCoroutine, -1, false, GivenEffectDescription());
+                                            activateClass1.SetEffectSourceCard(cardSource);
+                                            cardEffects.Add(activateClass1);
+
+                                            if (cardSource.PermanentOfThisCard() != null)
                                             {
-                                                return true;
+                                                activateClass1.SetEffectSourcePermanent(cardSource.PermanentOfThisCard());
                                             }
-                                        }
-
-                                        return false;
-                                    }
-
-                                    IEnumerator GivenEffectActivateCoroutine(Hashtable _hashtable)
-                                    {
-                                        if (selectedPermanent.TopCard.Owner.HandCards.Count >= 1)
-                                        {
-                                            int discardCount = 1;
 
-                                            SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+                                            string GivenEffectDescription()
+                                            {
+                                                return "[On Deletion] Trash 1 card in your hand.";
+                                            }
 
-                                            selectHandEffect.SetUp(
-                                                selectPlayer: selectedPermanent.TopCard.Owner,
-                                                canTargetCondition: (cardSource) => true,
-                                                canTargetCondition_ByPreSelecetedList: null,
-                                                canEndSelectCondition: null,
-                                                maxCount: discardCount,
-                                                canNoSelect: false,
-                                                canEndNotMax: false,
-                                                isShowOpponent: true,
-                                                selectCardCoroutine: null,
-                                                afterSelectCardCoroutine: null,
-                                                mode: SelectHandEffect.Mode.Discard,
-                                                cardEffect: activateClass);
+                                            bool GivenEffectCanUseCondition(Hashtable hashtable)
+                                            {
+                                                return CardEffectCommons.CanTriggerOnDeletion(hashtable, cardSource);
+                                            }
 
-                                            yield return StartCoroutine(selectHandEffect.Activate());
-                                        }
-                                    }
+                                            bool GivenEffectCanActivateCondition(Hashtable hashtable1)
+                                            {
+                                                if (CardEffectCommons.CanActivateOnDeletion(cardSource))
+                                                {
+                                                    if (!cardSource.CanNotBeAffected(activateClass))
+                                                    {
+                                                        return true;
+                                                    }
+                                                }
+
+                                                return false;
+                                            }
 
-                                    ICardEffect GetCardEffect(EffectTiming _timing)
-                                    {
-                                        if (_timing == EffectTiming.OnDestroyedAnyone)
-                                        {
-                                            return activateClass1;
+                                            IEnumerator GivenEffectActivateCoroutine(Hashtable _hashtable)
+                                            {
+                                                if (cardSource.Owner.HandCards.Count >= 1)
+                                                {
+                                                    int discardCount = 1;
+
+                                                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                                                    selectHandEffect.SetUp(
+                                                        selectPlayer: cardSource.Owner,
+                                                        canTargetCondition: (cardSource) => true,
+                                                        canTargetCondition_ByPreSelecetedList: null,
+                                                        canEndSelectCondition: null,
+                                                        maxCount: discardCount,
+                                                        canNoSelect: false,
+                                                        canEndNotMax: false,
+                                                        isShowOpponent: true,
+                                                        selectCardCoroutine: null,
+                                                        afterSelectCardCoroutine: null,
+                                                        mode: SelectHandEffect.Mode.Discard,
+                                                        cardEffect: activateClass);
+
+                                                    yield return StartCoroutine(selectHandEffect.Activate());
+                                                }
+                                            }
                                         }
 
-                                        return null;
+                                        return cardEffects;
                                     }
                                 }
                             }

+ 12 - 3
Assets/CardEffect/EX8/Purple/EX8_071.cs

@@ -43,12 +43,14 @@ namespace DCGO.CardEffects.EX8
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistInSecurity(card, false);
+                    return CardEffectCommons.IsExistInSecurity(card, false) &&
+                        CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
                 }
 
                 bool PermanentCondition(Permanent permanent)
                 {
                     return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
+                           permanent.TopCard.HasLevel && permanent.TopCard.Level >= 4 &&
                            permanent.TopCard.EqualsTraits("NSo");
                 }
 
@@ -75,7 +77,14 @@ namespace DCGO.CardEffects.EX8
                 {
                     if (_timing == EffectTiming.WhenPermanentWouldBeDeleted)
                     {
-                        cardEffects.Add(CardEffectFactory.ScapegoatSelfEffect(isInheritedEffect: false, card: card, condition: null, effectName: "<Scapegoat>", effectDiscription: null));
+                        bool Condition()
+                        {
+                            return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(cardSource.PermanentOfThisCard(), cardSource) &&
+                                   cardSource.HasLevel && cardSource.Level >= 4 &&
+                                   cardSource.EqualsTraits("NSo");
+                        }
+
+                        cardEffects.Add(CardEffectFactory.ScapegoatSelfEffect(isInheritedEffect: false, card: cardSource, condition: Condition, effectName: "<Scapegoat>", effectDiscription: null));
                     }
 
                     return cardEffects;
@@ -105,7 +114,7 @@ namespace DCGO.CardEffects.EX8
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    if(card.Owner.SecurityCards.Count > 1)
+                    if(card.Owner.SecurityCards.Count >= 1)
                     {
                         // Add your bottom security card to the hand
                         CardSource bottomCard = card.Owner.SecurityCards[^1];

+ 1 - 4
Assets/CardEffect/P/Black/P_159.cs

@@ -48,10 +48,7 @@ namespace DCGO.CardEffects.P
 
                 bool HasDigimon(Permanent permanent)
                 {
-                    if (CardEffectCommons.IsOwnerPermanent(permanent, card))
-                        return permanent.IsDigimon;
-
-                    return false;
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
                 }
 
                 bool CanUseCondition(Hashtable hashtable)

+ 1 - 1
Assets/CardEffect/P/Black/P_162.cs

@@ -184,7 +184,7 @@ namespace DCGO.CardEffects.P
                         mode: SelectPermanentEffect.Mode.Custom,
                         cardEffect: activateClass);
 
-                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
+                    selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain effects.", "The opponent is selecting 1 Digimon that will gain effects.");
 
                     yield return StartCoroutine(selectPermanentEffect.Activate());
 

+ 8 - 5
Assets/CardEffect/P/Blue/P_168.cs

@@ -49,7 +49,7 @@ namespace DCGO.CardEffects.P
             
             if (timing == EffectTiming.OnAddDigivolutionCards)
             {
-                List<Permanent> sourcesAddedPermanents = new List<Permanent>();
+                Permanent sourcesAddedPermanent = null;
 
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Digivolve 1 of you Digimon", CanUseCondition, card);
@@ -63,7 +63,8 @@ namespace DCGO.CardEffects.P
 
                 bool IsValidPermanentToDigivolveCondition(Permanent permanent)
                 {
-                    return permanent.TopCard.EqualsTraits("Aqua") || permanent.TopCard.EqualsTraits("Sea Animal");
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
+                           (permanent.TopCard.EqualsTraits("Aqua") || permanent.TopCard.EqualsTraits("Sea Animal"));
                 }
 
                 bool IsValidCardToDigivolveIntoCondition(CardSource cardSource)
@@ -90,15 +91,17 @@ namespace DCGO.CardEffects.P
 
                 bool CanSelectDigimonToDigivolve(Permanent permanent)
                 {
-                    return sourcesAddedPermanents.Contains(permanent) &&
+                    return sourcesAddedPermanent == permanent &&
                            CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    sourcesAddedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(IsValidPermanentToDigivolveCondition);
+                    sourcesAddedPermanent = CardEffectCommons.GetPermanentFromHashtable(hashtable);
 
-                    return isExistOnField(card) && CardEffectCommons.CanActivateSuspendCostEffect(card);
+                    return isExistOnField(card) && 
+                           CardEffectCommons.CanActivateSuspendCostEffect(card) &&
+                           IsValidPermanentToDigivolveCondition(sourcesAddedPermanent);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)