From ed9bf64c03bf5fee5e115645de5a975baaa9041d Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 09 一月 2026 11:04:53 +0800
Subject: [PATCH] 125 战斗 修改死亡表现 带动作的子技能同时触发导致的卡死

---
 Main/System/Battle/Skill/SkillBase.cs |  122 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 106 insertions(+), 16 deletions(-)

diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 056b849..da38c42 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -28,11 +28,18 @@
     protected List<H0704_tagRolePackRefresh> dropPackList = new List<H0704_tagRolePackRefresh>();
     protected List<HB405_tagMCAddExp> expPackList = new List<HB405_tagMCAddExp>();
 
-    protected List<BattleDeadPack> endDeadPackList = new List<BattleDeadPack>();
+    protected List<SkillRecordAction> waitingCastSkillRecordAction = new List<SkillRecordAction>();
+
 
     protected bool moveFinished = false;
     public SkillBase fromSkill;
     public bool isPlay = false;
+
+    //  鐖禦ecordAction锛圫killRecordAction锛夛紝鐢ㄤ簬瀛愭妧鑳藉缓绔嬬埗瀛愬叧绯�
+    protected RecordAction parentRecordAction;
+    
+    //  鎶�鑳藉姩鐢绘槸鍚︽挱鏀惧畬鎴愶紙閽堝鏈夊姩鐢荤殑鎶�鑳斤級
+    protected bool isMotionCompleted = false;
 
     private float MoveSpeed = 750f;
 
@@ -59,12 +66,12 @@
         }
 
         SafetyCheck();
-#if UNITY_EDITOR
-        if (Launch.Instance.isOpenSkillLogFile)
-        {
-            PinrtHB427Hp();
-        }
-#endif
+    }
+
+    //  璁剧疆鐖禦ecordAction
+    public void SetParentRecordAction(RecordAction recordAction)
+    {
+        parentRecordAction = recordAction;
     }
 
 #if UNITY_EDITOR
@@ -144,6 +151,13 @@
 
     private void SafetyCheck()
     {
+#if UNITY_EDITOR
+        if (Launch.Instance.isOpenSkillLogFile)
+        {
+            PinrtHB427Hp();
+        }
+#endif
+
         bool safety = caster != null 
                         && skillConfig != null 
                         && tagUseSkillAttack != null 
@@ -485,24 +499,60 @@
 
         skillEffect = SkillEffectFactory.CreateSkillEffect(this, caster, skillConfig, tagUseSkillAttack);
         skillEffect.Play(OnHitTargets);
+        ProcessSubSkill();
+        HandleWaitingCastSkill();
+
+        isPlay = true;
+    }
+
+    protected void ProcessSubSkill()
+    {
         foreach (var subSkillPack in tagUseSkillAttack.subSkillList)
         {
             SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { subSkillPack });
             recordAction.fromSkill = this;
-            otherSkillActionList.Add(recordAction);
-            battleField.recordPlayer.ImmediatelyPlay(recordAction);
+            //  瀛愭妧鑳借缃甒aitingPlay=true锛岀瓑寰呯埗鎶�鑳藉姩浣滃畬鎴�
+            waitingCastSkillRecordAction.Add(recordAction);
+            battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true);
         }
         tagUseSkillAttack.subSkillList.Clear();
         foreach (var subCombinePack in tagUseSkillAttack.subSkillCombinePackList)
         {
             SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, subCombinePack.packList);
             recordAction.fromSkill = this;
-            otherSkillActionList.Add(recordAction);
-            battleField.recordPlayer.ImmediatelyPlay(recordAction);
+            //  瀛愭妧鑳借缃甒aitingPlay=true锛岀瓑寰呯埗鎶�鑳藉姩浣滃畬鎴�
+            waitingCastSkillRecordAction.Add(recordAction);
         }
         tagUseSkillAttack.subSkillCombinePackList.Clear();
 
-        isPlay = true;
+        waitingCastSkillRecordAction.OrderBy(recordAction => recordAction.hB427_TagSCUseSkill.packUID);
+
+        
+    }
+
+    protected void HandleWaitingCastSkill()
+    {
+        RecordAction waitingRecordAction = null;
+
+        for (int i = 0; i < waitingCastSkillRecordAction.Count; i++)
+        {
+            var recordAction = waitingCastSkillRecordAction[i];
+
+            if (waitingRecordAction != null)
+            {
+                //  姣忎釜閮藉簲璇ョ瓑鍓嶄竴涓粨鏉熷悗
+                battleField.recordPlayer.ImmediatelyPlay(recordAction, waitingRecordAction, true);
+            }
+            else
+            {
+                battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true);
+            }
+
+            if (recordAction.IsNeedWaiting())
+            {
+                waitingRecordAction = recordAction;
+            }
+        }
     }
 
     // 鎶�鑳藉墠鎽囩粨鏉熷洖璋�
