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

Merge pull request #1226 from DCGO2/Warning-Merge

Warning merge
x89rt2 3 месяцев назад
Родитель
Сommit
13e4a6a60e

+ 10 - 0
Assets/Scripts/CardEffect/BT11/Purple/BT11_087.cs

@@ -361,6 +361,7 @@ namespace DCGO.CardEffects.BT11
                             activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
                             activateClass1.SetEffectSourcePermanent(selectedPermanent);
                             selectedPermanent.UntilEachTurnEndEffects.Add(GetCardEffect);
+                            selectedPermanent.UntilEachTurnEndEffects.Add(GetDetailEffect);
 
                             yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
 
@@ -421,6 +422,15 @@ namespace DCGO.CardEffects.BT11
 
                                 return null;
                             }
+
+                            ICardEffect GetDetailEffect(EffectTiming timing)
+                            {
+                                if (timing == EffectTiming.None)
+                                {
+                                    return PermanentEffectFactory.AddDetailClass(selectedPermanent, "[When Attacking] Lose 3 Memory", true, activateClass);
+                                }
+                                return null;
+                            }
                         }
                     }
                 }

+ 7 - 0
Assets/Scripts/CardEffect/BT14/Green/BT14_044.cs

@@ -102,6 +102,13 @@ namespace DCGO.CardEffects.BT14
                                     cardEffect: activateClass1,
                                     timing: EffectTiming.OnTappedAnyone);
 
+                                CardEffectCommons.AddEffectToPermanent(
+                                    targetPermanent: selectedPermanent,
+                                    effectDuration: EffectDuration.UntilOpponentTurnEnd,
+                                    card: card,
+                                    cardEffect: PermanentEffectFactory.AddDetailClass(selectedPermanent, "[All Turns] When this Digimon becomes suspended, lose 2 memory.", true, activateClass),
+                                    timing: EffectTiming.None);
+
                                 string EffectDiscription1()
                                 {
                                     return "[All Turns] When this Digimon becomes suspended, lose 2 memory.";

+ 15 - 0
Assets/Scripts/CardEffect/BT20/Black/BT20_059.cs

@@ -96,6 +96,7 @@ namespace DCGO.CardEffects.BT20
                         canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseConditionImmunity, card);
                         canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
                         card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
+                        card.Owner.UntilOpponentTurnEndEffects.Add(GetDetailEffect);
 
                         bool CanUseConditionImmunity(Hashtable hashtable)
                         {
@@ -137,6 +138,20 @@ namespace DCGO.CardEffects.BT20
 
                             return null;
                         }
+
+                        bool PermanentCondition(Permanent permanent)
+                        {
+                            return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
+                        }
+
+                        ICardEffect GetDetailEffect(EffectTiming timing)
+                        {
+                            if (timing == EffectTiming.None)
+                            {
+                                return CardEffectFactory.AddDetailClass(CanUseConditionImmunity, PermanentCondition, "Isn't affected by opponent's Digimon's effects", false, activateClass.EffectSourceCard);
+                            }
+                            return null;
+                        }
                     }
                 }
             }

+ 73 - 51
Assets/Scripts/CardEffect/BT25/Green/BT25_004.cs

@@ -1,91 +1,113 @@
-using System;
 using System.Collections;
 using System.Collections.Generic;
-using System.Linq;
 
