Quellcode durchsuchen

Round 2 BT21 fixes, added new timing adding it to armor purge and de-digivolve

mbunch_kascope vor 1 Jahr
Ursprung
Commit
e23c31e844

+ 1 - 1
Assets/CardEffect/BT21/Black/BT21_060.cs

@@ -97,7 +97,7 @@ namespace DCGO.CardEffects.BT21
                         CanNotTrashFromDigivolutionCardsClass canNotTrashFromDigivolutionCardsClass = new CanNotTrashFromDigivolutionCardsClass();
                         canNotTrashFromDigivolutionCardsClass.SetUpICardEffect("[This Digimon's sources can't be trashed", CanUseCondition2, card);
                         canNotTrashFromDigivolutionCardsClass.SetUpCanNotTrashFromDigivolutionCardsClass(CardCondition: CardCondition, CardEffectCondition: CardEffectCondition);
-                        cardEffects.Add(canNotTrashFromDigivolutionCardsClass);
+                        selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotTrashFromDigivolutionCardsClass);
 
                         bool CanUseCondition2(Hashtable hashtable)
                         {

+ 7 - 5
Assets/CardEffect/BT21/Blue/BT21_094.cs

@@ -74,8 +74,7 @@ namespace DCGO.CardEffects.BT21
 
             #region Delay Effect
 
-            // TODO Make on top stacked card trashed
-            if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
+            if (timing == EffectTiming.WhenTopCardTrashed)
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Digivolve into a Digimon card with [Armor Form] trait in your hand", CanUseCondition, card);
@@ -89,11 +88,15 @@ namespace DCGO.CardEffects.BT21
                         "[All Turns] When the top stacked card of any your [Armor Form] trait Digimon is trashed, [Delay] • 1 of your Digimon may digivolve into a Digimon card with the [Armor Form] in the hand without paying the cost.";
                 }
 
+                bool TrashedCardCondition(CardSource cardSource)
+                {
+                    return cardSource.EqualsTraits("Armor Form");
+                }
+
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    // TODO Make on top stacked card trashed
                     return CardEffectCommons.CanDeclareOptionDelayEffect(card) &&
-                           CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, CanSelectPermanentCondition);
+                           CardEffectCommons.CanTriggerWhenTopCardTrashed(hashtable, TrashedCardCondition);
                 }
 
                 bool CanSelectHandCardCondition(CardSource cardSource)
@@ -105,7 +108,6 @@ namespace DCGO.CardEffects.BT21
                 bool CanSelectPermanentCondition(Permanent permanent)
                 {
                     return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
-                           permanent.TopCard.EqualsTraits("Armor Form") &&
                            card.Owner.HandCards.Where(CanSelectHandCardCondition).Any(cardSource =>
                                cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
                 }

+ 2 - 2
Assets/CardEffect/BT21/Purple/BT21_068.cs

@@ -201,12 +201,12 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card);
+                    return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.CanActivateOnDeletion(card))
+                    if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
                     {
                         if (card.Owner.CanAddMemory(activateClass))
                         {

+ 8 - 1
Assets/CardEffect/BT21/Purple/BT21_072.cs

@@ -22,6 +22,7 @@ namespace DCGO.CardEffects.BT21
                 cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(validDigivolutionCondition, 3, false, card, null));
             }
             #endregion
+
             #region raid, piercing
             if (timing == EffectTiming.OnAllyAttack)
             {
@@ -33,6 +34,7 @@ namespace DCGO.CardEffects.BT21
                 cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
             }
             #endregion
+
             #region When Digivolving
             if (timing == EffectTiming.OnEnterFieldAnyone)
             {
@@ -88,7 +90,12 @@ namespace DCGO.CardEffects.BT21
             {
                 int count()
                 {
-                    return card.PermanentOfThisCard().DigivolutionCards.Count();
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        return card.PermanentOfThisCard().DigivolutionCards.Count();
+                    }
+
+                    return 0;
                 }
 
                 bool condition()

+ 16 - 4
Assets/CardEffect/BT21/Purple/BT21_073.cs

@@ -11,6 +11,18 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
+            #region Alternative Digivolution Condition - Sup.
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.EqualsTraits("Sup.");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
+            }
+            #endregion
+
             #region  Appfusion
             if (timing == EffectTiming.None)
             {
@@ -20,7 +32,6 @@ namespace DCGO.CardEffects.BT21
                 addAppFusionConditionClass.SetNotShowUI(true);
                 cardEffects.Add(addAppFusionConditionClass);
 
-                
                 bool CanUseCondition(Hashtable hashtable)
                 {
                     return true;
@@ -95,7 +106,8 @@ namespace DCGO.CardEffects.BT21
 
             bool CanActivateConditionShared(Hashtable hashtable)
             {
-                return isExistOnField(card) && (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanLinkCondition) ||
+                return isExistOnField(card) && 
+                    (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanLinkCondition) ||
                     card.PermanentOfThisCard().DigivolutionCards.Exists(CanLinkCondition));
             }
             #endregion
@@ -515,7 +527,7 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                    return CardEffectCommons.IsExistLinked(card) &&
                            CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
                     
                 }
