From 1a81c33e76a2ba18a4160a18d5e272162d74876b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 25 九月 2025 17:24:45 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(朱恒技能;增加效果5007-偷取目标身上增益类型buff;增加GM命令TurnFight-可设置主线战斗中战斗对象相关属性、击杀等;修复技能对象释放bug;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
index e0ce407..7c32629 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
@@ -37,6 +37,11 @@
         self._AffectBuffDict = {} # 被动buff {(触发方式, 有效来源):{buffID:[effID, ...], ...}, ...}
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self._batObj = None
+        return
+    
     def GetPassiveEffByTrigger(self, triggerWay, connSkill=None, connSkillTypeID=0, connBuff=None):
         '''获取可触发的效果列表,技能跟buff根据触发优先级按顺序触发,优先级越高越先执行,相同时技能优先
                         优先级之后有需要再扩展
@@ -226,6 +231,10 @@
         self.Clear()
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        return
+    
     def Clear(self):
         self._objID = 0
         self._hurtTypes = 0 # 本次伤血类型,如闪避、暴击、格挡等,通过二进制或运算得到最终值,支持多种同时出现,如暴击的同时被格挡
@@ -271,6 +280,10 @@
         #self._triggerParams = triggerParams if triggerParams else []
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        return
+    
     def GetEffectID(self): return self._effID
     def GetEffectValue(self, index): return self._values[index] if len(self._values) > index else 0
     def GetEffectValueCount(self): return len(self._values)
@@ -294,6 +307,10 @@
             effect = ObjPool.GetPoolMgr().acquire(SkillEffect, effID, values, triggerWay, triggerSrc)
             self._effList.append(effect)
             self._effDict[(effID, triggerWay)] = effect
+        return
+    
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
         return
     
     def GetIpyData(self): return self._ipyData
@@ -345,6 +362,10 @@
         self._value3 = 0
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        return
+    
     def GetSkillData(self): return self._skillData
     def GetSkillID(self): return self._skillData.GetSkillID()
     def GetBuffID(self): return self._buffID
@@ -383,6 +404,11 @@
         self._buffStateDict = {} # buff影响的状态 {state:[buffID, ...], ...}
         self._buffID = 0 # 该对象的唯一buffID,递增,不同对象buffID可重复,buffID非skillID,不同buffID的skillID可能一样
         # 该项目设定同一个对象可能同时存在多个相同skillID的buff,独立算CD
+        return
+    
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self._batObj = None
         return
     
     def ClearBuff(self):
@@ -529,7 +555,14 @@
         self._parryTagIDDict = {} # 单次连续连击中对方已格挡次数 {tagID:parryNum, ...}
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self.ResetUseRec()
+        return
+    
     def ResetUseRec(self):
+        ## 重置技能使用记录
+        ## 注:有用到对象池相关对象的一定要重置,不然再回收技能对象时会连同该技能下的所有用到的对象池对象一并回收,导致后续使用对象错误
         self._batType = 0
         self._tagObjList = []
         self._killObjList = []
@@ -540,6 +573,7 @@
         return
     
     def GetObjID(self): return self._objID
+    def GetSkillData(self): return self._skillData
     def GetSkillID(self): return self._skillData.GetSkillID()
     def GetSkillTypeID(self): return self._skillData.GetSkillTypeID()
     def GetSkillLV(self): return self._skillData.GetSkillLV()
@@ -654,6 +688,11 @@
         self._skillDict = {} # {skillID:PySkill, ...}
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self._batObj = None
+        return
+    
     def SkillReset(self):
         poolMgr = ObjPool.GetPoolMgr()
         for skill in self._skillList:
@@ -743,6 +782,10 @@
         self.cureStat = 0 # 治疗统计
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        return
+    
     def InitBatAttr(self, initAttrDict, initXP=0):
         '''初始化战斗属性
         @param initAttrDict: 已经算好的在阵容中的属性,包含羁绊、阵容属性等,战斗中只要计算buff属性即可
@@ -775,6 +818,20 @@
             self._passiveEffMgr.RefreshSkillPassiveEffect()
         return
     
+    def GMSetBatAttr(self, attrID, attrValue):
+        ## GM设置战斗属性
+        self._initAttrDict[attrID] = attrValue # 需要同步设置初始化属性,防止刷属性后被重置
+        if attrID == ChConfig.AttrID_HP:
+            self.SetHP(attrValue, True)
+            if attrValue > self.GetMaxHP():
+                self._initAttrDict[ChConfig.AttrID_MaxHP] = attrValue
+                self.SetMaxHP(attrValue, True)
+        elif attrID == ChConfig.AttrID_XP:
+            self.SetXP(attrValue, True)
+        else:
+            self.SetBatAttrValue(attrID, attrValue)
+        return
+    
     def ResetBattleEffect(self):
         self._batAttrDict = {}
         self._batAttrDict.update(self._initAttrDict)

--
Gitblit v1.8.0