@@ -529,6 +579,9 @@
     // 鎶�鑳藉悗鎽囩粨鏉熷洖璋冿細閫氱煡鎶�鑳芥晥鏋滃鐞嗗悗鎽囩粨鏉�
     public virtual void OnFinalFrameEnd()
     {
+        //  鏍囪鍔ㄧ敾鎾斁瀹屾垚
+        isMotionCompleted = true;
+        BattleDebug.LogError($"SkillBase.OnFinalFrameEnd: 鎶�鑳� {skillConfig?.SkillID} 鍔ㄧ敾鎾斁瀹屾垚");
         
         skillEffect?.OnFinalFrameEnd(); // 淇锛氭坊鍔犵┖鍊兼鏌�
     }
@@ -728,7 +781,7 @@
 #endif
 
         // 鍏堣皟鐢ㄧ洰鏍囧彈浼�
-        target.Hurt(hurtParam);
+        target.Hurt(hurtParam, parentRecordAction);
         
         // 鍐嶈皟鐢ㄦ柦娉曡�呭惛琛�/鍙嶄激
         caster.OnHurtTarget(hurtParam);
@@ -1008,6 +1061,16 @@
                 return false;
             }
 
+            //  濡傛灉鎶�鑳芥湁鍔ㄧ敾锛圫killMotionName涓嶄负绌猴級锛岄渶瑕佺瓑寰呭姩鐢绘挱鏀惧畬鎴�
+            if (skillConfig != null && !string.IsNullOrEmpty(skillConfig.SkillMotionName))
+            {
+                if (!isMotionCompleted)
+                {
+                    BattleDebug.LogError($"SkillBase.IsFinishedForJudge: 鎶�鑳� {skillConfig.SkillID} 绛夊緟鍔ㄧ敾鎾斁瀹屾垚");
+                    return false;
+                }
+            }
+
             return true;
         }
 
@@ -1067,6 +1130,7 @@
             {
                 battleField.RemoveCastingSkill(caster.ObjID, this);
                 
+                //  浼犻�抪arentRecordAction锛岃姝讳骸鎶�鑳界瓑寰呭綋鍓嶆妧鑳藉畬鎴�
                 battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values));
             }
 
@@ -1089,7 +1153,8 @@
             battleField.RemoveCastingSkill(caster.ObjID, this);
         }
 
-        battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values));
+        //  浼犻�抪arentRecordAction锛岃姝讳骸鎶�鑳界瓑寰呭綋鍓嶆妧鑳藉畬鎴�
+        battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values), parentRecordAction);
 
         // 1. 寮哄埗缁撴潫鎶�鑳芥晥鏋�
         skillEffect?.ForceFinished();
@@ -1100,7 +1165,8 @@
             SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { subSkillPack });
             recordAction.fromSkill = this;
             otherSkillActionList.Add(recordAction);
-            battleField.recordPlayer.ImmediatelyPlay(recordAction);
+            //  瀛愭妧鑳借缃甒aitingPlay=true锛岀瓑寰呯埗鎶�鑳藉姩浣滃畬鎴�
+            battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true);
         }
         tagUseSkillAttack.subSkillList.Clear();
         foreach (var subCombinePack in tagUseSkillAttack.subSkillCombinePackList)
@@ -1108,7 +1174,8 @@
             SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, subCombinePack.packList);
             recordAction.fromSkill = this;
             otherSkillActionList.Add(recordAction);
-            battleField.recordPlayer.ImmediatelyPlay(recordAction);
+            //  瀛愭妧鑳借缃甒aitingPlay=true锛岀瓑寰呯埗鎶�鑳藉姩浣滃畬鎴�
+            battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true);
         }
         tagUseSkillAttack.subSkillCombinePackList.Clear();
         
@@ -1173,6 +1240,9 @@
         isFinished = true;
         moveFinished = true;
         isPlay = true;
+        
+        //  寮哄埗缁撴潫鏃讹紝鏃犺鏄惁鏈夊姩鐢伙紝閮芥爣璁板姩鐢诲畬鎴�
+        isMotionCompleted = true;
 
         // 6. 澶勭悊鎵�鏈夊墿浣欏寘锛堝寘鎷� buff 鍖咃級
         // 鍏堝鐞� buffPackCollections
@@ -1377,6 +1447,26 @@
         }
     }
 
+    public virtual bool CanStartExecution()
+    {
+        if (null == caster)
+        {
+            return false;
+        }
+
+        if (null == skillConfig)
+        {
+            return false;
+        }
+
+        if (string.IsNullOrEmpty(skillConfig.SkillMotionName))
+        {
+            return true;
+        }
+
+        return !battleField.IsCastingSkill(caster.ObjID);
+    }
+
     #endregion
 
 }
\ No newline at end of file

--
Gitblit v1.8.0