@@ -540,7 +552,7 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
+                    return CardEffectCommons.IsExistLinked(card) &&
                            !card.PermanentOfThisCard().HasNoLinkCards;
                 }
 

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

@@ -12,13 +12,29 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            #region Digivolution condition
-            if(timing == EffectTiming.None)
+            #region Alternate Digivolution Requirement - Three Musketeers
+
+            if (timing == EffectTiming.None)
+            {
+                static bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.Level == 4 && targetPermanent.TopCard.HasText("Three Musketeers");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
+            }
+
+            #endregion
+
+            #region Alternative Digivolution Condition - Sup.
+            if (timing == EffectTiming.None)
             {
-                bool Condition(Permanent permanent)
+                bool PermanentCondition(Permanent targetPermanent)
                 {
-                    return permanent.Level == 4 && permanent.TopCard.HasText("Three Musketeers");
+                    return targetPermanent.TopCard.EqualsTraits("Sup.");
                 }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
             }
             #endregion
 
@@ -58,7 +74,7 @@ namespace DCGO.CardEffects.BT21
             #region OnPlay/WhenDigivolving/WhenAttacking shared
             bool CanTuckOrTrash(CardSource cardSource)
             {
-                return card.EqualsTraits("Appmon") || card.HasThreeMusketeersTraits;
+                return cardSource.EqualsTraits("Appmon") || cardSource.HasThreeMusketeersTraits;
             }
             #endregion
 
@@ -415,7 +431,8 @@ namespace DCGO.CardEffects.BT21
             #region When Digivolving/When Attacking shared
             bool CanActivateConditionAtkShared(Hashtable hashtable)
             {
-                return isExistOnField(card) && card.PermanentOfThisCard().DigivolutionCards.Some(CanTuckOrTrash);
+                return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && 
+                       card.PermanentOfThisCard().DigivolutionCards.Some(CanTuckOrTrash);
             }
 
             bool DedigivolveTarget(Permanent permanent)
@@ -661,7 +678,7 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return isExistOnField(card) && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, DeletionTargetCondition);
+                    return isExistOnField(card) && CardEffectCommons.HasMatchConditionPermanent(DeletionTargetCondition);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)

+ 4 - 5
Assets/CardEffect/BT21/Purple/BT21_077.cs

