From 5605938972fbfb13e266d068e190e9ffae56fcc3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 25 九月 2025 19:12:59 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(丁奉技能;觉醒1技能强化护盾,暂无反弹;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py |  290 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 253 insertions(+), 37 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 c64ea93..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,15 +37,56 @@
         self._AffectBuffDict = {} # 被动buff {(触发方式, 有效来源):{buffID:[effID, ...], ...}, ...}
         return
     
-    def GetPassiveEffByTrigger(self, triggerWay, connSkillTypeID=0):
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self._batObj = None
+        return
+    
+    def GetPassiveEffByTrigger(self, triggerWay, connSkill=None, connSkillTypeID=0, connBuff=None):
         '''获取可触发的效果列表,技能跟buff根据触发优先级按顺序触发,优先级越高越先执行,相同时技能优先
                         优先级之后有需要再扩展
         @return: [["skill/buff", skillID/buffID, effIDList], ...]
         '''
         effList = []
         
+        if not connSkillTypeID:
+            if connSkill:
+                connSkillTypeID = connSkill.GetSkillTypeID()
+            elif connBuff:
+                skillData = connBuff.GetSkillData()
+                connSkillTypeID = skillData.GetSkillTypeID()
+                
+        # SkillData 对象暂时没有 GetObjID
+        if connSkill and hasattr(connSkill, "GetObjID") and self._batObj.GetID() == connSkill.GetObjID():
+            skillID = connSkill.GetSkillID()
+            skillManager = self._batObj.GetSkillManager()
+            # 非对象身上的技能,读取本技能被动触发的效果,一般是主技能拆分的子技能
+            if not skillManager.FindSkillByID(skillID):
+                effIDList = []
+                for index in xrange(connSkill.GetEffectCount()):
+                    effect = connSkill.GetEffect(index)
+                    effectID = effect.GetEffectID()
+                    if effectID == 0:
+                        continue
+                    tWay = effect.GetTriggerWay()
+                    tSrc = effect.GetTriggerSrc()
+                    if not tWay:
+                        continue
+                    if tWay in ChConfig.TriggerWayNoLoadList:
+                        continue
+                    if tSrc != ChConfig.TriggerSrc_SkillSelf:
+                        # 仅添加本技能的
+                        continue
+                    if tWay == ChConfig.TriggerWay_CalcEffValue:
+                        tWay = "%s_%s" % (tWay, effectID)
+                    if tWay != triggerWay:
+                        continue
+                    effIDList.append(effectID)
+                if effIDList:
+                    effList.append(["skill", skillID, effIDList])
+                    
         # 优先取关联技能的
-        if connSkillTypeID and connSkillTypeID not in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_Buff]:
+        if connSkillTypeID and connSkillTypeID not in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_Buff, ChConfig.TriggerSrc_SkillSelf, ChConfig.TriggerSrc_BuffSelf]:
             # 技能
             key = (triggerWay, connSkillTypeID)
             if key in self._AffectSkillDict:
@@ -97,15 +138,21 @@
         triggerSrc = effect.GetTriggerSrc()
         if not triggerWay:
             return
-        if triggerWay == ChConfig.TriggerWay_CurSkillEff:
+        if triggerWay in ChConfig.TriggerWayNoLoadList:
             return
-        if triggerSrc == ChConfig.TriggerSrc_Buff:
+        if triggerSrc in [ChConfig.TriggerSrc_Buff, ChConfig.TriggerSrc_BuffSelf]:
             # buff有效的不加进来
             return
         
         skillID = curSkill.GetSkillID()
         effectID = effect.GetEffectID()
         
+        if triggerWay == ChConfig.TriggerWay_CalcEffValue:
+            triggerWay = "%s_%s" % (triggerWay, effectID)
+            
+        if triggerSrc == ChConfig.TriggerSrc_SkillSelf:
+            triggerSrc = curSkill.GetSkillTypeID()
+            
         key = (triggerWay, triggerSrc)
         if key not in self._AffectSkillDict:
             self._AffectSkillDict[key] = {}
@@ -141,15 +188,21 @@
         triggerSrc = effect.GetTriggerSrc()
         if not triggerWay:
             return
