From dfe22add81f39b0aef8560397f6cd3ef18b00a8e Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期二, 21 十月 2025 10:05:25 +0800
Subject: [PATCH] 143 演武场-客户端 战斗尝试接入轮次

---
 Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs |  138 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 135 insertions(+), 3 deletions(-)

diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index ce2e53f..8262b27 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -31,6 +31,7 @@
         }
         endTag = _endTag;
         toIndex = _toIndex;
+        PrintAllPack();
     }
 
 
@@ -43,6 +44,26 @@
         }
         fromIndex = _fromIndex;
         startTag = tag;
+
+        
+    }
+
+    public void PrintAllPack()
+    {
+        string temp = "CustomHB426CombinePack startTag: " + (startTag != null ? startTag.Tag : "null") + " fromIndex: " + fromIndex + " toIndex: " + toIndex + "\n";
+        for (int i = 0; i < packList.Count; i++)
+        {
+            var pack = packList[i];
+            if (pack is CustomHB426CombinePack b426Pack)
+            {
+                temp += "  pack type is " + pack.GetType().Name + " tag is " + (b426Pack.startTag != null ? b426Pack.startTag.Tag : "null") + "\n";
+            }
+            else
+            {
+                temp += "  pack type is " + pack.GetType().Name + "\n";
+            }
+        }
+        // BattleDebug.LogError(temp);
     }
 
     public void AddPack(GameNetPackBasic pack)
@@ -77,6 +98,8 @@
         Dictionary<string, CustomHB426CombinePack> combineDict = new Dictionary<string, CustomHB426CombinePack>();
 
         Dictionary<int, GameNetPackBasic> indexDict = new Dictionary<int, GameNetPackBasic>();
+
+        Dictionary<uint, HB427_tagSCUseSkill> skillDict = new Dictionary<uint, HB427_tagSCUseSkill>();
 
         for (int i = 0; i < b421SeriesPackList.Count; i++)
         {
@@ -113,7 +136,41 @@
             }
             else
             {
-                indexDict.Add(i, pack);
+                if (pack is HB427_tagSCUseSkill skillPack)
+                {
+                    //  澶勭悊鎶�鑳戒箣闂寸殑閾炬帴鍏崇郴
+                    if (skillPack.RelatedSkillID > 0)
+                    {
+                        skillDict.TryGetValue(skillPack.RelatedSkillID, out var parentSkill);
+
+                        if (parentSkill != null && skillPack.BattleType == 4)//4=瀛愭妧鑳�
+                        {
+                            parentSkill.subSkillList.Add(skillPack);
+                            skillPack.parentSkill = parentSkill;
+                        }
+                        else
+                        {
+                            indexDict.Add(i, pack);
+                        }
+                    }
+                    else
+                    {
+                        indexDict.Add(i, pack);
+                    }
+
+                    if (skillDict.ContainsKey(skillPack.SkillID))
+                    {
+                        skillDict[skillPack.SkillID] = skillPack;
+                    }
+                    else
+                    {
+                        skillDict.Add(skillPack.SkillID, skillPack);
+                    }
+                }
+                else
+                {
+                    indexDict.Add(i, pack);
+                }
             }
         }
 
@@ -182,6 +239,53 @@
 
     }
 
+    public static SkillRecordAction CreateSkillAction(string guid, List<GameNetPackBasic> _packList)
+    {
+        BattleField battleField = BattleManager.Instance.GetBattleField(guid);
+
+        if (null == battleField)
+        {
+            Debug.LogError("BattleField not found for guid: " + guid);
+            return null;
+        }
+
+        while (_packList.Count > 0)
+        {
+            var pack = _packList[0];
+            _packList.RemoveAt(0);
+
+            if (pack is HB427_tagSCUseSkill)
+            {
+                _packList.Insert(0, pack);
+                break;
+            }
+            else if (pack is CustomHB426CombinePack)
+            {
+                Debug.LogError("鏃犳硶鎵惧埌Skill鍖咃紝鍏堝彂鐜颁簡宓屽鍖�");
+                return null;
+            }
+            else
+            {
+                // Debug.LogError("鍙戠幇闈濻kill鍖咃紝鍏堝垎鍙戞帀: " + pack.GetType().Name);
+                PackageRegedit.Distribute(pack);
+            }
+        }
+
+        HB427_tagSCUseSkill skill = _packList[0] as HB427_tagSCUseSkill;
+        _packList.RemoveAt(0);
+        if (null == skill)
+        {
+            Debug.LogError("No HB427_tagSCUseSkill found in packList.");
+            return null;
+        }
+
+        BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
+
+        SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, _packList);
+        return skillAction;
+
+    }
+
     public SkillRecordAction CreateSkillAction()
     {
         BattleField battleField = BattleManager.Instance.GetBattleField(guid);
@@ -192,12 +296,40 @@
             return null;
         }
 
+        //  鏈嶅姟鍣ㄤ慨鏀逛簡 鐜板湪绗竴涓笉涓�瀹氭槸B427 涔熸湁鍙兘鏄疊428 鍏堟斁Buff
+        while (packList.Count > 0)
+        {
+            var pack = packList[0];
+            packList.RemoveAt(0);
+
+            if (pack is HB427_tagSCUseSkill)
+            {
+                packList.Insert(0, pack);
+                break;
+            }
+            else if (pack is CustomHB426CombinePack)
+            {
+                Debug.LogError("鏃犳硶鎵惧埌Skill鍖咃紝鍏堝彂鐜颁簡宓屽鍖�");
+                return null;
+            }
+            else
+            {
+                // Debug.LogError("鍙戠幇闈濻kill鍖咃紝鍏堝垎鍙戞帀: " + pack.GetType().Name);
+                PackageRegedit.Distribute(pack);
+            }
+        }
+
         if (startTag.Tag.StartsWith("Skill_"))
         {
             HB427_tagSCUseSkill skill = packList[0] as HB427_tagSCUseSkill;
-            packList.Remove(skill);
-            BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
+            packList.RemoveAt(0);
+            if (null == skill)
+            {
+                Debug.LogError("No HB427_tagSCUseSkill found in packList.");
+                return null;
+            }
 
+            BattleObject _caster = battleField.battleObjMgr.GetBattleObject((int)skill.ObjID);
             // BattleDebug.LogError("_caster == null : " + (_caster == null) + " skill.ObjID : " + skill.ObjID);
 
             SkillRecordAction skillAction = new SkillRecordAction(battleField, _caster, skill, packList);

--
Gitblit v1.8.0