@@ -128,8 +128,7 @@ namespace DCGO.CardEffects.BT21
 
                                 if (selectedPermanent != null)
                                 {
-
-                                    CardEffectCommons.GainCollision(selectedPermanent, EffectDuration.UntilOpponentTurnEnd, activateClass);
+                                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBarrier(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
 
                                     ActivateClass activateClassDebuff = new ActivateClass();
                                     activateClassDebuff.SetUpICardEffect("Attack with this Digimon", CanUseConditionDebuff,
@@ -285,7 +284,7 @@ namespace DCGO.CardEffects.BT21
                                 if (selectedPermanent != null)
                                 {
 
-                                    CardEffectCommons.GainCollision(selectedPermanent, EffectDuration.UntilOpponentTurnEnd, activateClass);
+                                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBarrier(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
 
                                     ActivateClass activateClassDebuff = new ActivateClass();
                                     activateClassDebuff.SetUpICardEffect("Attack with this Digimon", CanUseConditionDebuff,
@@ -449,7 +448,7 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card);
+                    return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
                 }
 
                 bool CanPlay(CardSource cardSource)
@@ -460,7 +459,7 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.CanTriggerOnDeletion(hashtable, card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlay);
+                    return CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlay);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)

+ 6 - 10
Assets/CardEffect/BT21/Purple/BT21_089.cs

@@ -11,7 +11,6 @@ namespace DCGO.CardEffects.BT21
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-
             #region Start of Main Phase
             if (timing == EffectTiming.OnStartMainPhase)
             {
@@ -71,7 +70,7 @@ namespace DCGO.CardEffects.BT21
 
                 string EffectDescription()
                 {
-                    return "[All Turns] When any of your Digimon are played or digivolve, by suspending this Tamer, until your opponent's turn ends, 1 of your Digimon with [Guilmon], [Growlmon], [Gallantmon], or [Megidramon] in its name or the [Hero] trait gains <Blocker> and, it here are 10 or more total cards in both players' trashes, gets + 2000 DP.";
+                    return "[All Turns] When any of your Digimon are played or digivolve, by suspending this Tamer, until your opponent's turn ends, 1 of your Digimon with [Guilmon], [Growlmon], [Gallantmon], or [Megidramon] in its name or the [Hero] trait gains <Blocker> and, it here are 10 or more total cards in both players' trashes, gets +2000 DP.";
                 }
 
                 bool MyDigimonPlayedDigid(Permanent permanent)
@@ -81,16 +80,13 @@ namespace DCGO.CardEffects.BT21
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                    if (isExistOnField(card))
                     {
-                        if (CardEffectCommons.IsOwnerTurn(card))
-                        {
-                            if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, MyDigimonPlayedDigid))
-                                return true;
+                        if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, MyDigimonPlayedDigid))
+                            return true;
 
-                            if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, MyDigimonPlayedDigid))
-                                return true;
-                        }
+                        if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, MyDigimonPlayedDigid))
+                            return true;
                     }
 
                     return false;

+ 14 - 0
Assets/Scripts/CardController.cs

@@ -3784,6 +3784,20 @@ public class IDegeneration
                 count++;
             }
 
+            #region "When Top Card is Trashed" effect
+            #region Hashtable Setting
+            System.Collections.Hashtable hashtable = new System.Collections.Hashtable()
+                        {
+                            {"Permanent", _permanent},
+                            {"CardSources", selectedCards}
+                        };
+            #endregion
+
+            yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing
+                .StackSkillInfos(hashtable, EffectTiming.WhenTopCardTrashed));
+
+            #endregion
+
             #region add log
             if (selectedCards.Count >= 1)
             {

+ 18 - 0
Assets/Scripts/CardEffectCommons/CanUseEffects/WhenRemoveField.cs

@@ -31,4 +31,22 @@ public partial class CardEffectCommons
         return false;
     }
     #endregion
+
+    #region Can trigger "When top card of a permanent is trashed" effects of 1 permanent
+
+    public static bool CanTriggerWhenTopCardTrashed(Hashtable hashtable, Func<CardSource, bool> cardCondition)
+    {
+        List<CardSource> cards = GetCardSourcesFromHashtable(hashtable);
+
+        if (cards != null && cardCondition != null)
+        {
+            if (cards.Count((card) => card != null && cardCondition(card)) >= 1)
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+    #endregion
 }

+ 15 - 1
Assets/Scripts/CardEffectCommons/KeyWordEffects/ArmorPurge.cs

@@ -64,7 +64,21 @@ public partial class CardEffectCommons
 
                         _permanent.HideDeleteEffect();
 
-                        #region ƒ�ƒO’ljÁ
+                        #region "When Top Card is Trashed" effect
+                        #region Hashtable Setting
+                        System.Collections.Hashtable hashtable = new System.Collections.Hashtable()
+                        {
+                            {"Permanent", _permanent},
+                            {"CardSources", new List<CardSource> { topCard } }
+                        };
+                        #endregion
+
+                        yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing
+                            .StackSkillInfos(hashtable,EffectTiming.WhenTopCardTrashed));
+
+                        #endregion
+
+                        #region Log
                         string log = "";
 
                         log += $"\nArmor Purge :";

+ 2 - 1
Assets/Scripts/ICardEffect.cs

@@ -796,7 +796,8 @@ public enum EffectTiming
     OnReturnCardsToHandFromTrash,
     AfterEffectsActivate,
     WhenWouldDigivolutionCardDiscarded,
-    WhenLinked
+    WhenLinked,
+    WhenTopCardTrashed
 }
 #endregion