From 04ffe31b6a2b2fbcfecc83abb44a8aa233f2e53f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 02 二月 2026 18:45:57 +0800
Subject: [PATCH] 54 【淘金】切后台淘金完成 时间显示负数

---
 Main/System/Battle/Skill/SkillBase.cs |  529 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 339 insertions(+), 190 deletions(-)

diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index da38c42..8f6daea 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -24,19 +24,18 @@
     protected RectTransform targetNode = null; // 鐩爣鑺傜偣
     public BattleObject caster = null; // 鏂芥硶鑰�
     protected List<GameNetPackBasic> packList;
-    protected List<SkillRecordAction> otherSkillActionList = new List<SkillRecordAction>();
+
+    protected List<RecordAction> currentWaitingSkill = new List<RecordAction>();
+
     protected List<H0704_tagRolePackRefresh> dropPackList = new List<H0704_tagRolePackRefresh>();
     protected List<HB405_tagMCAddExp> expPackList = new List<HB405_tagMCAddExp>();
-
-    protected List<SkillRecordAction> waitingCastSkillRecordAction = new List<SkillRecordAction>();
-
 
     protected bool moveFinished = false;
     public SkillBase fromSkill;
     public bool isPlay = false;
 
     //  鐖禦ecordAction锛圫killRecordAction锛夛紝鐢ㄤ簬瀛愭妧鑳藉缓绔嬬埗瀛愬叧绯�
-    protected RecordAction parentRecordAction;
+    protected SkillRecordAction ownRecordAction;
     
     //  鎶�鑳藉姩鐢绘槸鍚︽挱鏀惧畬鎴愶紙閽堝鏈夊姩鐢荤殑鎶�鑳斤級
     protected bool isMotionCompleted = false;
@@ -68,10 +67,15 @@
         SafetyCheck();
     }
 
-    //  璁剧疆鐖禦ecordAction
-    public void SetParentRecordAction(RecordAction recordAction)
+    public virtual void AfterAddToQueue()
     {
-        parentRecordAction = recordAction;
+        
+    }
+
+    //  璁剧疆鐖禦ecordAction
+    public void SetOwnRecordAction(SkillRecordAction recordAction)
+    {
+        ownRecordAction = recordAction;
     }
 
 #if UNITY_EDITOR
@@ -88,7 +92,7 @@
             var Hurt = tagUseSkillAttack.HurtList[i];
             BattleObject battleObject = caster.battleField.battleObjMgr.GetBattleObject((int)Hurt.ObjID);
             
-            string targetName = battleObject != null ? battleObject.teamHero.name : "Unknown";
+            string targetName = battleObject != null ? battleObject.GetName() : "Unknown";
             long hurtHp = GeneralDefine.GetFactValue(Hurt.HurtHP, Hurt.HurtHPEx);
             long curHp = GeneralDefine.GetFactValue(Hurt.CurHP, Hurt.CurHPEx);
             
@@ -121,7 +125,7 @@
                 var HurtEx = tagUseSkillAttack.HurtListEx[i];
                 BattleObject battleObject = caster.battleField.battleObjMgr.GetBattleObject((int)HurtEx.ObjID);
                 
-                string targetName = battleObject != null ? battleObject.teamHero.name : "Unknown";
+                string targetName = battleObject != null ? battleObject.GetName() : "Unknown";
                 long hurtHp = GeneralDefine.GetFactValue(HurtEx.HurtHP, HurtEx.HurtHPEx);
                 long curHp = GeneralDefine.GetFactValue(HurtEx.CurHP, HurtEx.CurHPEx);
                 
@@ -190,22 +194,7 @@
             return;
         }
 
-        if (otherSkillActionList.Count > 0)
-        {
-            for (int i = otherSkillActionList.Count - 1; i >= 0; i--)
-            {
-                var action = otherSkillActionList[i];
-                if (action.IsFinished())
-                {
-                    otherSkillActionList.RemoveAt(i);
-                    OnSkillFinished();
-                }
-                else if (moveFinished)
-                {
-                    action.Run();
-                }
-            }
-        }
+
     }
 
     protected void ShadowIllutionCreate(bool create)
@@ -236,13 +225,13 @@
             if (change)
             {
                 MoveSpeed = 1125f;
-                caster.motionBase.ShowIllusionShadow(true, color);
+                caster.ShowIllusionShadow(true, color);
             }
         }
         else
         {
             MoveSpeed = 750f;
-            caster.motionBase.ShowIllusionShadow(false);
+            caster.ShowIllusionShadow(false);
         }
     }
 
@@ -251,7 +240,13 @@
     {
         // 骞挎挱鎶�鑳介噴鏀句簨浠�
         string guid = battleField.guid;
-        TeamHero teamHero = caster.teamHero;
+        // 鑾峰彇閲婃斁鑰呮暟鎹細Hero 浼犻�� teamHero锛孧ingge 浼犻�� null锛堝洜涓轰簨浠剁洃鍚櫒鍙鐞� Hero 鏁版嵁锛�
+        TeamHero teamHero = null;
+        if (caster is HeroBattleObject heroBattleObject)
+        {
+            teamHero = heroBattleObject.teamHero;
+        }
+        // 鍛芥牸閲婃斁鎶�鑳芥椂 teamHero 涓� null锛岀洃鍚櫒浼氭纭鐞嗭紙宸叉湁 null 妫�鏌ワ級
         EventBroadcast.Instance.Broadcast<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, guid, skillConfig, teamHero);
 
         if (skillConfig.SkinllSFX1 != 0)