-        if triggerWay == ChConfig.TriggerWay_CurSkillEff:
+        if triggerWay in ChConfig.TriggerWayNoLoadList:
             return
-        if triggerSrc == ChConfig.TriggerSrc_Skill:
+        if triggerSrc in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_SkillSelf]:
             # 技能有效的不加进来
             return
         
         buffID = buff.GetBuffID()
         effectID = effect.GetEffectID()
         
+        if triggerWay == ChConfig.TriggerWay_CalcEffValue:
+            triggerWay = "%s_%s" % (triggerWay, effectID)
+            
+        if triggerSrc == ChConfig.TriggerSrc_BuffSelf:
+            triggerSrc = skillData.GetSkillTypeID()
+            
         key = (triggerWay, triggerSrc)
         if key not in self._AffectBuffDict:
             self._AffectBuffDict[key] = {}
@@ -176,6 +229,10 @@
     
     def __init__(self):
         self.Clear()
+        return
+    
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
         return
     
     def Clear(self):
@@ -223,14 +280,17 @@
         #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)
+    def GetEffectValues(self): return self._values # 直接返回整个效果values
     def GetTriggerWay(self): return self._triggerWay
     def GetTriggerSrc(self): return self._triggerSrc
     #def GetTriggerParams(self, index): return self._triggerParams[index] if len(self._triggerParams) > index else 0
-    
-EmptyEffect = SkillEffect(0, [])
 
 class SklllData():
     
@@ -247,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
@@ -267,13 +331,14 @@
     def GetCalcType(self): return self._ipyData.GetCalcType()
     def GetSkillPer(self): return self._ipyData.GetSkillPer()
     def GetSkillValue(self): return self._ipyData.GetSkillValue()
+    def GetHurtAtkPerMax(self): return self._ipyData.GetHurtAtkPerMax()
     def GetHappenRate(self): return self._ipyData.GetHappenRate() # 触发概率
     def GetEffect(self, index): return self._effList[index] if len(self._effList) > index else 0
     def GetEffectCount(self): return len(self._effList)
-    def GetEffectByID(self, effID, triggerWay=0): return self._effDict.get((effID, triggerWay), EmptyEffect)
+    def GetEffectByID(self, effID, triggerWay=0): return self._effDict.get((effID, triggerWay), None)
     def GetConnSkill(self): return self._ipyData.GetConnSkill()
     def GetCoolDownTime(self): return self._ipyData.GetCoolDownTime()
-    def GetIgnoreStates(self): return self._ipyData.GetIgnoreStates() # 无视限制列表
+    def GetBuffStateLimit(self): return self._ipyData.GetBuffStateLimit()
     def GetCurBuffState(self): return self._ipyData.GetCurBuffState()
     def GetLastTime(self): return self._ipyData.GetLastTime() # 持续时间
     def GetLayerCnt(self): return self._ipyData.GetLayerCnt()
@@ -295,6 +360,10 @@
         self._value1 = 0 # 值需要通知前端,开发时注意20亿问题
         self._value2 = 0
         self._value3 = 0
+        return
+    
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
         return
     
     def GetSkillData(self): return self._skillData
@@ -337,6 +406,11 @@
         # 该项目设定同一个对象可能同时存在多个相同skillID的buff,独立算CD
         return
     
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self._batObj = None
+        return
+    
     def ClearBuff(self):
         poolMgr = ObjPool.GetPoolMgr()
         for buff in self._buffList:
@@ -344,6 +418,7 @@
         self._buffList = []
         self._buffIDDict = {}
         self._skillTypeIDBuffIDs = {}
+        self._buffStateDict = {}
         self._buffID = 0
         return
     
@@ -400,18 +475,34 @@
         return
     
     def GetBuff(self, buffID): return self._buffIDDict.get(buffID, None)
-    def FindBuffBySkillID(self, skillID):
+    def FindBuffListBySkillID(self, skillID):
         ## 返回该技能ID的所有buff列表
         skillData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
         if not skillData:
             return []
-        return self.FindBuffBySkillTypeID(skillData.GetSkillTypeID())
-    def FindBuffBySkillTypeID(self, skillTypeID):
+        return self.FindBuffListBySkillTypeID(skillData.GetSkillTypeID())
+    def FindBuffListBySkillTypeID(self, skillTypeID):
         ## 返回该技能TypeID的所有buff列表
         if skillTypeID not in self._skillTypeIDBuffIDs:
             return []
         buffs = []
         for buffID in self._skillTypeIDBuffIDs[skillTypeID]:
+            if buffID not in self._buffIDDict:
+                continue
+            buffs.append(self._buffIDDict[buffID])
+        return buffs
+    def FindBuffByState(self, state):
+        ## 查找某种buff状态的buff
+        buffIDList = self._buffStateDict.get(state, [])
+        if not buffIDList:
+            return
+        buffID = buffIDList[0]
+        return self._buffIDDict.get(buffID, None)
+    def FindBuffListByState(self, state):
+        ## 查找某种buff状态的buff列表
+        buffIDList = self._buffStateDict.get(state, [])
+        buffs = []
+        for buffID in buffIDList:
             if buffID not in self._buffIDDict:
                 continue
             buffs.append(self._buffIDDict[buffID])
@@ -444,25 +535,45 @@
     
 class PySkill():
     
-    def __init__(self, ipyData):
+    def __init__(self, ipyData, objID):
+        self._objID = objID # 该技能谁的
         self._skillData = ObjPool.GetPoolMgr().acquire(SklllData, ipyData)
         self._calcTime = 0
         self._remainTime = 0
         self._batType = 0 # 战斗类型,普通、连击、反击、追击等
         self._tagObjList = [] # 本次技能目标列表 [BatObj, ...]
+        self._killObjList = [] # 本次技能击杀目标列表 [BatObj, ...]
         self._hurtList = [] # 本次伤血列表,可能同一个对象有多个伤害,如弹射等 [HurtObj, ...]
         self._bySkill = None # 由哪个技能触发的
+        self._byBuff = None # 由哪个buff触发的
         self._afterLogicList = [] # 技能释放后需要处理逻辑 [[logicType, logicParams], ...]
+        
+        # 连击相关
+        self._comboState = 0 # 连击状态 0-未重置,1-初始化连击相关可连击,2-连击已中断
+        self._comboNum = 0 # 连击次数
+        self._missTagIDDict = {} # 单次连续连击中对方已闪避次数 {tagID:missNum, ...}
+        self._parryTagIDDict = {} # 单次连续连击中对方已格挡次数 {tagID:parryNum, ...}
+        return
+    
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self.ResetUseRec()
         return
     
     def ResetUseRec(self):
+        ## 重置技能使用记录
+        ## 注:有用到对象池相关对象的一定要重置,不然再回收技能对象时会连同该技能下的所有用到的对象池对象一并回收,导致后续使用对象错误
         self._batType = 0
         self._tagObjList = []
+        self._killObjList = []
         self._bySkill = None
+        self._byBuff = None
         self._afterLogicList = []
         self.ClearHurtObj()
         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()
@@ -480,13 +591,14 @@
     def GetCalcType(self): return self._skillData.GetCalcType()
     def GetSkillPer(self): return self._skillData.GetSkillPer()
     def GetSkillValue(self): return self._skillData.GetSkillValue()
+    def GetHurtAtkPerMax(self): return self._skillData.GetHurtAtkPerMax()
     def GetHappenRate(self): return self._skillData.GetHappenRate() # 触发概率
     def GetEffect(self, index): return self._skillData.GetEffect(index)
     def GetEffectCount(self): return self._skillData.GetEffectCount()
     def GetEffectByID(self, effID, triggerWay=0): return self._skillData.GetEffectByID(effID, triggerWay)
     def GetConnSkill(self): return self._skillData.GetConnSkill()
     def GetCoolDownTime(self): return self._skillData.GetCoolDownTime()
-    def GetIgnoreStates(self): return self._skillData.GetIgnoreStates() # 无视限制列表
+    def GetBuffStateLimit(self): return self._skillData.GetBuffStateLimit()
     def GetCurBuffState(self): return self._skillData.GetCurBuffState()
     def GetLastTime(self): return self._skillData.GetLastTime() # 持续时间
     def GetLayerCnt(self): return self._skillData.GetLayerCnt()
@@ -505,8 +617,12 @@
     def SetBatType(self, batType): self._batType = batType
     def GetBySkill(self): return self._bySkill
     def SetBySkill(self, bySkill): self._bySkill = bySkill