-// Tapmon
+// Lekismon
 namespace DCGO.CardEffects.BT25
 {
-    public class BT25_004 : CEntity_Effect
+    public class BT25_024 : CEntity_Effect
     {
-        
         public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
         {
             List<ICardEffect> cardEffects = new List<ICardEffect>();
 
-            #region Shared Conditions
-
-            bool CardCondition(CardSource cardSource)
+            #region Alt Digivolution Condition
+            if (timing == EffectTiming.None)
             {
-                return cardSource.EqualsTraits("Social")
-                    || cardSource.EqualsTraits("Tool")
-                    || cardSource.EqualsTraits("Game");
+                static bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.HasTSTraits;
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
             }
+            #endregion
 
-            bool PermanentCondition(Permanent permanent) => permanent == card.PermanentOfThisCard();
+            #region Shared OP/WD
+            string SharedEffectName = "<Draw 1>";
 
-            bool RootCondition(SelectCardEffect.Root root) => true;
+            CardEffectFactory.ActivateClassesForSharedEffects
+            (ref cardEffects, timing, card,
+                SharedEffectName,
+                SharedActivateCoroutine,
+                SharedEffectDescription,
+                optional: false,
+                onPlay: true,
+                whenDigivolving: true);
 
+            string SharedEffectDescription(string tag)
+            {
+                return $"[{tag}] <Draw 1>";
+            }
+
+            IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
+            {
+                yield return ContinuousController.instance.StartCoroutine(new DrawClass(
+                    player: card.Owner,
+                    drawCount: 1,
+                    cardEffect: activateClass).Draw()
+                );
+            }
             #endregion
 
-            #region Reduce Link Cost
-            if (timing == EffectTiming.BeforePayCost)
+            #region Your Turn
+            if (timing == EffectTiming.OnEnterFieldAnyone)
             {
-                ActivateClass activateClass = new ();
-                activateClass.SetUpICardEffect("May reduce Link cost by 1", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
-                activateClass.SetIsInheritedEffect(true);
-                activateClass.SetHashString("BT25_004_YT");
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Place 1 [Mineral]/[Rock] trait card from hand or trash under played/digivolved digimon", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription() => "[Your Turn] When your Digimon are played or digivolve, if any of them are red, this Digimon may digivolve into [Crescemon] in the trash with the cost reduced by 1.";
+
+                bool CanUseCondition(Hashtable hashtable)
                 {
-                    return "[Your Turn] [Once Per Turn] When a [Social], [Tool] or [Game] trait card would link to this Digimon, you may reduce the cost by 1.";
+                    return CardEffectCommons.IsExistOnBattleArea(card)
+                        && CardEffectCommons.IsOwnerTurn(card)
+                        && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition)
+                            || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition));
                 }
 
-                bool CanUseCondition(Hashtable hashtable)
+                bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card)
-                        && CardEffectCommons.CanTriggerWhenWouldLink(hashtable, CardCondition, PermanentCondition)
-                        && CardEffectCommons.IsOwnerTurn(card);
+                        && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
+                }
+
+                bool PermanentCondition(Permanent permanent)
+                {
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
+                        && permanent.TopCard.CardColors.Contains(CardColor.Red);
                 }
 
-                bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
+                bool CanSelectCardCondition(CardSource cardSource)
+                {
+                    return cardSource.EqualsCardName("Crescemon")
+                        && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass); ;
+                }
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
-                    card.Owner.UntilCalculateFixedCostEffect.Add((timing) => CardEffectFactory.GrantedReduceLinkCostClass(
-                        card: card, 
-                        reducedCost: 1,
-                        cardSourceCondition: CardCondition,
-                        permanentCondition: PermanentCondition,
-                        rootCondition: RootCondition
-                    ));
-
-                    yield return null;
+                    yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
+                        targetPermanent: card.PermanentOfThisCard(),
+                        cardCondition: CanSelectCardCondition,
+                        payCost: true,
+                        reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
+                        fixedCostTuple: null,
+                        ignoreDigivolutionRequirementFixedCost: -1,
+                        isHand: false,
+                        activateClass: activateClass,
+                        successProcess: null));
                 }
             }
             #endregion
 
-            #region Reduce Link cost - Not Shown
+            #region Inherited Effect - Jamming
             if (timing == EffectTiming.None)
             {
-                cardEffects.Add(CardEffectFactory.ReduceLinkCostClass(
-                    card: card, 
-                    canUseCondition: CanUseCondition,
+                cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
                     isInheritedEffect: true,
-                    isOptional: true,
-                    reducedCost: 1,
-                    cardSourceCondition: CardCondition,
-                    permanentCondition: PermanentCondition,
-                    rootCondition: RootCondition
-                ));
-
-                bool CanUseCondition(Hashtable hashtable)
-                {
-                    return CardEffectCommons.IsExistOnBattleArea(card)
-                        && CardEffectCommons.IsOwnerTurn(card);
-                }
+                    card: card,
+                    condition: null));
             }
             #endregion
 

