From cb452abc7bcda94073cfe0d136e831252374853d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 07 二月 2026 19:30:57 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(NPC成长表增加等级字段;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py |   55 ++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
index 2dd7d0e..6ae0ee6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -29,7 +29,6 @@
 import GameWorld
 import PlayerLLMJ
 import PlayerPrestigeSys
-import CrossServerPackLogic
 import DataRecordPack
 import PlayerSuccess
 import IpyGameDataPY
@@ -45,6 +44,7 @@
 import TurnBuff
 import FBCommon
 import CommFunc
+import CrossMsg
 import FBLogic
 
 import random
@@ -321,19 +321,27 @@
     
     def sortActionQueue(self):
         ## 刷新出手顺序队列
+        batObjMgr = BattleObj.GetBatObjMgr()
         sortList = []
         for batFaction in self.factionDict.values():
             faction = batFaction.faction
             for num, batLineup in batFaction.lineupDict.items():
                 isPlayer = 1 if batLineup.ownerID else 0 # 玩家阵容优先攻击
+                atkSpeed = 0
+                for objID in batLineup.getBatHeroObjIDList():
+                    batObj = batObjMgr.getBatObj(objID)
+                    if not batObj:
+                        continue
+                    atkSpeed += batObj.GetBatAttrValue(ChConfig.AttrID_AtkSpeed)
                 fightPower = batLineup.fightPower
                 sortValue = -(faction * 10 + num)
-                sortList.append([isPlayer, fightPower, sortValue, faction, num])
+                sortList.append([isPlayer, atkSpeed, fightPower, sortValue, faction, num])
         sortList.sort(reverse=True) # 战力高的先手
         
         self.actionIndex = 0
         self.actionSortList = []
-        for _, _, _, faction, num in sortList:
+        for sortInfo in sortList:
+            faction, num = sortInfo[-2:]
             self.actionSortList.append([faction, num])
             
         GameWorld.DebugLogEx("阵容战力排序[isPlayer, fp, sortV, f, n]: %s", sortList)
@@ -428,8 +436,8 @@
                     batObj = batObjMgr.getBatObj(objID)
                     if not batObj:
                         continue
-                    if posNum == ChConfig.TFPosNum_Mingge: # 理论上要都同步,但是前端需要同步修改,等前端要改时再同步
-                        continue
+                    #if posNum == ChConfig.TFPosNum_Mingge: # 理论上要都同步,但是前端需要同步修改,等前端要改时再同步
+                    #    continue
                     tfObj = ChPyNetSendPack.tagSCTurnFightObj()
                     tfObj.ObjID = batObj.GetID()
                     tfObj.NPCID = batObj.GetNPCID()
@@ -684,7 +692,7 @@
     mgSkillLVDict = olPlayer.GetCalcSpecInfo(ChConfig.Def_CalcAttr_Mingge, mgPresetID)
     mgSkillIDList = []
     for skillTypeID, skillLV in mgSkillLVDict.items():
-        skillID = skillTypeID + skillLV - 1
+        skillID = SkillCommon.GetSkillIDBySkillTypeID(skillTypeID, skillLV)
         if skillID not in mgSkillIDList:
             mgSkillIDList.append(skillID)
     #shapeType = 0
@@ -847,7 +855,16 @@
     reModelID = lineupIpyData.GetReModelID()
     lvReIpyData = None
     heroIpyData = IpyGameDataPY.GetIpyGameData("Hero", heroID) if heroID else None
-    npcStronger = IpyGameDataPY.GetIpyGameDataNotLog("NPCStronger", npcID)
+    npcStronger = None
+    npcStrongerList = IpyGameDataPY.GetIpyGameDataListNotLog("NPCStronger", npcID)
+    if npcStrongerList and strongerLV:
+        for strongerData in npcStrongerList:
+            if not strongerData.GetNPCLV() or strongerLV <= strongerData.GetNPCLV():
+                npcStronger = strongerData
+                break
+        if not npcStronger:
+            npcStronger = npcStrongerList[-1] # 找不到时取最后一条
+            
     if npcStronger and strongerLV:
         lvReIpyData = IpyGameDataPY.GetIpyGameData("LVReValue", reModelID, strongerLV)
         if lvReIpyData:
@@ -1271,17 +1288,17 @@
             isMultiMap = True
             
     if isMultiMap:
-        CrossServerPackLogic.SendBattleRequest(reqInfo, guid, mapID, funcLineID, reqPlayerID)
+        CrossMsg.SendBattleRequest(reqInfo, guid, mapID, funcLineID, reqPlayerID)
     else:
-        SSMsg_BattleRequest(reqInfo, fromServerID)
+        S2B_BattleRequest(reqInfo, fromServerID)
     return
 
-def SSMsg_BattleRequest(reqInfo, fromServerID, msgType=""):
+def S2B_BattleRequest(reqInfo, fromServerID, msgType=""):
     ## 请求执行战斗,由本地图或其他服务器地图分配过来的战斗请求
     guid, mapID, funcLineID, lineupDictA, lineupDictB, reqPlayerID, playerServerID, npcLineupIDList, strongerLV, difficulty, reqData = reqInfo
-    if msgType:
-        GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" 
-                      % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
+    #if msgType:
+    #    GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" 
+    #                  % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
         
     if npcLineupIDList:
         turnFight = DoTurnFightPVE(guid, mapID, funcLineID, reqPlayerID, playerServerID, lineupDictA, npcLineupIDList, strongerLV, difficulty)
@@ -1300,20 +1317,20 @@
     
     # 本地图自己处理的
     if fromServerID == GameWorld.GetGameWorld().GetServerID():
-        SSMsg_BattleResult(retInfo, fromServerID)
+        B2S_BattleResult(retInfo, fromServerID)
         
     # 其他服务器地图请求的,发送战斗结果回去
     else:
-        CrossServerPackLogic.SendBattleResult(retInfo, fromServerID, guid, mapID, funcLineID, reqPlayerID)
+        CrossMsg.SendBattleResult(retInfo, fromServerID, guid, mapID, funcLineID, reqPlayerID)
     return
 
-def SSMsg_BattleResult(retInfo, fromServerID, msgType=""):
+def B2S_BattleResult(retInfo, fromServerID, msgType=""):
     ## 收到战斗结果信息
     
     guid, mapID, funcLineID, reqPlayerID, winFaction, statMsg, dateStr, reqData = retInfo
-    if msgType:
-        GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" 
-                      % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
+    #if msgType:
+    #    GameWorld.Log("OnServerReceiveMsg => %s, fromServerID=%s,funcMapID=%s,funcLineID=%s,%s,%s" 
+    #                  % (msgType, fromServerID, mapID, funcLineID, guid, time.time()), reqPlayerID)
         
     curPlayer = None
     if reqPlayerID:

--
Gitblit v1.8.0