From 445e6bdb5719d07c7196afe09b5e610e1839e062 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 21 十月 2025 10:44:32 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(优化B4 10 回合制战斗 #tagCMTurnFight请求战斗时FuncLineID逻辑)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py |   19 ++-----------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/MainLevel.py                            |    5 +++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py                           |    4 ++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py      |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py                                |   13 +++++++------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py         |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py        |    2 +-
 7 files changed, 17 insertions(+), 30 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 4e4123c..87a001e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -547,7 +547,7 @@
     olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
     lineup = olPlayer.GetLineup(lineupID)
     if not lineup.lineupHeroDict:
-        # 为空时默认取主阵容
+        GameWorld.DebugLog("玩家没有目标阵容默认取主阵容! lineupID=%s" % lineupID)
         lineup = olPlayer.GetLineup(ShareDefine.Lineup_Main)
     return lineup
 
@@ -886,8 +886,13 @@
     tagID = clientData.TagID
     valueList = clientData.ValueList
     
-    GameWorld.DebugLog("回合制战斗请求: mapID=%s,funcLineID=%s,tagType=%s,tagID=%s,valueList=%s" 
+    GameWorld.DebugLog("----- 回合制战斗请求: mapID=%s,funcLineID=%s,tagType=%s,tagID=%s,valueList=%s" 
                        % (mapID, funcLineID, tagType, tagID, valueList), curPlayer.GetPlayerID())
+    
+    reqRet = FBLogic.OnTurnFightRequest(curPlayer, mapID, funcLineID, tagType, tagID, valueList)
+    if not reqRet:
+        return
+    funcLineID = reqRet[1] if len(reqRet) > 1 else funcLineID
     
     fbIpyData = FBCommon.GetFBIpyData(mapID)
     fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, funcLineID, False)
@@ -898,10 +903,6 @@
         if FBCommon.CheckCanEnterFBComm(curPlayer, mapID, funcLineID, fbIpyData, fbLineIpyData) != ShareDefine.EntFBAskRet_OK:
             return
         
-    reqRet = FBLogic.OnTurnFightRequest(curPlayer, mapID, funcLineID, tagType, tagID, valueList)
-    if not reqRet:
-        return
-    
     # 攻防方所使用的阵容ID
     atkLineupID, defLineupID = FBLogic.GetFBPlayerLineupID(curPlayer, mapID, funcLineID)
     if atkLineupID not in ShareDefine.LineupList or defLineupID not in ShareDefine.LineupList:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/MainLevel.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/MainLevel.py
index c4c09f4..e3f9fc9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/MainLevel.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/MainLevel.py
@@ -27,7 +27,7 @@
     
     if not gmList:
         GameWorld.DebugAnswer(curPlayer, "重置主线: MainLevel 0")
-        GameWorld.DebugAnswer(curPlayer, "设置主线: MainLevel 章节 关卡 波")
+        GameWorld.DebugAnswer(curPlayer, "设置主线: MainLevel 章节 关卡 波 [是否同波]")
         GameWorld.DebugAnswer(curPlayer, "测试击杀: MainLevel k 消耗战锤数")
         GameWorld.DebugAnswer(curPlayer, "重置掉落: MainLevel d 0 [是否清掉落背包]")
         GameWorld.DebugAnswer(curPlayer, "重置战利: MainLevel b 0")
@@ -77,6 +77,7 @@
     chapterID = value
     levelNum = gmList[1] if len(gmList) > 1 else 1
     wave = gmList[2] if len(gmList) > 2 else 1
+    isSameWave = gmList[3] if len(gmList) > 3 else 0
     
     levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
     if not levelIpyData:
@@ -91,6 +92,6 @@
         wave = waveMax
         
     nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, chapterID, levelNum, wave)
-    passValue = PlayerControl.SetMainLevelPassInfo(curPlayer, chapterID, levelNum, max(0, wave - 1))
+    passValue = PlayerControl.SetMainLevelPassInfo(curPlayer, chapterID, levelNum, wave if isSameWave else max(0, wave - 1))
     GameWorld.DebugAnswer(curPlayer, "设置主线:章关=%s-%s,波=%s,%s,%s" % (chapterID, levelNum, wave, nowValue, passValue))
     return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
index 88f0916..eb0a5e2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
@@ -2238,14 +2238,14 @@
 
 def OnTurnFightRequest(curPlayer, mapID, funcLineID, tagType, tagID, valueList):
     ## 回合战斗请求 - 地图验证
-    # @return: 是否允许
+    # @return: 是否允许, 后端验证通过的funcLineID
     do_FBLogic_ID = __GetFBLogic_MapID(mapID)
     
     callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnTurnFightRequest"))
     
     if callFunc == None:
         # 默认不限制
-        return True
+        return True, funcLineID
     
     return callFunc(curPlayer, mapID, funcLineID, tagType, tagID, valueList)
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py
index f17bec4..f597e7e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py
@@ -67,7 +67,7 @@
     if not PlayerControl.HaveMoney(curPlayer, ShareDefine.TYPE_Price_ArenaTicket, 1):
         return
     
-    return True
+    return True, funcLineID
 
 def GetFBPlayerLineupID(curPlayer, mapID, funcLineID):
     ## 获取玩家使用的攻防阵容ID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py
index 9f205d3..4706134 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py
@@ -26,7 +26,7 @@
     ## 回合战斗请求 
     playerID = curPlayer.GetPlayerID()
     chapterID, levelNum, wave = PlayerControl.GetMainLevelPassInfo(curPlayer)
-    #levelID = chapterID * 100 + levelNum
+    levelID = chapterID * 100 + levelNum
     #if funcLineID != levelID:
     #    return
     GameWorld.DebugLog("请求挑战关卡Boss! passInfo: chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID)
@@ -59,22 +59,7 @@
         GameWorld.DebugLog("最后一波未通过,无法挑战本关boss! passWave=%s < %s" % (wave, waveMax))
         return
     
-    return True
-
-def GetFBNPCLineupInfo(curPlayer, mapID, funcLineID):
-    ## 获取NPC阵容相关
-    # @return: npcLineupIDList, strongerLV, difficulty
-    
-    chapterID, levelNum, _ = PlayerControl.GetMainLevelPassInfo(curPlayer)
-    levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
-    if not levelIpyData:
-        return
-    
-    npcLineupIDList = levelIpyData.GetBossLineupIDList() # Boss波阵容ID列表,小队1阵容ID|小队2阵容ID|...
-    strongerLV = levelIpyData.GetNPCLV()
-    difficulty = levelIpyData.GetDifficulty()
-    
-    return npcLineupIDList, strongerLV, difficulty
+    return True, levelID
 
 def OnTurnFightOver(curPlayer, turnFight, mapID, funcLineID, overMsg):
     ## 回合战斗结束
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py
index c419aac..e3abe52 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py
@@ -80,7 +80,7 @@
         GameWorld.DebugLog("非今日天子考验! mapID=%s,funcLineID=%s != %s,bossID=%s" % (mapID, funcLineID, lineID, bossID))
         return
     
-    return True
+    return True, funcLineID
 
 def GetFBNPCInitAttr(curPlayer, turnFight, npcObj):
     ## 获取副本指定NPC初始化属性
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py
index d64b5af..426a4bf 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py
@@ -26,7 +26,7 @@
         GameWorld.DebugLog("已过关的不能不重复挑战! mapID=%s,funcLineID=%s" % (mapID, funcLineID))
         return
     
-    return True
+    return True, funcLineID
 
 def OnTurnFightOver(curPlayer, turnFight, mapID, funcLineID, overMsg):
     ## 回合战斗结束

--
Gitblit v1.8.0