@@ -314,7 +309,7 @@
     {
         if (hintConfig != null)
         {
-            battleObject.heroInfoBar.ShowTips(((char)hintConfig.prefix).ToString(), true, false, 1.25f);
+            battleObject.ShowTips(((char)hintConfig.prefix).ToString(), true, false, 1.25f);
         }
     }
 
@@ -338,7 +333,7 @@
             else
             {
                 // ShadowIllutionCreate(true);
-                MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () =>
+                MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.GetPositionNum()), Vector2.zero, () =>
                 {
                     // ShadowIllutionCreate(false);
                     OnAttackFinish();
@@ -363,7 +358,7 @@
 
         ExecuteMoveAndCastSequence(targetTrans, () =>
         {
-            RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum);
+            RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.GetPositionNum());
             // ShadowIllutionCreate(true);
             MoveToTarget(rectTransform, Vector2.zero, () =>
             {
@@ -386,7 +381,7 @@
             else
             {
                 // ShadowIllutionCreate(true);
-                MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () =>
+                MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.GetPositionNum()), Vector2.zero, () =>
                 {
                     // ShadowIllutionCreate(false);
                     OnAttackFinish();
@@ -438,10 +433,10 @@
             return;
         }
 
-        caster.motionBase.PlayAnimation(MotionName.run, true);
-        var tweener = BattleUtility.MoveToTarget(caster.heroRectTrans, target, offset, () =>
+        caster.PlayAnimation(MotionName.run, true);
+        var tweener = BattleUtility.MoveToTarget(caster.GetRectTransform(), target, offset, () =>
         {
-            caster.motionBase.PlayAnimation(MotionName.idle, true);
+            caster.PlayAnimation(MotionName.idle, true);
             _onComplete?.Invoke();
         }, speed);
         battleField.battleTweenMgr.OnPlayTween(tweener);
@@ -452,9 +447,7 @@
     {
         if (skillConfig.CastDistance < 0)
         {
-            Vector3 scale = caster.heroGo.transform.localScale;
-            scale.x = Mathf.Abs(scale.x) * forward;
-            caster.heroGo.transform.localScale = scale;
+            caster.SetFacing(forward);
         }
         _onComplete?.Invoke();
     }
@@ -464,7 +457,7 @@
     {
         TurnBack(null, 1f);
         OnAllAttackMoveFinished();
-        caster.motionBase.PlayAnimation(MotionName.idle, true);
+        caster.PlayAnimation(MotionName.idle, true);
     }
 
     // 鎵�鏈夋敾鍑荤Щ鍔ㄥ畬鎴愬悗鐨勫鐞嗭細鎭㈠UI鏄剧ず鐘舵��
@@ -475,7 +468,7 @@
         foreach (BattleObject bo in allList)
         {
             bo.layerMgr.SetFront();
-            bo.heroInfoBar.SetActive(true);
+            bo.GetHeroInfoBar()?.SetActive(true);
         }
         battleField.battleRootNode.skillMaskNode.SetActive(false);
     }
@@ -483,7 +476,7 @@
     // 鎵ц鎶�鑳介噴鏀惧姩鐢诲拰閫昏緫锛氭挱鏀炬柦娉曞姩浣滃苟鎻愪緵鍥炶皟
     protected TrackEntry CastImpl(Action onComplete = null)
     {
-        return caster.motionBase.PlaySkillAnimation(skillConfig, this, tagUseSkillAttack.BattleType == 4, onComplete);
+        return caster.PlaySkillAnimation(skillConfig, this, tagUseSkillAttack.BattleType == 4, onComplete);
     }
 
     // 鎶�鑳藉紑濮嬪洖璋冿細澶勭悊姝讳骸銆佸瓙鎶�鑳姐�佹妧鑳芥晥鏋滃垵濮嬪寲
@@ -495,62 +488,90 @@
             return;
         }
 
+        //  鍏堟妸姝讳骸鍖呮敹闆嗕簡
         HandleDead();
+
+        //  鍐嶅鐞� 鍐呭祵鎶�鑳�
+        ProcessSubSkill();
 
         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;
-            //  瀛愭妧鑳借缃甒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;
-            //  瀛愭妧鑳借缃甒aitingPlay=true锛岀瓑寰呯埗鎶�鑳藉姩浣滃畬鎴�
-            waitingCastSkillRecordAction.Add(recordAction);
-        }
-        tagUseSkillAttack.subSkillCombinePackList.Clear();
-
-        waitingCastSkillRecordAction.OrderBy(recordAction => recordAction.hB427_TagSCUseSkill.packUID);
-
+        // 鎸塸ackUID鎺掑簭鎵�鏈夊瓙鎶�鑳�
+        var allSubSkills = new List<(ulong packUID, SkillRecordAction action)>();
         
-    }
+        List<GameNetPackBasic> removePackList = new List<GameNetPackBasic>();
 
