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

Fix for effects being skipped when DNA by effect multiples with same card

BennAbbot 1 месяц назад
Родитель
Сommit
1a81e3b277
1 измененных файлов с 7 добавлено и 2 удалено
  1. 7 2
      Assets/Scripts/Script/CardEffectCommons/DNADigivolveEffects.cs

+ 7 - 2
Assets/Scripts/Script/CardEffectCommons/DNADigivolveEffects.cs

@@ -551,8 +551,13 @@ public partial class CardEffectCommons
         bool processSuccessful = false;
         if (dnaTarget != null)
         {
-            Component component = activateClass.EffectSourceCard.cEntity_EffectController.gameObject.AddComponent(typeof (SetJogressEvoRootsController));
-            SetJogressEvoRootsController controller = (SetJogressEvoRootsController)component;
+            SetJogressEvoRootsController controller;
+
+            if (!activateClass.EffectSourceCard.cEntity_EffectController.gameObject.TryGetComponent(out controller))
+            {
+                controller = activateClass.EffectSourceCard.cEntity_EffectController.gameObject.AddComponent<SetJogressEvoRootsController>();
+            }
+
             int[] _jogressEvoRootsFrameIDs = new int[0];
 
             if (owner.isYou || GManager.instance.IsAI)