+ 9 - 0
Assets/Scripts/CardEffect/EX6/Purple/EX6_057.cs

@@ -152,6 +152,15 @@ namespace DCGO.CardEffects.EX6
 
                                     return null;
                                 }
+
+                                ICardEffect GetDetailEffect(EffectTiming timing)
+                                {
+                                    if (timing == EffectTiming.None)
+                                    {
+                                        return PermanentEffectFactory.AddDetailClass(permanent, "[End of your turn] Delete this Digimon", true, activateClass);
+                                    }
+                                    return null;
+                                }
                             }
                         }
                     }

+ 2 - 2
Assets/Scripts/CardEffect/ST23/Black/ST23_14.cs

@@ -58,7 +58,7 @@ namespace DCGO.CardEffects.ST23
             }
             #endregion       
 
-            #region Your Turns
+            #region Your Turn
             if (timing == EffectTiming.OnDigivolutionCardDiscarded)
             {
                 ActivateClass activateClass = new ActivateClass();
@@ -81,7 +81,7 @@ namespace DCGO.CardEffects.ST23
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card)
-                        && card.PermanentOfThisCard().CanSuspend;
+                        && CardEffectCommons.CanActivateSuspendCostEffect(card);
                 }
 
                 bool CanSelectPermanentCondition(Permanent permanent)

+ 2 - 2
Assets/Scripts/CardEffect/ST23/Green/ST23_13.cs

@@ -59,7 +59,7 @@ namespace DCGO.CardEffects.ST23
             }
             #endregion       
 
-            #region Your Turns
+            #region Your Turn
             if (timing == EffectTiming.OnDigivolutionCardDiscarded)
             {
                 ActivateClass activateClass = new ActivateClass();
@@ -82,7 +82,7 @@ namespace DCGO.CardEffects.ST23
                 bool CanActivateCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsExistOnBattleArea(card)
-                        && card.PermanentOfThisCard().CanSuspend;
+                        && CardEffectCommons.CanActivateSuspendCostEffect(card);
                 }
 
                 bool CanSelectPermanentCondition(Permanent permanent)

+ 2 - 1
Assets/Scripts/CardEffect/ST24/Green/ST24_14.cs

@@ -101,7 +101,8 @@ namespace DCGO.CardEffects.ST24
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleArea(card);
+                    return CardEffectCommons.IsExistOnBattleArea(card)
+                        && CardEffectCommons.CanActivateSuspendCostEffect(card);
                 }
 
                 bool CanSelectPermanentCondition(Permanent permanent)

+ 2 - 1
Assets/Scripts/CardEffect/ST24/Yellow/ST24_13.cs

@@ -101,7 +101,8 @@ namespace DCGO.CardEffects.ST24
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnBattleArea(card);
+                    return CardEffectCommons.IsExistOnBattleArea(card)
+                        && CardEffectCommons.CanActivateSuspendCostEffect(card);
                 }
 
                 bool CanSelectPermanentCondition(Permanent permanent)

+ 15 - 0
Assets/Scripts/Script/CardEffectCommons/GiveEffect/GiveEffectToPermanent/DeleteSelf.cs

@@ -15,7 +15,13 @@ public partial class CardEffectCommons
     {
         bool deleteOnOwnturn = deleteTiming != DeleteTiming.AtOpponentTurnEnd;
         bool deleteOnOpponentsTurn = deleteTiming != DeleteTiming.AtOwnTurnEnd;
+        string message = "Delete this at turn end";
+        if (deleteOnOpponentsTurn && !deleteOnOwnturn)
+            message = "Delete this at opponent's turn end";
+        if (deleteOnOwnturn && ! deleteOnOpponentsTurn)
+            message = "Delete this at your turn end.";
         permanent.PermanentEffects.Add(GetCardEffect);
+        permanent.PermanentEffects.Add(GetDetailEffect);
 
         ICardEffect GetCardEffect(EffectTiming timing)
         {
@@ -26,6 +32,15 @@ public partial class CardEffectCommons
             return null;
         }
 
+        ICardEffect GetDetailEffect(EffectTiming timing)
+        {
+            if (timing == EffectTiming.None)
+            {
+                return PermanentEffectFactory.AddDetailClass(permanent, message, true, activateClass);
+            }
+            return null;
+        }
+
         yield return null;
     }
 }

