From 7060867c004c3312f409a320623b40b42186f9af Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 20 十月 2025 09:29:43 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(A922同步等级信息)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 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 f6db1f1..4e4123c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -21,6 +21,7 @@
import ChConfig
import PlayerTask
+import PlayerActivity
import PlayerViewCache
import ChPyNetSendPack
import NetPackCommon
@@ -217,7 +218,7 @@
#def setPVPTeam(self):
# return
- def nextTurnFight(self, msgDict={}, resetByNextTeam=False):
+ def nextTurnFight(self, msgDict={}):
## 一般用于玩家发起的战斗,在需要保留玩家阵容属性及状态的情况下,重置回合进入下一场战斗
self.turnNum = 1
self.enterLogic = False
@@ -227,8 +228,7 @@
self.timeline = 0
self.startTime = time.time()
self.costTime = 0
- if resetByNextTeam:
- ResetByNextTeam(self)
+ ResetByNextTeam(self)
return
def haveNextLineup(self):
@@ -960,7 +960,7 @@
turnFight.lineupIndex = index
GameWorld.DebugLog("对战NPC阵容: index=%s, lineupID=%s" % (index, lineupID))
if index > 0:
- turnFight.nextTurnFight(resetByNextTeam=True)
+ turnFight.nextTurnFight()
turnFight.setFactionLineup(ChConfig.Def_FactionB, {1:GetNPCLineupInfo(lineupID, strongerLV, difficulty)})
turnFight.sortActionQueue()
turnFight.startFight()
@@ -1039,7 +1039,7 @@
__doSetFightPoint(curPlayer, reqValue)
return
- GameWorld.DebugLog("主线战斗请求: reqType=%s" % reqType, curPlayer.GetPlayerID())
+ GameWorld.DebugLog("------------------- 主线战斗请求: reqType=%s" % reqType, curPlayer.GetPlayerID())
clientPack = ChPyNetSendPack.tagSCTurnFightReportSign()
clientPack.Sign = 0
NetPackCommon.SendFakePack(curPlayer, clientPack) # 标记开始
@@ -1178,7 +1178,7 @@
if nextLineupID:
GameWorld.DebugLog("---开始进入下一小队: lineupIndex=%s,nextLineupID=%s,%s" % (turnFight.lineupIndex, nextLineupID, turnFight.lineupIDList))
- turnFight.nextTurnFight(resetByNextTeam=True)
+ turnFight.nextTurnFight()
# 切换小队时,玩家阵容不需要处理,保留状态
turnFight.setFactionLineup(ChConfig.Def_FactionB, {1:GetNPCLineupInfo(nextLineupID, turnFight.strongerLV, turnFight.difficulty)})
turnFight.sortActionQueue()
@@ -1206,6 +1206,8 @@
turnNum = turnFight.turnNum
turnMax = turnFight.turnMax
for turnNum in range(turnNum, turnMax + 1):
+ if turnFight.winFaction:
+ break
turnTimeline = turnFight.getTurnNumStartTimelin(turnNum) # 本回合起始时间节点
curTimeline = turnFight.getTimeline()
@@ -1230,13 +1232,13 @@
# 红颜
# 灵兽
- if turnFight.checkOverByKilled():
+ if turnFight.winFaction:
break
# 武将
doMax = PosNumMax * len(turnFight.actionSortList)
doCnt = 0
- while doCnt < doMax and turnFight.actionIndex < len(turnFight.actionSortList):
+ while doCnt < doMax and turnFight.actionIndex < len(turnFight.actionSortList) and not turnFight.winFaction:
doCnt += 1
faction, num = turnFight.actionSortList[turnFight.actionIndex]
batFaction = turnFight.getBatFaction(faction)
@@ -1275,6 +1277,9 @@
else:
turnFight.actionIndex += 1
+ if turnFight.winFaction:
+ break
+
# 回合结束
curTimeline = turnFight.setTimeline(curTimeline + 1) # 每回合结束算一个时间节点
for faction, num in turnFight.actionSortList:
@@ -1285,9 +1290,6 @@
batObj = batObjMgr.getBatObj(objID)
TurnFightPerTurnBigEnd(turnFight, batObj, turnNum)
- if turnFight.checkOverByKilled():
- break
-
if not turnFight.winFaction:
OnTurnAllOver(turnFight.guid)
@@ -1301,6 +1303,8 @@
EntryLogic(turnFight)
batObjMgr = BattleObj.GetBatObjMgr()
for turnNum in range(1, turnMax + 1):
+ if turnFight.winFaction:
+ break
turnFight.turnNum = turnNum
GameWorld.DebugLog("【----- 回合制战斗轮次: %s -----】" % turnNum)
curTimeline = turnFight.getTurnNumStartTimelin(turnNum) # 本回合起始时间节点
@@ -1322,13 +1326,13 @@
# 红颜
# 灵兽
- if turnFight.checkOverByKilled():
+ if turnFight.winFaction:
break
# 武将
doMax = PosNumMax * len(turnFight.actionSortList)
doCnt = 0
- while doCnt < doMax and turnFight.actionIndex < len(turnFight.actionSortList):
+ while doCnt < doMax and turnFight.actionIndex < len(turnFight.actionSortList) and not turnFight.winFaction:
doCnt += 1
faction, num = turnFight.actionSortList[turnFight.actionIndex]
batFaction = turnFight.getBatFaction(faction)
@@ -1352,6 +1356,9 @@
else:
turnFight.actionIndex += 1
+ if turnFight.winFaction:
+ break
+
# 回合结束
curTimeline = turnFight.setTimeline(curTimeline + 1) # 每回合结束算一个时间节点
for faction, num in turnFight.actionSortList:
@@ -1362,9 +1369,6 @@
batObj = batObjMgr.getBatObj(objID)
TurnFightPerTurnBigEnd(turnFight, batObj, turnNum)
- if turnFight.checkOverByKilled():
- break
-
if not turnFight.winFaction:
OnTurnAllOver(turnFight.guid)
return
@@ -1649,7 +1653,8 @@
# 暂时只算主线小怪
if curPlayer and turnFight.mapID == ChConfig.Def_FBMapID_Main and gameObj.GetFaction() != ChConfig.Def_FactionA:
- PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_KillNPC, 1)
+ PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_KillNPC, 1)
+ PlayerActivity.AddDailyTaskValue(curPlayer, ChConfig.DailyTask_KillNPC, 1)
return True
def OnTurnAllOver(guid):
--
Gitblit v1.8.0