-    protected void HandleWaitingCastSkill()
-    {
-        RecordAction waitingRecordAction = null;
-
-        for (int i = 0; i < waitingCastSkillRecordAction.Count; i++)
+        foreach (var pack in packList)
         {
-            var recordAction = waitingCastSkillRecordAction[i];
-
-            if (waitingRecordAction != null)
+            if (pack is HB427_tagSCUseSkill skillPack)
             {
-                //  姣忎釜閮藉簲璇ョ瓑鍓嶄竴涓粨鏉熷悗
-                battleField.recordPlayer.ImmediatelyPlay(recordAction, waitingRecordAction, true);
+                SkillConfig ssc = SkillConfig.Get((int)skillPack.SkillID);
+                if (!string.IsNullOrEmpty(ssc.SkillMotionName))
+                {
+                    break;
+                }
+                if (ssc.SkillType == 8)
+                {
+                    break;
+                }
+                SkillRecordAction skillRecordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic> { skillPack });
+                allSubSkills.Add((skillPack.packUID, skillRecordAction));
+                removePackList.Add(pack);
+            }
+            else if (pack is HB422_tagMCTurnFightObjDead dead)
+            {
+                break;
+            }
+            else if (pack is CustomHB426CombinePack combinePack)
+            {
+                HB427_tagSCUseSkill sp = combinePack.GetMainHB427SkillPack();
+                SkillConfig ssc = SkillConfig.Get((int)sp.SkillID);
+
+                if (!string.IsNullOrEmpty(ssc.SkillMotionName))
+                {
+                    break;
+                }
+
+                if (ssc.SkillType == 8)
+                {
+                    break;
+                }
+                
+                SkillRecordAction skillRecordAction = combinePack.CreateSkillAction();
+                allSubSkills.Add((sp.packUID, skillRecordAction));
+                removePackList.Add(pack);
+
+                if (skillRecordAction.useParentRecordPlayer)
+                {
+                    break;
+                }
+            }
+        }
+
+        for (int i = 0; i < removePackList.Count; i++)
+        {
+            packList.Remove(removePackList[i]);
+        }
+
+        // 鎸塸ackUID鎺掑簭
+        allSubSkills.Sort((a, b) => a.packUID.CompareTo(b.packUID));
+
+        foreach (var (packUID, recordAction) in allSubSkills)
+        {
+            if (recordAction.useParentRecordPlayer)
+            {
+                ownRecordAction.GetInnerRecordPlayer().PlayRecord(recordAction, ownRecordAction);
             }
             else
             {
-                battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true);
-            }
-
-            if (recordAction.IsNeedWaiting())
-            {
-                waitingRecordAction = recordAction;
+                ownRecordAction.GetInnerRecordPlayer().ImmediatelyPlay(recordAction);
             }
         }
     }
@@ -639,7 +660,7 @@
         var highlightSet = new HashSet<BattleObject>(highlightList);
 
         // 鍏堟妸鏂芥硶鑰呯殑 InfoBar 闅愯棌锛堝師閫昏緫淇濈暀锛�
-        caster.heroInfoBar.SetActive(false);
+        caster.GetHeroInfoBar()?.SetActive(false);
 
         foreach (BattleObject bo in allList)
         {
@@ -656,7 +677,7 @@
             }
 
             // 鐩爣锛堝惈 HurtListEx锛夐兘搴旀樉绀� InfoBar
-            bo.heroInfoBar.SetActive(isTarget);
+            bo.GetHeroInfoBar()?.SetActive(isTarget);
         }
 
         battleField.battleRootNode.skillMaskNode.SetActive(true);
@@ -666,7 +687,7 @@
     // 鍛戒腑鐩爣鍥炶皟锛氬鐞嗘墍鏈夎鍛戒腑鐨勭洰鏍囷紙鍖呮嫭涓荤洰鏍囥�佸脊灏勭洰鏍囥�佹簠灏勭洰鏍囷級
     protected virtual void OnHitTargets(int _hitIndex, List<HB427_tagSCUseSkill.tagSCUseSkillHurt> hitList)
     {
-        // Debug.LogError($"Skill {skillConfig.SkillID} hit targets _hitIndex: {_hitIndex} hit {string.Join(", ", hitList.Select(h => h.ObjID + ":" + battleField.battleObjMgr.GetBattleObject((int)h.ObjID)?.teamHero.name))}");
+        // Debug.LogError($"Skill {skillConfig.SkillID} hit targets _hitIndex: {_hitIndex} hit {string.Join(", ", hitList.Select(h => h.ObjID + ":" + battleField.battleObjMgr.GetBattleObject((int)h.ObjID)?.GetName()))}");
 
         //  閫犳垚浼ゅ鍓嶅厛澶勭悊琛�閲忓埛鏂板寘
         HandleRefreshHP();
@@ -720,6 +741,11 @@
             }
         }
 