+ 10 - 0
Assets/Scripts/Script/CardEffectCommons/KeyWordEffects/Execute.cs

@@ -72,6 +72,7 @@ public partial class CardEffectCommons
             #region Delete this Digimon
 
             selectedPermanent.UntilEndAttackEffects.Add(GetCardEffect);
+            selectedPermanent.UntilEndAttackEffects.Add(GetDetailEffect);
 
             ICardEffect GetCardEffect(EffectTiming timing)
             {
@@ -82,6 +83,15 @@ public partial class CardEffectCommons
                 return null;
             }
 
+            ICardEffect GetDetailEffect(EffectTiming timing)
+            {
+                if (timing == EffectTiming.None)
+                {
+                    return PermanentEffectFactory.AddDetailClass(selectedPermanent, "At end of attack, delete this Digimon.", true, activateClass);
+                }
+                return null;
+            }
+
             #endregion
         }
     }

+ 11 - 1
Assets/Scripts/Script/CardEffectFactory.cs

@@ -1519,4 +1519,14 @@ public partial class CardEffectFactory
         }
     }
     #endregion
-}
+
+    #region Add detail for Display
+    public static AddDetailClass AddDetailClass(Func<Hashtable, bool> canUseCondition, Func<Permanent, bool> permanentCondition, string detail, bool triggerEffect, CardSource card)
+    {
+        AddDetailClass addDetailClass = new();
+        addDetailClass.SetUpICardEffect("Added Detail", canUseCondition, card);
+        addDetailClass.SetUpAddDetailClass(permanentCondition, detail, triggerEffect);
+        return addDetailClass;
+    }
+    #endregion
+}

+ 9 - 0
Assets/Scripts/Script/CardEffectInterfaces.cs

@@ -87,6 +87,15 @@ public interface IAddSkillEffect
 }
 #endregion
 
+#region Label additional text to appear in Permanent Details
+public interface IAddDetailEffect
+{
+    bool PermanentCondition(Permanent permanent);
+    string GetDetail();//Used to avoid any interactions already built in to effect name
+    bool TriggerEffect();//Unused for now, but could be used to display something on the card to indicate it has gained an additional triggered effect, eg. [When Attacking] Lose 3 Memory
+}
+#endregion
+
 #region "Target card cannot be affected by effects" effect
 public interface ICanNotAffectedEffect
 {

+ 34 - 0
Assets/Scripts/Script/CardEffects/AddDetailClass.cs

@@ -0,0 +1,34 @@
+using System.Collections;
+using System.Collections.Generic;
+using System;
+
+public class AddDetailClass : ICardEffect, IAddDetailEffect
+{
+    Func<Permanent, bool> _permanentCondition = null;
+    string _detail = null;
+    bool _triggerEffect = false;
+
+    public void SetUpAddDetailClass(Func<Permanent, bool> permanentCondition, string detail, bool triggerEffect)
+    {
+        _permanentCondition = permanentCondition;
+        _detail = detail;
+        _triggerEffect = triggerEffect;
+    }
+
+    public bool PermanentCondition(Permanent permanent)
+    {
+        return _permanentCondition != null
+            && permanent != null
+            && permanent.TopCard != null
+            && _permanentCondition(permanent);
+    }
+    public string GetDetail()
+    {
+        return _detail;
+    }
+
+    public bool TriggerEffect()
+    {
+        return _triggerEffect;
+    }
+}

+ 20 - 1
Assets/Scripts/Script/DeckData.cs

@@ -433,7 +433,7 @@ public class DeckData
         }
 
         DeckCards1 = DeckCards1
