From a075f7841fb2d0a3b32bf10c8bc2df5bf02d6acb Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期日, 14 十二月 2025 14:24:28 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(贾诩所有技能;5022效果支持配置buff额外属性计算方式;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 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 41a9bca..8bcaf33 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -30,6 +30,7 @@
 import PlayerLLMJ
 import PlayerPrestigeSys
 import CrossServerPackLogic
+import DataRecordPack
 import PlayerSuccess
 import IpyGameDataPY
 import PlayerOnline
@@ -43,7 +44,6 @@
 import TurnBuff
 import FBCommon
 import CommFunc
-import ObjPool
 import FBLogic
 
 import random
@@ -75,6 +75,7 @@
         self.faction = faction # 所属阵营
         self.num = num # 该阵容所在阵营中的编号,不同阵营可重复,多V多
         self.ownerID = 0 # 阵容所属玩家ID,可能为0,0代表非玩家阵容
+        self.lineupInfo = {} # 传入初始化的阵容信息
         self.shapeType = 0 # 阵型
         self.fightPower = 0 # 阵容总战力
         self.posObjIDDict = {} # 站位对应战斗实体 {站位编号:batObjID, ...}, 站位编号小于0为非主战单位,如主公、红颜等
@@ -97,6 +98,7 @@
         ## 设置阵容
         # @param lineupInfo: 阵容信息
         self.clearLineup()
+        self.lineupInfo = lineupInfo
         self.ownerID = lineupInfo.get("PlayerID", 0) # 阵容所属的玩家ID
         self.shapeType = lineupInfo.get("ShapeType", 0)
         self.fightPower = lineupInfo.get("FightPower", 0)
@@ -114,6 +116,7 @@
             batObjMgr.delBatObj(objID)
         for objID in self.beautyObjIDDict.values():
             batObjMgr.delBatObj(objID)
+        self.lineupInfo = {}
         self.posObjIDDict = {}
         self.heroObjIDDict = {}
         self.lingshouObjIDDict = {}
@@ -341,7 +344,10 @@
                         break
                     
             if allKilled:
-                self.winFaction = ChConfig.Def_FactionA if faction == ChConfig.Def_FactionB else ChConfig.Def_FactionB
+                if self.mapID in ChConfig.PlayerWinMapIDList:
+                    self.winFaction = ChConfig.Def_FactionA
+                else:
+                    self.winFaction = ChConfig.Def_FactionA if faction == ChConfig.Def_FactionB else ChConfig.Def_FactionB
                 DoTurnFightOver(self.guid)
                 return self.winFaction
             
@@ -462,14 +468,11 @@
             GameWorld.DebugLogEx("回合战斗过程封包: %s, len:%s", headStr, buffLen)
             self.batBuffer += CommFunc.WriteWORD("", buffLen)
             self.batBuffer += packBuff
-            ObjPool.GetPoolMgr().release(clientPack)
         else:
             GameWorld.DebugLogEx("回合战斗过程封包: %s", headStr)
             # 有玩家的统一每个包单独发送,同样也支持战报统计
             if self.curPlayer:
                 NetPackCommon.SendFakePack(self.curPlayer, clientPack)
-            else:
-                ObjPool.GetPoolMgr().release(clientPack)
         return
     
     def ResetOneActionUseSkillCnt(self): self._oneActionUseSkillCntDict = {}
@@ -487,7 +490,7 @@
         return
     
     def addTurnFight(self, guid, mapID, funcLineID=0, reqPlayerID=0, reqServerID=0):
-        tf = ObjPool.GetPoolMgr().acquire(TurnFight, guid, mapID, funcLineID, reqPlayerID, reqServerID)
+        tf = TurnFight(guid, mapID, funcLineID, reqPlayerID, reqServerID)
         if not tf:
             tf = TurnFight(guid, mapID, funcLineID, reqPlayerID, reqServerID) # 一般是不可能,为了点出代码
         self.turnFightDict[tf.guid] = tf
@@ -499,7 +502,6 @@
             return
         turnFight.exitFight()
         self.turnFightDict.pop(guid, None)
-        ObjPool.GetPoolMgr().release(turnFight)
         return
     
     def getTurnFight(self, guid):
@@ -792,7 +794,7 @@
         star = lvIpyData.GetReHeroStar()
         breakLV = lvIpyData.GetReHeroBreakLV()
         awakeLV = lvIpyData.GetReHeroAwakeLV()
-    if heroIpyData and lvIpyData:
+    if heroIpyData:
         skinIDList = heroIpyData.GetSkinIDList()
         skinID = skinIDList[0] if skinIDList else 0
         skillIDList = GetNPCHeroSkillIDList(heroID, heroIpyData, breakLV, awakeLV)
@@ -1994,7 +1996,7 @@
     gameObj.SetDead()
     TurnBuff.DoBuffByDead(turnFight, gameObj)
     
-    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagMCTurnFightObjDead)
+    clientPack = ChPyNetSendPack.tagMCTurnFightObjDead()
     clientPack.ObjID = objID
     clientPack.KillerObjID = killerObjID
     clientPack.SkillID = skillID