+        HandleHint(_hitIndex, hitList);
+    }
+
+    protected void HandleHint(int _hitIndex, List<HB427_tagSCUseSkill.tagSCUseSkillHurt> hitList)
+    {
         if (0 == _hitIndex)
         {
             bool needhint = false;
@@ -755,9 +781,37 @@
                 DamageNumConfig hintConfig = DamageNumConfig.Get(BattleConst.BattleStun);
                 Hint(caster, hintConfig);
             }
-        }
 
-        
+            for (int i = 0; i < hitList.Count; i++)
+            {
+                var hurt = hitList[i];
+
+                if ((hurt.AttackTypes & (int)DamageType.BreakArmor) == (int)DamageType.BreakArmor)
+                {
+                    BattleObject battleObject = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
+                    if (battleObject != null)
+                    {
+                        DamageNumConfig hintConfig = DamageNumConfig.Get(BattleConst.BreakArmor);
+                        Hint(battleObject, hintConfig);
+                        battleField.battleEffectMgr.PlayEffect(battleObject, 
+                            BattleConst.BreakArmorEffectID, battleObject.GetRectTransform(), battleObject.Camp, 
+                            battleObject.GetModelScale());
+                    }
+                }
+                else if ((hurt.AttackTypes & (int)DamageType.Parry) == (int)DamageType.Parry)
+                {
+                    BattleObject battleObject = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
+                    if (battleObject != null)
+                    {
+                        DamageNumConfig hintConfig = DamageNumConfig.Get(BattleConst.Parry);
+                        Hint(battleObject, hintConfig);
+                        battleField.battleEffectMgr.PlayEffect(battleObject, 
+                            BattleConst.ParryEffectID, battleObject.GetRectTransform(), battleObject.Camp, 
+                            battleObject.GetModelScale());
+                    }
+                }
+            }
+        }
     }
 
     // 澶勭悊鍗曚釜鐩爣琚懡涓�:搴旂敤浼ゅ鍜屾柦娉曡�呮晥鏋�
@@ -781,7 +835,14 @@
 #endif
 
         // 鍏堣皟鐢ㄧ洰鏍囧彈浼�
-        target.Hurt(hurtParam, parentRecordAction);
+        DeathRecordAction recordAc = target.Hurt(hurtParam, ownRecordAction);
+
+        if (null != recordAc)
+        {
+            tempDeadPackList.Remove(hurtParam.hurter.hurtObj.ObjID);
+            ownRecordAction.GetInnerRecordPlayer().ImmediatelyPlay(recordAc, ownRecordAction, true);
+            currentWaitingSkill.Add(recordAc);
+        }
         
         // 鍐嶈皟鐢ㄦ柦娉曡�呭惛琛�/鍙嶄激
         caster.OnHurtTarget(hurtParam);
@@ -834,8 +895,8 @@
         
         BattleDebug.LogError(
             (hurtParam.caster.casterObj.Camp == BattleCamp.Red ? "銆愮孩鏂硅鍔ㄣ��" : "銆愯摑鏂硅鍔ㄣ�� ") +
-            $"鏀诲嚮鑰�: {hurtParam.caster.casterObj.teamHero.name} (ObjID:{hurtParam.caster.casterObj.ObjID})\n" +
-            $"鐩爣: {hurtParam.hurter.hurtObj.teamHero.name} (ObjID:{hurtParam.hurter.hurtObj.ObjID})\n" +
+            $"鏀诲嚮鑰�: {hurtParam.caster.casterObj.GetName()} (ObjID:{hurtParam.caster.casterObj.ObjID})\n" +
+            $"鐩爣: {hurtParam.hurter.hurtObj.GetName()} (ObjID:{hurtParam.hurter.hurtObj.ObjID})\n" +
             $"鎶�鑳�: {hurtParam.skillConfig.SkillName} (ID:{hurtParam.skillConfig.SkillID})\n" +
             $"鍑绘暟: 绗瑊hurtParam.hitIndex + 1}鍑� / 鍏眥hurtParam.skillConfig.DamageDivide.Length}鍑�" + (isLastHit ? " [鏈�鍚庝竴鍑籡" : " [涓棿鍑籡") + "\n" +
             $"\n" +
@@ -866,7 +927,10 @@
         if (refreshPack != null)
         {
             // 鍒嗗彂HP鍒锋柊鍖�
-            PackageRegedit.Distribute(refreshPack);
+            // 銆愪娇鐢� parentRecordAction.innerRecordPlayer銆�
+            // 鍘熷洜锛欻P鍒锋柊鍖呮槸鎶�鑳藉唴閮ㄤ骇鐢熺殑锛屽簲璇ョ敱褰撳墠SkillRecordAction鐨刬nnerRecordPlayer绠$悊
+            // 杩欐牱鍙互纭繚HP鍒锋柊涓庢妧鑳界殑鐢熷懡鍛ㄦ湡缁戝畾锛孎orceFinish鏃朵竴骞跺鐞�
+            PackageRegeditEx.DistributeToRecordAction(refreshPack, ownRecordAction);
             packList.Remove(refreshPack);
         }
     }
@@ -877,13 +941,62 @@
         List<BattleDeadPack> deadPackList = BattleUtility.FindDeadPack(packList);
         if (deadPackList.Count <= 0) return;
 