+    def GetByBuff(self): return self._byBuff
+    def SetByBuff(self, byBuff): self._byBuff = byBuff
     def GetTagObjList(self): return self._tagObjList # 技能目标列表
     def SetTagObjList(self, tagObjList): self._tagObjList = tagObjList
+    def GetKillObjList(self): return self._killObjList # 击杀目标列表
+    def SetKillObjList(self, killObjList): self._killObjList = killObjList
     def GetAfterLogicList(self): return self._afterLogicList
     def AddAfterLogic(self, logicType, logicData):
         '''添加技能释放后需要处理额外逻辑
@@ -530,12 +646,51 @@
         return hurtObj
     def GetHurtObjList(self): return self._hurtList
     
+    def __commboClear(self):
+        ## 连击相关清空
+        self._comboState = 0
+        self._comboNum = 0
+        self._missTagIDDict = {}
+        self._parryTagIDDict = {}
+        return
+    
+    def ComboCheckStart(self, force=False):
+        ## 检查并设置开始连击相关,一般是开始使用技能时调用
+        if not force:
+            if self._comboState == 1:
+                #GameWorld.DebugLog("连击进行中,不重置")
+                return
+        self.__commboClear()
+        self._comboState = 1 # 设置已初始化连击相关
+        #GameWorld.DebugLog("连击重置")
+        return
+    
+    def ComboEnable(self): return self._comboState == 1 ## 可否执行连击相关
+    
+    def ComboInterrupt(self):
+        ## 连击中断,概率不再触发连击时需要设置中断
+        self._comboState = 2
+        return
+    
+    def GetComboNum(self): return self._comboNum # 已连击次数
+    def SetComboNum(self, comboNum): self._comboNum = comboNum
+    def GetTagMissNum(self, tagID): return self._missTagIDDict.get(tagID, 0)
+    def SetTagMissNum(self, tagID, missNum): self._missTagIDDict[tagID] = missNum
+    def GetTagParryNum(self, tagID): return self._parryTagIDDict.get(tagID, 0)
+    def SetTagParryNum(self, tagID, parryNum): self._parryTagIDDict[tagID] = parryNum
+    
 class SkillManager():
     ## 战斗对象技能管理器
     
-    def __init__(self):
+    def __init__(self, batObj):
+        self._batObj = batObj
         self._skillList = [] # 技能列表 [PySkill, ...]
         self._skillDict = {} # {skillID:PySkill, ...}
+        return
+    
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
+        self._batObj = None
         return
     
     def SkillReset(self):
@@ -572,7 +727,7 @@
             self.__deleteSkill(curSkill)
             
         # 学新技能
-        curSkill = ObjPool.GetPoolMgr().acquire(PySkill, ipyData)
+        curSkill = ObjPool.GetPoolMgr().acquire(PySkill, ipyData, self._batObj.GetID())
         self._skillDict[skillID] = curSkill
         self._skillList.append(curSkill)
         return curSkill
@@ -598,7 +753,9 @@
         self.skinID = 0
         self.country = 0
         self.atkDistType = 0
+        self.specialty = 0 # 特长
         self.sex = 0
+        self.job = 0
         self.lv = 1
         self.fightPower = 0
         self.faction = 0 # 所属阵营,一般只有双方阵营, 1 或 2,发起方默认1
@@ -608,19 +765,25 @@
         self._xp = 0 # 当前怒气值
         self._isAlive = True # 是否活着
         self._initAttrDict = {} # 初始化时的属性,固定不变,初始化时已经算好的属性  {attrID:value, ...}
-        self._batAttrDict = {} # 实际战斗属性,包含buff层级的实际属性
-        self._skillTempAttrDict = {} # 某次技能释放中临时的属性增减 {attrID:+-value, ...}
+        self._batAttrDict = {} # 实际战斗属性,包含buff层级的实际属性 {attrID:+-value, ...} value可能是负值
+        self._skillTempAttrDict = {} # 某次技能释放中临时的属性增减 {attrID:+-value, ...} value可能是负值
         self._kvDict = {} # 自定义kv字典
         self._skillUseCntDict = {} # 技能累计使用次数 {skillID:useCnt, ...}
         self._skillTurnUseCntDict = {} # 技能单回合累计使用次数 {skillID:useCnt, ...}
-        self._skillMgr = ObjPool.GetPoolMgr().acquire(SkillManager)
+        self._skillMgr = ObjPool.GetPoolMgr().acquire(SkillManager, self)
         self._buffMgr = ObjPool.GetPoolMgr().acquire(BuffManager, self)
         self._passiveEffMgr = ObjPool.GetPoolMgr().acquire(PassiveEffManager, self)
+        self._lastHurtValue = 0
+        self._mainTagIDList = [] # 主技能目标ID列表,一般用于技能拆分成多个技能效果时,子技能可能会用到主技能的对象做逻辑
         
         # 统计
         self.hurtStat = 0 # 输出统计
         self.defStat = 0 # 承伤统计
         self.cureStat = 0 # 治疗统计
+        return
+    
+    def onRelease(self):
+        ## 回收前处理,主要处理一些其他不需要释放的对象池对象,防止被连同误回收
         return
     
     def InitBatAttr(self, initAttrDict, initXP=0):
@@ -631,13 +794,18 @@
         self._initAttrDict = initAttrDict
         self._batAttrDict = {}
         self._batAttrDict.update(initAttrDict)
+        self.__onUpdBatAttr()
         self._skillTempAttrDict = {}
-        self._xp = initXP
-        self._hp = initAttrDict.get(ChConfig.AttrID_MaxHP, 1)
+        self.SetXP(initXP, False)
+        self.SetHPFull(False)
         TurnBuff.RefreshBuffAttr(self)
         TurnPassive.RefreshPassive(self)
         return
     
+    def TurnReset(self):
+        ## 回合重置
+        self._skillTurnUseCntDict = {}
+        
     def UpdInitBatAttr(self, initAttrDict, skillIDList):
         ## 更新战斗属性,一般只有主阵容需要更新,战斗中养成、装备变化等引起的主阵容属性变更时需要实时更新
         self._initAttrDict = initAttrDict
@@ -650,9 +818,24 @@
             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)
+        self.__onUpdBatAttr()
         return self._batAttrDict
     
     def GetTFGUID(self): return self.tfGUID # 所属的某场战斗
@@ -667,8 +850,12 @@
     def SetCountry(self, country): self.country = country
     def GetAtkDistType(self): return self.atkDistType
     def SetAtkDistType(self, atkDistType): self.atkDistType = atkDistType
+    def GetSpecialty(self): return self.specialty
+    def SetSpecialty(self, specialty): self.specialty = specialty
     def GetSex(self): return self.sex
     def SetSex(self, sex): self.sex = sex
+    def GetJob(self): return self.job
+    def SetJob(self, job): self.job = job
     def GetNPCID(self): return self.npcID # 如果是NPC战斗单位,则该值非0
     def SetNPCID(self, npcID): self.npcID = npcID # 设置所属的NPCID
     def GetHeroID(self): return self.heroID
@@ -704,22 +891,38 @@
         #    return False
         return True
     
-    def IsInState(self, state):
+    def CheckInState(self, checkInState):
         ## 是否处于某种状态下
-        return self._buffMgr.IsInBuffState(state)
-    
-    def IsInControlled(self):
-        ## 是否被控制中
-        for state in ChConfig.InControlledStateList:
-            if self.IsInState(state):
+        if isinstance(checkInState, int):
+            checkInStateList = [checkInState]
+        elif isinstance(checkInState, list) or isinstance(checkInState, tuple):
+            checkInStateList = checkInState
+        else:
+            return False
+        for state in checkInStateList:
+            if self._buffMgr.IsInBuffState(state):
                 return True
         return False
+    
+    def IsInControlled(self): return self.IsInBuffStateGroup(1) or self.IsInBuffStateGroup(2) # 是否被控制中
+    def IsInControlledHard(self): return self.IsInBuffStateGroup(1) # 是否被硬控中
+    def IsInBuffStateGroup(self, buffStateGroup):
+        '''是否在某个状态组中
+                        已定义的组: 1 - 硬控组;2 - 软控组;3 - 限制普攻组;4 - 限制怒技组;5 - 限制被动动态组
+        '''
+        buffStateGroupDict = IpyGameDataPY.GetFuncEvalCfg("BuffStateGroup", 1, {})
+        if buffStateGroup not in buffStateGroupDict:
+            return
+        for state in buffStateGroupDict[buffStateGroup]:
+            if self._buffMgr.IsInBuffState(state):
+                return state
+        return
     
     def CanAction(self):
         ## 是否可以行动
         if not self.IsAlive():
             return False
-        if self.IsInControlled():
+        if self.IsInControlledHard():
             return False
         return True
     
@@ -743,14 +946,16 @@
     def SetDead(self):
         self._isAlive = False
         self._hp = 0
-    def GetMaxHP(self): return self._batAttrDict.get(ChConfig.AttrID_MaxHP, 0)
+    def GetMaxHP(self): return int(self._batAttrDict.get(ChConfig.AttrID_MaxHP, 0))
     def SetMaxHP(self, maxHP, isNotify=False):
+        maxHP = int(maxHP)
         self._batAttrDict[ChConfig.AttrID_MaxHP] = maxHP
         if isNotify:
             NotifyObjInfoRefresh(self, ChConfig.AttrID_MaxHP, maxHP)
         return
     def GetHP(self): return self._hp
     def SetHP(self, hp, isNotify=False):
+        hp = int(hp)
         self._hp = hp
         if isNotify:
             NotifyObjInfoRefresh(self, ChConfig.AttrID_HP, hp)
@@ -758,6 +963,7 @@
     def SetHPFull(self, isNotify=True): self.SetHP(self.GetMaxHP(), isNotify)
     def GetXP(self): return self._xp
     def SetXP(self, xp, isNotify=True):
+        xp = int(xp)
         self._xp = xp
         if isNotify:
             NotifyObjInfoRefresh(self, ChConfig.AttrID_XP, xp)
@@ -765,14 +971,22 @@
     def GetAtk(self): return self.GetBatAttrValue(ChConfig.AttrID_Atk)
     def GetDef(self): return self.GetBatAttrValue(ChConfig.AttrID_Def)
     
+    def GetBatAttrDict(self): return self._batAttrDict
     def GetBatAttrValue(self, attrID, includeTemp=True):
         #ChConfig.AttrID_HP ChConfig.AttrID_XP
         value = self._batAttrDict.get(attrID, 0)
         if includeTemp and attrID in self._skillTempAttrDict:
             value += self._skillTempAttrDict[attrID] # 支持正负值
-            value = max(1, value)
+            #value = max(1, value)
         return value
-    def SetBatAttrValue(self, attrID, value): self._batAttrDict[attrID] = value
+    def SetBatAttrValue(self, attrID, value):
+        self._batAttrDict[attrID] = value
+        self.__onUpdBatAttr()
+        return
+    def __onUpdBatAttr(self):
+        for attrID in [ChConfig.AttrID_MaxHP]:
+            self._batAttrDict[attrID] = int(self._batAttrDict.get(attrID, 0))
+        return
     def AddSkillTempAttr(self, attrID, value):
         ## 增加技能临时属性,支持正负值
         # @param value: 正值-加属性;负值-减属性
@@ -785,6 +999,12 @@
         self._skillUseCntDict[skillID] = self._skillUseCntDict.get(skillID, 0) + 1
         self._skillTurnUseCntDict[skillID] = self._skillTurnUseCntDict.get(skillID, 0) + 1
         
+    def GetLastHurtValue(self): return self._lastHurtValue
+    def SetLastHurtValue(self, lastHurtValue): self._lastHurtValue = lastHurtValue
+    
+    def GetMainTagIDList(self): return self._mainTagIDList
+    def SetMainTagIDList(self, mainTagIDList): self._mainTagIDList = mainTagIDList
+    
     def StatHurtValue(self, hurtValue):
         ## 统计输出
         self.hurtStat += hurtValue
@@ -799,10 +1019,6 @@
         ## 统计治疗
         self.cureStat += cureValue
         return self.cureStat
-    
-    def TurnReset(self):
-        ## 回合重置
-        self._skillTurnUseCntDict = {}
     
 class BattleObjMgr():
     ## 战斗对象管理器

--
Gitblit v1.8.0