@@ -2017,7 +2019,10 @@
     
     if turnFight.getReqPlayerID():
         # 玩家发起的,未击杀对方,算玩家输
-        turnFight.winFaction = ChConfig.Def_FactionB
+        if turnFight.mapID in ChConfig.PlayerWinMapIDList:
+            turnFight.winFaction = ChConfig.Def_FactionA
+        else:
+            turnFight.winFaction = ChConfig.Def_FactionB
     else:
         # 系统场次,按一定规则来,这里先随机
         turnFight.winFaction = random.choice([ChConfig.Def_FactionA, ChConfig.Def_FactionB])
@@ -2037,17 +2042,23 @@
     turnFight.isWin = (winFaction == ChConfig.Def_FactionA)
     mapID = turnFight.mapID
     funcLineID = turnFight.funcLineID
+    reqPlayerID = turnFight.getReqPlayerID()
     GameWorld.DebugLogEx("--- 战斗结束处理 ---, winFaction=%s, costTime=%ss, %s", winFaction, turnFight.costTime, guid)
     if mapID != ChConfig.Def_FBMapID_Main:
         GameWorld.Log("战斗耗时: %ss, mapID=%s,funcLineID=%s,turnNum=%s/%s" % (turnFight.costTime, mapID, funcLineID, turnFight.turnNum, turnFight.turnMax))
         
     # 统计明细
+    heroCount = 0
     batObjMgr = BattleObj.GetBatObjMgr()
     statInfo = {}
+    drLineupInfo = {}
     for faction in turnFight.factionDict.keys():
         if str(faction) not in statInfo:
             statInfo[str(faction)] = {}
         facStatInfo = statInfo[str(faction)]
+        if str(faction) not in drLineupInfo:
+            drLineupInfo[str(faction)] = {}
+        facDRLineupInfo = drLineupInfo[str(faction)]
         batFaction = turnFight.getBatFaction(faction)
         batFaction.totalHurt = 0
         for num in batFaction.lineupDict.keys():
@@ -2056,11 +2067,13 @@
             lineupStatInfo = facStatInfo[str(num)]
             batLineup = batFaction.getBatlineup(num)
             batLineup.totalHurt = 0
+            facDRLineupInfo[str(num)] = batLineup.lineupInfo
             GameWorld.DebugLogEx("阵容明细: faction=%s,num=%s", faction, num)
             for posNum, objID in batLineup.posObjIDDict.items():
                 batObj = batObjMgr.getBatObj(objID)
                 if not batObj:
                     continue
+                heroCount += 1
                 objID = batObj.GetID()
                 npcID = batObj.GetNPCID()
                 heroID = batObj.GetHeroID()
@@ -2080,6 +2093,11 @@
     FBLogic.OnTurnFightOver(turnFight, mapID, funcLineID, statMsg)
     
     turnFight.syncState(FightState_Award, statMsg)
+    
+    # 流向记录
+    if mapID != ChConfig.Def_FBMapID_Main and reqPlayerID:
+        DataRecordPack.DR_FightStat(reqPlayerID, mapID, funcLineID, turnFight.isWin, turnFight.turnNum, turnFight.turnMax, 
+                                    heroCount, turnFight.costTime, statInfo, drLineupInfo)
     return
 
 #// B4 14 查看战报 #tagCSTurnFightReportView

--
Gitblit v1.8.0