+        foreach (var deadPack in deadPackList)
+        {
+            packList.Remove(deadPack.deadPack);
+            packList.Remove(deadPack.deadTriggerSkill);
+        }
+
+        // 鎵惧埌鏈�澶х殑姝讳骸鍖� packUID
+        BattleDeadPack lastBattleDeadPack = null;
+        ulong maxDeathPackUID = 0;
+        foreach (var deadPack in deadPackList)
+        {
+            if (deadPack.deadPack != null && deadPack.deadPack.packUID > maxDeathPackUID)
+            {
+                maxDeathPackUID = deadPack.deadPack.packUID;
+                lastBattleDeadPack = deadPack;
+            }
+        }
+        
+        // 濡傛灉鎵惧埌浜嗘浜″寘锛屾敹闆嗘墍鏈� packUID > maxDeathPackUID 鐨勫寘
+        if (maxDeathPackUID > 0 && lastBattleDeadPack != null)
+        {
+            BattleDebug.LogError($"SkillBase.HandleDead: 鎵惧埌姝讳骸鍖咃紝maxDeathPackUID = {maxDeathPackUID}锛屽紑濮嬫敹闆嗘浜″悗鐨勫寘");
+            
+            // 1. 鏀堕泦 packList 涓� packUID 澶т簬姝讳骸鍖呯殑鍖咃紙鎺掗櫎缁忛獙鍖呭拰鎺夎惤鍖咃紝瀹冧滑闇�瑕佸湪褰撳墠鎶�鑳戒腑澶勭悊锛�
+            List<GameNetPackBasic> packsToRemove = new List<GameNetPackBasic>();
+            foreach (var pack in packList)
+            {
+                ulong packUID = GetPackUID(pack);
+                if (packUID > maxDeathPackUID)
+                {
+                    // 鎺掗櫎缁忛獙鍖呭拰鎺夎惤鍖咃紝瀹冧滑灞炰簬褰撳墠姝讳骸浜嬩欢鐨勪竴閮ㄥ垎锛屼笉鏄�"姝讳骸鍚�"鐨勫寘
+                    if (pack is HB405_tagMCAddExp expPack && expPack.Source == 2 || 
+                        (pack is H0704_tagRolePackRefresh h0704 && h0704.PackType == (byte)PackType.DropItem && h0704.IsBind == 1))
+                    {
+                        continue; // 璺宠繃缁忛獙鍖呭拰鎺夎惤鍖咃紝璁� CheckAfterDeadhPack() 澶勭悊瀹冧滑
+                    }
+                    
+                    BattleDebug.LogError($"SkillBase.HandleDead: 浠巔ackList鏀堕泦姝讳骸鍚庣殑鍖� - Type: {pack.GetType().Name}, UID: {packUID}");
+                    lastBattleDeadPack.packListAfterDeath.Add(pack);
+                    packsToRemove.Add(pack);
+                }
+            }
+
+            packList.RemoveAll(p => packsToRemove.Contains(p));
+        }
+
         CheckAfterDeadhPack();
 
         // 淇锛氬厛鏀堕泦瑕佸垹闄ょ殑鍖咃紝閬垮厤鍦╢oreach涓慨鏀归泦鍚�
         var dropPacksToRemove = new List<H0704_tagRolePackRefresh>(dropPackList);
         foreach (var _dropPack in dropPacksToRemove)
         {
-            PackageRegedit.Distribute(_dropPack);
+            // 銆愪娇鐢� parentRecordAction.innerRecordPlayer銆�
+            // 鍘熷洜锛氭帀钀藉寘鏄妧鑳芥晥鏋滅殑涓�閮ㄥ垎锛屽簲璇ョ敱褰撳墠SkillRecordAction绠$悊
+            // 鎺夎惤鍖呯殑鍒嗗彂涓庢妧鑳藉畬鎴愮粦瀹氾紝纭繚鍦ㄦ妧鑳紽orceFinish鏃舵纭鐞�
+            PackageRegeditEx.DistributeToRecordAction(_dropPack, ownRecordAction);
             packList.Remove(_dropPack);
         }
 