-            .OrderBy(value => Array.IndexOf(DataBase.cardKinds, value.cardKind))
+            .OrderBy(value => GetCardKindPriority(value.cardKind))
             .ThenBy(value => value.Level)
             .ThenBy(value => Array.IndexOf(DataBase.cardColors, value.cardColors[0]))
             .ThenByDescending(value => value.PlayCost)
@@ -442,6 +442,25 @@ public class DeckData
             .ToList();
 
         return DeckCards1;
+
+        static int GetCardKindPriority(List<CardKind> kinds)
+        {
+            if (kinds == null || kinds.Count == 0)
+                return 99;
+
+            bool hasDigimon = kinds.Contains(CardKind.Digimon);
+            bool hasOption = kinds.Contains(CardKind.Option);
+            bool hasTamer = kinds.Contains(CardKind.Tamer);
+            bool hasEgg = kinds.Contains(CardKind.DigiEgg);
+
+            if (hasEgg && kinds.Count == 1) return 0;
+            if (hasDigimon && kinds.Count == 1) return 1;
+            if (hasDigimon && hasOption && kinds.Count == 2) return 2;
+            if (hasTamer && kinds.Count == 1) return 3;
+            if (hasOption && kinds.Count == 1) return 4;
+
+            return 99;
+        }
     }
 
     public static List<CEntity_Base> SortedCardPoolList(List<CEntity_Base> DeckCards)

+ 11 - 0
Assets/Scripts/Script/GameRandom.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9233e5cc47a707e4b8f802211e635f71
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 45 - 0
Assets/Scripts/Script/PermanentDetail.cs

@@ -290,6 +290,11 @@ public class PermanentDetail : MonoBehaviour
                 continue;
             }
 
+            if (cardEffect is IAddDetailEffect)
+            {
+                continue;
+            }
+
             if (cardEffect.IsNotShowUI)
             {
                 continue;
@@ -299,6 +304,46 @@ public class PermanentDetail : MonoBehaviour
         }
         #endregion
 
+        #region AddDetails
+        foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
+        {
+            #region Effects of permanents in play
+            foreach (Permanent otherPermanent in player.GetFieldPermanents())
+            {
+                foreach (ICardEffect cardEffect in otherPermanent.EffectList(EffectTiming.None))
+                {
+                    if (cardEffect is IAddDetailEffect)
+                    {
+                        if (cardEffect.CanTrigger(null))
+                        {
+                            if (((IAddDetailEffect)cardEffect).PermanentCondition(permanent))
+                            {
+                                effectString += $"- {((IAddDetailEffect)cardEffect).GetDetail()}\n";
+                            }
+                        }
+                    }
+                }
+            }
+            #endregion
+
+            #region Effects of Players
+            foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
+            {
+                if (cardEffect is IAddDetailEffect)
+                {
+                    if (cardEffect.CanTrigger(null))
+                    {
+                        if (((IAddDetailEffect)cardEffect).PermanentCondition(permanent))
+                        {
+                            effectString += $"- {((IAddDetailEffect)cardEffect).GetDetail()}\n";
+                        }
+                    }
+                }
+            }
+            #endregion
+        }
+        #endregion
+
         effectText.text = effectString.Replace("、", ",").Replace(",", ",");
         effectText.raycastTarget = false;
 

+ 19 - 0
Assets/Scripts/Script/PermanentEffectFactory.cs

@@ -115,4 +115,23 @@ public partial class PermanentEffectFactory
         bool PermanentCondition(Permanent permanent) => permanent == targetPermanent;
     }
     #endregion
+
+    #region Add Detail for Display
+    public static AddDetailClass AddDetailClass(Permanent targetPermanent, string detail, bool triggerEffect, ICardEffect activateClass)
+    {
+        return CardEffectFactory.AddDetailClass(CanUseCondition, PermanentCondition, detail, triggerEffect, activateClass.EffectSourceCard);
+
+        bool PermanentCondition(Permanent permanent)
+        {
+            return permanent != null
+                && permanent == targetPermanent;
+        }
+
+        bool CanUseCondition(Hashtable hashtable)
+        {
+            return CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent)
+                && !targetPermanent.TopCard.CanNotBeAffected(activateClass);
+        }
+    }
+    #endregion
 }