From edee680110d69fc509142a9bf306c7c3141cfb19 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 03 七月 2025 09:44:40 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(初始战斗防范没有阵容的情况;角色初始章节刷怪兼容;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py | 2 --
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 15 ---------------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py | 27 ++++++++++++++++++---------
3 files changed, 18 insertions(+), 26 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 f0c06e5..f0fb744 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -583,6 +583,9 @@
if heroCount >= ShareDefine.LineupObjMax:
break
+ if not heroDict:
+ return {}
+
# 主公属性
lordAttrDict = PlayerControl.GetLordAttr(curPlayer)
@@ -783,12 +786,9 @@
# @param isRestStart: 是否从休息状态重新开始的
playerID = curPlayer.GetPlayerID()
chapterID, levelNum, wave = PlayerControl.GetMainLevelNowInfo(curPlayer)
- if not chapterID:
- chapterID = 1
- if not levelNum:
- levelNum =1
- if not wave:
- wave = 1
+ if not chapterID and not levelNum:
+ PlayerControl.SetMainLevelNowInfo(curPlayer, 1, 1, 1)
+ chapterID, levelNum, wave = PlayerControl.GetMainLevelNowInfo(curPlayer)
GameWorld.DebugLog("请求关卡波战斗: chapterID=%s,levelNum=%s,wave=%s,isRestStart=%s" % (chapterID, levelNum, wave, isRestStart), playerID)
fightPoint = max(curPlayer.GetFightPoint(), 1)
if not PlayerControl.HaveMoney(curPlayer, ShareDefine.TYPE_Price_Xiantao, fightPoint):
@@ -824,6 +824,11 @@
teamNum = 1
lineupID = waveLineupList[teamNum - 1] # NPC阵容ID
+ lineupMainInfo = GetPlayerLineup(curPlayer, ShareDefine.Lineup_Main)
+ if not lineupMainInfo:
+ GameWorld.DebugLog("没有设置主阵容!", playerID)
+ return
+
mainFightMgr = GetMainFightMgr(curPlayer)
mainFightMgr.nextTeam = False
mainFightMgr.chapterID = chapterID
@@ -840,7 +845,7 @@
turnFight = mainFightMgr.turnFight
turnFight.setTurn(mapID, funcLineID, turnMax, False, {"teamNum":teamNum, "teamMax":teamMax})
- turnFight.setFactionLineup(Def_FactionA, {1:GetPlayerLineup(curPlayer, ShareDefine.Lineup_Main)}, True)
+ turnFight.setFactionLineup(Def_FactionA, {1:lineupMainInfo}, True)
turnFight.setFactionLineup(Def_FactionB, {1:GetNPCLineup(lineupID)})
turnFight.sortActionQueue()
turnFight.syncInit()
@@ -893,6 +898,11 @@
wave = waveMax = 1 # 关卡boss固定只有一波
+ lineupMainInfo = GetPlayerLineup(curPlayer, ShareDefine.Lineup_Main)
+ if not lineupMainInfo:
+ GameWorld.DebugLog("没有设置主阵容!", playerID)
+ return
+
mainFightMgr = GetMainFightMgr(curPlayer)
mainFightMgr.nextTeam = False
mainFightMgr.chapterID = chapterID
@@ -909,7 +919,7 @@
turnFight = mainFightMgr.turnFight
turnFight.setTurn(mapID, funcLineID, turnMax, False, {"teamNum":teamNum, "teamMax":teamMax})
- turnFight.setFactionLineup(Def_FactionA, {1:GetPlayerLineup(curPlayer, ShareDefine.Lineup_Main)}, True)
+ turnFight.setFactionLineup(Def_FactionA, {1:lineupMainInfo}, True)
turnFight.setFactionLineup(Def_FactionB, {1:GetNPCLineup(lineupID)})
turnFight.sortActionQueue()
turnFight.syncInit()
@@ -931,7 +941,6 @@
teamNum = mainFightMgr.teamNum = mainFightMgr.teamNum + 1
GameWorld.DebugLog("开始进入下一小队: teamNum=%s" % teamNum)
if teamNum < 1 or teamNum > len(mainFightMgr.waveLineupList):
- GameWorld.DebugLog("111111 teamNum=%s,mainFightMgr.waveLineupList=%s" % (teamNum, mainFightMgr.waveLineupList))
return
lineupID = mainFightMgr.waveLineupList[teamNum - 1] # NPC阵容ID
GameWorld.DebugLog("teamNum=%s,lineupID=%s" % (teamNum, lineupID))
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index e0edf24..c630f84 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -3655,21 +3655,6 @@
return
# 回合制怪不通知,统一由 // B4 24 回合战斗初始化 #tagSCTurnFightInit
-
- # 使用bt版本开发测试暂时留着,方便测试,正式需删除通知
- if turnFight.curPlayer:
- clientPack = ChNetSendPack.tagNPCAppear()
- clientPack.ObjID = objID
- clientPack.NPCID = curNPC.GetNPCID()
- clientPack.NPCHP = curNPC.GetHP()
- clientPack.NPCHPEx = curNPC.GetHPEx()
- clientPack.MaxHP = curNPC.GetMaxHP()
- clientPack.MaxHPEx = curNPC.GetMaxHPEx()
- clientPack.CurLV = curNPC.GetCurLV()
- clientPack.PosX = curNPC.GetPosX()
- clientPack.PosY = curNPC.GetPosY()
- clientPack.Speed = curNPC.GetSpeed()
- NetPackCommon.SendFakePack(turnFight.curPlayer, clientPack)
return
#---------------------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index dcc0065..149ba48 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -928,8 +928,6 @@
EventReport.WriteEvent_Entry(curPlayer, 4)
#EventReport.EventReport(ShareDefine.Def_UserAction_FirstLogin, "", curPlayer)
- PlayerControl.SetMainLevelNowInfo(curPlayer) # 初始化章节关卡
-
#---补满血满魔---
GameObj.SetHP(curPlayer, GameObj.GetMaxHP(curPlayer))
curPlayer.SetMP(curPlayer.GetMaxMP())
--
Gitblit v1.8.0