@@ -898,8 +1011,8 @@
         // 鏋勯�燘attleDrops骞剁紦瀛�
         for (int i = 0; i < deadPackList.Count; i++)
         {
-            BattleDeadPack battleDeadPack = deadPackList[i];
-            int objID = (int)battleDeadPack.deadPack.ObjID;
+            BattleDeadPack bdp = deadPackList[i];
+            int objID = (int)bdp.deadPack.ObjID;
             BattleObject deadTarget = battleField.battleObjMgr.GetBattleObject(objID);
             
             // 淇锛氭坊鍔犵┖鍊兼鏌�
@@ -913,7 +1026,7 @@
             
             BattleDrops battleDrops = new BattleDrops()
             {
-                rectTransform = deadTarget.heroRectTrans,
+                rectTransform = deadTarget.GetRectTransform(),
                 dropItemPackIndex = itemIndexList,
                 expDrops = expAssign[i]
             };
@@ -958,6 +1071,48 @@
         for (int i = 0; i < itemList.Count; i++)
             dropAssign[i % deadCount].Add(itemList[i]);
         return dropAssign;
+    }
+
+    // 鑾峰彇鍖呯殑 packUID
+    protected ulong GetPackUID(GameNetPackBasic pack)
+    {
+        if (pack == null) return 0;
+        
+        if (pack is HB422_tagMCTurnFightObjDead deadPack)
+            return deadPack.packUID;
+        
+        if (pack is CustomHB426CombinePack combinePack)
+        {
+            var mainSkillPack = combinePack.GetMainHB427SkillPack();
+            return mainSkillPack?.packUID ?? 0;
+        }
+        
+        if (pack is HB427_tagSCUseSkill skillPack)
+            return skillPack.packUID;
+        
+        if (pack is HB428_tagSCBuffRefresh buffRefresh)
+            return buffRefresh.packUID;
+        
+        if (pack is HB429_tagSCBuffDel buffDel)
+            return buffDel.packUID;
+        
+        if (pack is HB419_tagSCObjHPRefresh hpRefresh)
+            return hpRefresh.packUID;
+        
+        if (pack is HB405_tagMCAddExp expPack)
+            return expPack.packUID;
+        
+        if (pack is H0704_tagRolePackRefresh dropPack)
+            return dropPack.packUID;
+        
+        // 灏濊瘯閫氳繃鍙嶅皠鑾峰彇 packUID
+        var packUIDField = pack.GetType().GetField("packUID");
+        if (packUIDField != null)
+        {
+            return (ulong)packUIDField.GetValue(pack);
+        }
+        
+        return 0;
     }
 
     // 鍒嗛厤缁忛獙鍊硷細灏嗙粡楠屽寘骞冲潎鍒嗛厤缁欐瘡涓浜″璞�
@@ -1037,7 +1192,7 @@
     }
 
 
-    public virtual bool IsFinishedForJudge()
+    public virtual bool IsActionCompleted()
     {
         if (!isPlay) return false;
 
@@ -1046,27 +1201,14 @@
             if (!skillEffect.IsFinished()) return false;
         }
 
-        if (otherSkillActionList.Count > 0)
+        if (moveFinished)
         {
-            foreach (var action in otherSkillActionList)
-            {
-                if (!action.IsFinishedForJudge()) return false;
-            }
-        }
-
-        if (isFinished && moveFinished)
-        {
-            if (packList.Count > 0)
-            {
-                return false;
-            }
-
             //  濡傛灉鎶�鑳芥湁鍔ㄧ敾锛圫killMotionName涓嶄负绌猴級锛岄渶瑕佺瓑寰呭姩鐢绘挱鏀惧畬鎴�
             if (skillConfig != null && !string.IsNullOrEmpty(skillConfig.SkillMotionName))
             {
                 if (!isMotionCompleted)
                 {
-                    BattleDebug.LogError($"SkillBase.IsFinishedForJudge: 鎶�鑳� {skillConfig.SkillID} 绛夊緟鍔ㄧ敾鎾斁瀹屾垚");
+                    BattleDebug.LogError($"SkillBase.IsActionCompleted: 鎶�鑳� {skillConfig.SkillID} 绛夊緟鍔ㄧ敾鎾斁瀹屾垚");
                     return false;
                 }
             }
@@ -1094,18 +1236,14 @@
         }
 
         // 妫�鏌ュ叾浠栨妧鑳藉姩浣滄槸鍚﹀畬鎴�
-        if (otherSkillActionList.Count > 0)
+        if (currentWaitingSkill.Count > 0)
         {
-            for (int i = otherSkillActionList.Count - 1; i >= 0; i--)
+            if (currentWaitingSkill.Any(s => s.IsFinished()))
             {
-                var action = otherSkillActionList[i];
-                if (action.IsFinished())
-                {
-                    otherSkillActionList.RemoveAt(i);
-                    OnSkillFinished();
-                }
+                currentWaitingSkill.RemoveAll(s => s.IsFinished());
+                OnSkillFinished();
             }
-            if (otherSkillActionList.Count > 0)
+            else
             {
                 tempRetValue = false;
             }
@@ -1116,6 +1254,7 @@
             return false;
         }
 
+
         // 妫�鏌ユ渶缁堝畬鎴愮姸鎬�
         if (isFinished && moveFinished)
         {
@@ -1125,16 +1264,28 @@
                 return false;
             }
 
+            //  濡傛灉鑷繁鍐呴儴鐨剅ecora action鐨� inner record player杩樻湁娌℃墽琛屽畬鐨勫寘 涔熸槸杩斿洖false
+            if (ownRecordAction != null && ownRecordAction.GetInnerRecordPlayer().IsPlaying())
+            {
+                return false;
+            }
+
             // 鎶�鑳藉畬鍏ㄧ粨鏉燂紝绉婚櫎鎶�鑳芥敞鍐屽苟瑙﹀彂寤惰繜鐨勬浜″垽瀹�
             if (battleField != null && caster != null)
             {
                 battleField.RemoveCastingSkill(caster.ObjID, this);
                 
                 //  浼犻�抪arentRecordAction锛岃姝讳骸鎶�鑳界瓑寰呭綋鍓嶆妧鑳藉畬鎴�
-                battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values));
+                DeathRecordAction recordAction = battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values), null, ownRecordAction);
+                if (null != recordAction)
+                {
+                    ownRecordAction.GetInnerRecordPlayer().ImmediatelyPlay(recordAction);
+                    tempDeadPackList.Clear();
+                    return false;
+                }
             }
 
