From a7bbe4767fb5ec5de271290c4ccea710eb3dd191 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 17 十一月 2025 18:36:13 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts

---
 Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs |  123 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 110 insertions(+), 13 deletions(-)

diff --git a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
index 364f3fe..1281c53 100644
--- a/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
+++ b/Main/Core/NetworkPackage/CustomServerPack/CustomHB426CombinePack.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Linq;
 using UnityEngine;
 
 public class CustomHB426CombinePack : GameNetPackBasic
@@ -141,15 +142,18 @@
                     //  澶勭悊鎶�鑳戒箣闂寸殑閾炬帴鍏崇郴
                     if (skillPack.RelatedSkillID > 0)
                     {
-                        skillDict.TryGetValue(skillPack.RelatedSkillID, out var parentSkill);
+                        // 濡傛灉鏄 HB426_tagSCTurnFightTag 鍖呰9鐨勭涓�涓妧鑳藉寘 骞朵笖鍓嶉潰娌℃湁CustomHB426CombinePack 
+                        // 鍒欓渶瑕佹妸CustomHB426CombinePack鍔犲叆skillPack鐨剆ubSkillCombinePackList閲�
+                        // 鍚屾椂 闇�瑕佹妸indexDict閲屽垹鎺夊搴旂殑subSkillCombinePackList
+                        // subSkillList鍒犳帀瀵瑰簲skillPack锛屼絾鏄痵killPack鐨刾arentSkill涓嶅彉
 
+                        skillDict.TryGetValue(skillPack.RelatedSkillID, out var parentSkill);
                         if (parentSkill != null && skillPack.BattleType == 4)//4=瀛愭妧鑳�
                         {
                             parentSkill.subSkillList.Add(skillPack);
                             skillPack.parentSkill = parentSkill;
                         }
                         indexDict.Add(i, pack);
-
                     }
                     else
                     {
@@ -172,6 +176,10 @@
             }
         }
 
+        // 濡傛灉鏄 HB426_tagSCTurnFightTag 鍖呰9鐨勭涓�涓妧鑳藉寘 骞朵笖鍓嶉潰娌℃湁CustomHB426CombinePack 
+        // 缈昏瘧涓�涓嬪氨鏄� 濡傛灉CombinePack閲岀殑涓讳綋Skill鍖� skillPack.RelatedSkillID > 0
+
+
 
         //  宓屽鍖呭唴鐨勫寘鍚堝苟
         foreach (var combinePack in combineDict.Values)
@@ -182,11 +190,75 @@
                 {
                     indexDict.Remove(i);
                     combinePack.AddPack(pack);
-                    if (pack is CustomHB426CombinePack)
+                    if (pack is CustomHB426CombinePack cbPack)
                     {
                         //  濡傛灉鏄祵濂楃殑鍖� 鍔犲叆涔嬪悗 璋冩暣i
-                        i = (pack as CustomHB426CombinePack).toIndex;
+                        i = cbPack.toIndex;
                     }
+                }
+            }
+        }
+
+
+        for (int i = 0; i < b421SeriesPackList.Count; i++)
+        {
+            if (indexDict.TryGetValue(i, out var pack))
+            {
+                if (pack is CustomHB426CombinePack cbPack)
+                {
+                    HB427_tagSCUseSkill skillPack = cbPack.GetMainHB427SkillPack();
+                
+                    if (null == skillPack)
+                    {
+                        continue;
+                    }
+
+                    //  濡傛灉鏄瓙鎶�鑳�
+                    if (skillPack.isSubSkill)
+                    {
+                        //  璁╁埆浜烘潵澶勭悊
+                        continue;
+                    }
+                    else
+                    {
+                        //  澶勭悊瀛愭妧鑳�
+                        if (skillPack.subSkillList.Count > 0)
+                        {
+                            var parentSkill = skillPack;
+                            List<HB427_tagSCUseSkill> toRemoveSubSkills = new List<HB427_tagSCUseSkill>();
+                            foreach (var subSkill in parentSkill.subSkillList)
+                            {
+                                CustomHB426CombinePack innerCBPack = null;
+                                if (cbPack.IsInnerCBPackContainsSkill(subSkill, ref innerCBPack))
+                                {
+                                    if (cbPack.GetMainHB427SkillPack() == subSkill)
+                                    {
+                                        parentSkill.subSkillList.Remove(subSkill);
+                                        Debug.LogError("瀛愭妧鑳戒笉鑳芥槸涓绘妧鑳�: " + subSkill.SkillID);
+                                        continue;
+                                    }
+                                    subSkill.parentCombinePack = innerCBPack;
+                                    cbPack.packList.Remove(innerCBPack);
+                                    toRemoveSubSkills.Add(subSkill);
+                                    parentSkill.subSkillCombinePackList.Add(innerCBPack);
+                                    indexDict.Remove(innerCBPack.fromIndex);
+                                }
+                            }
+                            foreach (var subSkill in toRemoveSubSkills)
+                            {
+                                parentSkill.subSkillList.Remove(subSkill);
+                            }
+                        }
+                        else
+                        {
+                            // 涓绘妧鑳芥病鏈夊瓙鎶�鑳� 鐩存帴璺宠繃
+                            continue;
+                        }
+                    }
+                }
+                else if (pack is HB427_tagSCUseSkill skillPack)
+                {
+                    Debug.LogError("钀藉崟鐨勬妧鑳�");
                 }
             }
         }
@@ -200,15 +272,6 @@
             if (indexDict.TryGetValue(i, out var pack))
             {
                 newPackList.Add(pack);
-                if (pack is CustomHB426CombinePack)
-                {
-                    var cbpack = pack as CustomHB426CombinePack;
-                    // temp += "pack type is " + pack.GetType().Name + " tag is " + cbpack.startTag.Tag + "\n";
-                }
-                else
-                {
-                    // temp += "pack type is " + pack.GetType().Name + "\n";
-                }
             }
         }
 
@@ -219,6 +282,40 @@
         return newPackList;
     }
 
+    public HB427_tagSCUseSkill GetMainHB427SkillPack()
+    {
+        for (int i = 0; i < packList.Count; i++)
+        {
+            var pack = packList[i];
+            if (pack is HB427_tagSCUseSkill skillPack)
+            {
+                return skillPack;
+            }
+            else if (pack is CustomHB426CombinePack)
+            {
+                return null;
+            }
+        }
+
+        return null;
+    }
+
+    public bool IsInnerCBPackContainsSkill(HB427_tagSCUseSkill skill, ref CustomHB426CombinePack innerCBPack)
+    {
+        for (int i = 0; i < packList.Count; i++)
+        {
+            var pack = packList[i];
+            if (pack is CustomHB426CombinePack cbPack)
+            {
+                if (cbPack.packList.Contains(skill))
+                {
+                    innerCBPack = cbPack;
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
     public void Distribute()
     {
         BattleField battleField = BattleManager.Instance.GetBattleField(guid);

--
Gitblit v1.8.0