From 64d526e0f5b9f49fe5bd6dcf043f5071d996e7ad Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 24 四月 2026 11:04:29 +0800
Subject: [PATCH] 125 战斗 修复步练师的被动bug

---
 Main/System/Battle/Skill/SkillBase.Cast.cs |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/Main/System/Battle/Skill/SkillBase.Cast.cs b/Main/System/Battle/Skill/SkillBase.Cast.cs
index 14d5b8c..8d3ef90 100644
--- a/Main/System/Battle/Skill/SkillBase.Cast.cs
+++ b/Main/System/Battle/Skill/SkillBase.Cast.cs
@@ -10,6 +10,17 @@
     // 鎶�鑳介噴鏀句富閫昏緫锛氬箍鎾簨浠躲�侀珮浜洰鏍囥�佹墽琛岄噴鏀�
     public virtual void Cast()
     {
+#if UNITY_EDITOR
+        //  [鍓嶅啿璇婃柇] Cast() 鍏ュ彛锛氳褰� skillId/caster/BattleType/褰撳墠浣嶇疆/褰撳墠鏄惁杩樺湪 tween銆�
+        //  鐢ㄦ潵鍒ゆ柇鏂版妧鑳芥槸鍚﹀湪涓婁竴涓妧鑳界殑鍥炰綅 tween 杩樻病瀹屾垚鏃跺氨杩涘叆 Cast()銆�
+        {
+            Vector2 castEntryPos = (caster != null && caster.GetRectTransform() != null)
+                ? caster.GetRectTransform().anchoredPosition : Vector2.zero;
+            bool casterTweening = caster != null && caster.GetRectTransform() != null
+                && DG.Tweening.DOTween.IsTweening(caster.GetRectTransform());
+            BattleDebug.LogError($"[鍓嶅啿璇婃柇] Cast 鍏ュ彛 skillId={skillConfig?.SkillID} caster={caster?.ObjID} battleType={tagUseSkillAttack?.BattleType} castMode={skillSkinConfig?.castMode} anchoredPos={castEntryPos} casterTweening={casterTweening}");
+        }
+#endif
         // 骞挎挱鎶�鑳介噴鏀句簨浠�
         string guid = battleField.guid;
         // 鑾峰彇閲婃斁鑰呮暟鎹細Hero 浼犻�� teamHero锛孧ingge 浼犻�� null锛堝洜涓轰簨浠剁洃鍚櫒鍙鐞� Hero 鏁版嵁锛�
@@ -163,9 +174,15 @@
     // 鎵ц绉诲姩-鏂芥硶-杩斿洖搴忓垪锛氶�氱敤鐨勭Щ鍔ㄦ敾鍑绘祦绋�
     private void ExecuteMoveAndCastSequence(RectTransform target, Action onReturnComplete)
     {
+#if UNITY_EDITOR
+        BattleDebug.LogError($"[鍓嶅啿璇婃柇] ExecuteMoveAndCastSequence 寮�濮� skillId={skillConfig?.SkillID} caster={caster?.ObjID} battleType={tagUseSkillAttack?.BattleType} CastDistance={skillSkinConfig?.CastDistance} castMode={skillSkinConfig?.castMode}");
+#endif
         ShadowIllutionCreate(true);
         MoveToTarget(target, new Vector2(skillSkinConfig.CastDistance, 0), () =>
         {
+#if UNITY_EDITOR
+            BattleDebug.LogError($"[鍓嶅啿璇婃柇] 鍓嶅啿瀹屾垚 skillId={skillConfig?.SkillID} caster={caster?.ObjID} 鍑嗗 CastImpl");
+#endif
             if (skillSkinConfig.CastDistance < 9999 && skillSkinConfig.SkinllSFX2 != 0)
             {
                 battleField.soundManager.PlayEffectSound(skillSkinConfig.SkinllSFX2, false);
@@ -197,18 +214,52 @@
     // 绉诲姩鍒扮洰鏍囦綅缃細澶勭悊瑙掕壊鐨勭Щ鍔ㄥ姩鐢诲拰閫昏緫
     protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 750f)
     {
+#if UNITY_EDITOR
+        //  [鍓嶅啿璇婃柇] 璁板綍鍏ュ彛鍙傛暟锛欳astDistance銆乷ffset銆乻peed锛涗互鍙婂綋鍓� caster 鐨勯敋鐐逛綅缃��
+        Vector2 fromPos = caster != null && caster.GetRectTransform() != null
+            ? caster.GetRectTransform().anchoredPosition : Vector2.zero;
+        bool mttTweening = caster != null && caster.GetRectTransform() != null
+            && DG.Tweening.DOTween.IsTweening(caster.GetRectTransform());
+        BattleDebug.LogError($"[鍓嶅啿璇婃柇] MoveToTarget 鍏ュ彛 skillId={skillConfig?.SkillID} caster={caster?.ObjID} battleType={tagUseSkillAttack?.BattleType} CastDistance={skillSkinConfig?.CastDistance} offset={offset} speed={speed} fromPos={fromPos} casterTweening={mttTweening}");
+#endif
         if (skillSkinConfig.CastDistance >= 9999)
         {
+#if UNITY_EDITOR
+            BattleDebug.LogError($"[鍓嶅啿璇婃柇] CastDistance>=9999 鐩存帴璺宠繃绉诲姩 skillId={skillConfig?.SkillID} caster={caster?.ObjID}");
+#endif
             _onComplete?.Invoke();
             return;
         }
 
         caster.PlayAnimation(MotionName.run, true);
+#if UNITY_EDITOR
+        //  [鍓嶅啿璇婃柇] 璁板綍 target 鐨勫悕瀛�/涓栫晫鍧愭爣/鐖惰妭鐐� scale锛屼究浜庡畾浣嶉暅鍍忓潗鏍囩郴瀵艰嚧 offset 鏂瑰悜鍙嶈浆
+        string targetName = target != null ? target.name : "(null)";
+        Vector3 targetWorld = target != null ? target.position : Vector3.zero;
+        Vector3 targetLossyScale = target != null ? (Vector3)target.lossyScale : Vector3.one;
+        Vector2 targetAnchored = target != null ? target.anchoredPosition : Vector2.zero;
+        BattleDebug.LogError($"[鍓嶅啿璇婃柇] target淇℃伅 skillId={skillConfig?.SkillID} caster={caster?.ObjID} casterCamp={caster?.Camp} target.name={targetName} target.anchoredPos={targetAnchored} target.worldPos={targetWorld} target.lossyScale={targetLossyScale}");
+#endif
         var tweener = BattleUtility.MoveToTarget(caster.GetRectTransform(), target, offset, () =>
         {
+#if UNITY_EDITOR
+            Vector2 toPos = caster != null && caster.GetRectTransform() != null
+                ? caster.GetRectTransform().anchoredPosition : Vector2.zero;
+            BattleDebug.LogError($"[鍓嶅啿璇婃柇] MoveToTarget 瀹屾垚 skillId={skillConfig?.SkillID} caster={caster?.ObjID} toPos={toPos}");
+#endif
+            //  tween 瀹屾垚鏃舵竻闄� caster 涓婄殑 activeMoveTween 鍙ユ焺锛屾斁寮� CanCastSkillAnimation 鐨勯椄闂ㄣ��
+            if (caster != null)
+            {
+                caster.activeMoveTween = null;
+            }
             caster.PlayAnimation(MotionName.idle, true);
             _onComplete?.Invoke();
         }, speed);
+        //  璁板綍鍒� caster锛岃 CanCastSkillAnimation 鑳界簿纭瓑寰呰繖涓�涓� tween锛堣�屼笉鏄� caster 韬笂浠绘剰 tween锛夈��
+        if (caster != null)
+        {
+            caster.activeMoveTween = tweener;
+        }
         battleField.battleTweenMgr.OnPlayTween(tweener);
     }
 
@@ -225,6 +276,16 @@
     // 鏀诲嚮瀹屾垚鍚庣殑澶勭悊锛氳浆韬�佹仮澶嶇姸鎬併�佹挱鏀惧緟鏈哄姩鐢�
     protected void OnAttackFinish()
     {
+#if UNITY_EDITOR
+        //  [鍓嶅啿璇婃柇] OnAttackFinish 鍏ュ彛锛氳褰曞抚鍙峰拰褰撳墠浣嶇疆锛屽拰 Cast()/MoveToTarget 鏃ュ織瀵归綈銆�
+        {
+            Vector2 finPos = (caster != null && caster.GetRectTransform() != null)
+                ? caster.GetRectTransform().anchoredPosition : Vector2.zero;
+            bool finTweening = caster != null && caster.GetRectTransform() != null
+                && DG.Tweening.DOTween.IsTweening(caster.GetRectTransform());
+            BattleDebug.LogError($"[鍓嶅啿璇婃柇] OnAttackFinish skillId={skillConfig?.SkillID} caster={caster?.ObjID} battleType={tagUseSkillAttack?.BattleType} anchoredPos={finPos} casterTweening={finTweening}");
+        }
+#endif
         TurnBack(null, 1f);
         OnAllAttackMoveFinished();
         caster.PlayAnimation(MotionName.idle, true);

--
Gitblit v1.8.0