-            return true;
+            return !ownRecordAction.GetInnerRecordPlayer().IsPlaying();
         }
 
         return false;
@@ -1154,66 +1305,44 @@
         }
 
         //  浼犻�抪arentRecordAction锛岃姝讳骸鎶�鑳界瓑寰呭綋鍓嶆妧鑳藉畬鎴�
-        battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values), parentRecordAction);
+        RecordAction rc = battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values));
+        if (null != rc)
+        {
+            ownRecordAction.GetInnerRecordPlayer().ImmediatelyPlay(rc);
+        }
+        tempDeadPackList.Clear();
 
         // 1. 寮哄埗缁撴潫鎶�鑳芥晥鏋�
         skillEffect?.ForceFinished();
         skillEffect = null;
-
-        foreach (var subSkillPack in tagUseSkillAttack.subSkillList)
-        {
-            SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { subSkillPack });
-            recordAction.fromSkill = this;
-            otherSkillActionList.Add(recordAction);
-            //  瀛愭妧鑳借缃甒aitingPlay=true锛岀瓑寰呯埗鎶�鑳藉姩浣滃畬鎴�
-            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);
-            //  瀛愭妧鑳借缃甒aitingPlay=true锛岀瓑寰呯埗鎶�鑳藉姩浣滃畬鎴�
-            battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true);
-        }
-        tagUseSkillAttack.subSkillCombinePackList.Clear();
         
         // 2. 寮哄埗缁撴潫鎵�鏈夊瓙鎶�鑳藉姩浣�
-        otherSkillActionList.ForEach(action => action.ForceFinish());
-        otherSkillActionList.Clear();
+        if (currentWaitingSkill.Count > 0)
+        {
+            foreach (var skill in currentWaitingSkill)
+            {
+                skill.ForceFinish();
+            }
+            currentWaitingSkill.Clear();
+        }
 
         // 3. 娓呯悊 DOTween 鍔ㄧ敾锛堥槻姝㈢Щ鍔ㄥ洖璋冨湪鎴樻枟缁撴潫鍚庢墽琛岋級
-        if (caster != null && caster.heroRectTrans != null)
+        if (caster != null)
         {
-            DG.Tweening.DOTween.Kill(caster.heroRectTrans);
+            caster.StopMoveAnimation();
         }
 
         // 4. 閲嶇疆鏂芥硶鑰呯姸鎬�
         if (caster != null)
         {
             // 閲嶇疆浣嶇疆鍒板師鐐�
-            if (caster.heroRectTrans != null)
-            {
-                caster.heroRectTrans.anchoredPosition = Vector2.zero;
-            }
+            caster.ResetPosition();
             
             // 閲嶇疆鏈濆悜
-            if (caster.heroGo != null)
-            {
-                Vector3 scale = caster.heroGo.transform.localScale;
-                scale.x = Mathf.Abs(scale.x);
-                caster.heroGo.transform.localScale = scale;
-            }
+            caster.ResetFacing();
 
             // 鍙栨秷骞诲奖鏁堟灉
-            caster.motionBase?.ShowIllusionShadow(false);
-            
-            // 鎾斁寰呮満鍔ㄧ敾锛堝鏋滆繕娲荤潃锛�
-            if (!caster.teamHero.isDead)
-            {
-                caster.motionBase?.ResetForReborn(false);
-            }
+            caster.ShowIllusionShadow(false);
         }
 
         // 5. 鎭㈠ UI 鐘舵��
@@ -1226,7 +1355,7 @@
                 foreach (BattleObject bo in allList)
                 {
                     bo.layerMgr?.SetFront();
-                    bo.heroInfoBar?.SetActive(true);
+                    bo.GetHeroInfoBar()?.SetActive(true);
                 }
             }
             
@@ -1263,8 +1392,9 @@
             }
             else
             {
-                if (pack is CustomB421ActionPack actionPack)
-                    actionPack.Distribute();
+                // 銆愪娇鐢� parentRecordAction.innerRecordPlayer銆�
+                // 鍘熷洜锛欶orceFinished鏃跺墿浣欑殑鍖呬篃鏄妧鑳藉唴閮ㄤ骇鐢熺殑锛屽簲璇ョ敱innerRecordPlayer绠$悊
+                // 杩欐牱鍙互纭繚鍗充娇寮哄埗缁撴潫锛屽寘鐨勫鐞嗕篃鍦ㄦ纭殑涓婁笅鏂囦腑
                 PackageRegedit.Distribute(pack);
             }
         }
@@ -1289,20 +1419,14 @@
             }
 
             // 楠岃瘉鍏朵粬鎶�鑳藉姩浣滄槸鍚﹀畬鎴�
-            if (otherSkillActionList.Count > 0)
+            if (currentWaitingSkill.Count > 0)
             {
-                bool hasFinishedAction = false;
-                for (int i = otherSkillActionList.Count - 1; i >= 0; i--)
-                {
-                    var action = otherSkillActionList[i];
-                    if (action.IsFinished())
-                    {
-                        otherSkillActionList.RemoveAt(i);
-                        hasFinishedAction = true;
-                    }
-                }
+                bool hasFinishedAction = currentWaitingSkill.All(s => s.IsFinished());
+
                 if (hasFinishedAction)
                 {
+                    // 淇姝诲惊鐜細瀹屾垚鍚庨渶瑕佹竻绌� currentWaitingSkill
+                    currentWaitingSkill.Clear();
                     continue; // 浣跨敤continue浠f浛閫掑綊璋冪敤
                 }
                 return;
@@ -1330,17 +1454,33 @@
     
     protected virtual bool ResolvePackList()
     {
+        if (currentWaitingSkill.Count > 0)
+        {
+            return false;
+        }
+
         while (packList.Count > 0)
         {
             var pack = packList[0];
             packList.RemoveAt(0);
 
+
             if (pack is CustomHB426CombinePack combinePack && combinePack.startTag.Tag.StartsWith("Skill_"))
             {
-                BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
-                var otherSkillAction = combinePack.CreateSkillAction();
-                otherSkillAction.fromSkill = this;
-                otherSkillActionList.Add(otherSkillAction);
+                var skillRecordAction = combinePack.CreateSkillAction();
+                skillRecordAction.fromSkill = this;
+                currentWaitingSkill.Add(skillRecordAction);
+
+                //  闇�瑕佺粰鐪熸parent鎾殑
+                if (skillRecordAction.useParentRecordPlayer && skillRecordAction.parentSkillAction != null)
+                {
+                    skillRecordAction.parentSkillAction.GetInnerRecordPlayer().PlayRecord(skillRecordAction);
+                }
+                else
+                {
+                    ownRecordAction.GetInnerRecordPlayer().PlayRecord(skillRecordAction);
+                }
+
                 return false;
             }
             else if (IsBuffPack(pack))
@@ -1368,14 +1508,12 @@
                 buffPackCollections.Clear();
                 continue;
             }
-
-            if (pack is CustomB421ActionPack actionPack)
-            {
-                actionPack.Distribute();
-            }
             else
             {
-                PackageRegedit.Distribute(pack);
+                // 銆愪娇鐢� parentRecordAction.innerRecordPlayer銆�
+                // 鍘熷洜锛氭妧鑳芥墽琛岃繃绋嬩腑鐨勫寘锛圔uff銆佸睘鎬у埛鏂扮瓑锛夋槸鎶�鑳芥晥鏋滅殑涓�閮ㄥ垎
+                // 搴旇鐢盨killRecordAction鐨刬nnerRecordPlayer绠$悊锛岀‘淇濅笌鎶�鑳界敓鍛藉懆鏈熶竴鑷�
+                PackageRegeditEx.DistributeToRecordAction(pack, ownRecordAction);
             }
         }
 
@@ -1387,7 +1525,7 @@
     {
         tempDropList?.Clear();
         tempDeadPackList?.Clear();
-        otherSkillActionList?.Clear();
+        currentWaitingSkill?.Clear();
         dropPackList?.Clear();
         expPackList?.Clear();
         buffPackCollections?.Clear();
@@ -1420,7 +1558,11 @@
                 BattleObject battleObj = battleField.battleObjMgr.GetBattleObject((int)buffRefresh.ObjID);
                 if (battleObj != null)
                 {
-                    battleObj.buffMgr.RefreshBuff(buffRefresh, true);
+                    var buffMgr = battleObj.GetBuffMgr();
+                    if (buffMgr != null) // 鍛芥牸涓嶆湁 buff 绠$悊鍣�
+                    {
+                        buffMgr.RefreshBuff(buffRefresh, true);
+                    }
                 }
             }
             else if (pack is HB429_tagSCBuffDel buffDel)
@@ -1428,7 +1570,11 @@
                 BattleObject battleObj = battleField.battleObjMgr.GetBattleObject((int)buffDel.ObjID);
                 if (battleObj != null)
                 {
-                    battleObj.buffMgr.RemoveBuff(buffDel, false);
+                    var buffMgr = battleObj.GetBuffMgr();
+                    if (buffMgr != null) // 鍛芥牸涓嶆湁 buff 绠$悊鍣�
+                    {
+                        buffMgr.RemoveBuff(buffDel, false);
+                    }
                 }
             }
         }
@@ -1443,7 +1589,10 @@
 
         foreach (var pack in buffPacks)
         {
-            PackageRegedit.Distribute(pack);
+            // 銆愪娇鐢� parentRecordAction.innerRecordPlayer銆�
+            // 鍘熷洜锛欱uff鍖呮槸鎶�鑳芥晥鏋滅殑鏍稿績缁勬垚閮ㄥ垎锛屽簲璇ョ敱SkillRecordAction绠$悊
+            // 鍗充娇鏄己鍒跺垎鍙戠殑鎯呭喌锛屼篃瑕佷繚鎸佸湪姝g‘鐨凴ecordAction涓婁笅鏂囦腑
+            PackageRegeditEx.DistributeToRecordAction(pack, ownRecordAction);
         }
     }
 

--
Gitblit v1.8.0