129 【战斗】战斗系统-服务端(贾诩所有技能;5022效果支持配置buff额外属性计算方式;)
3个文件已修改
49 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
@@ -421,7 +421,7 @@
        self._value2 = 0
        self._value3 = 0
        self._isCopy = 0 # 是否复制的buff
        self._effExDict = {} # 效果ID额外数值 {effID:value, ...} # 计算方式取决于本buff技能中属性效果ID的配置
        self._effExDict = {} # 效果ID额外数值 {(effID, calcType):value, ...} # 计算方式取决于本buff技能中属性效果ID的配置
        self._haloObjIDList = [] # 光环有效目标ID列表 [objID, ...],ownerID为自己时即为光源,包含光源
        return
    
@@ -465,11 +465,8 @@
    def SetValue3(self, value): self._value3 = value
    def GetIsCopy(self): return self._isCopy
    def SetIsCopy(self, isCopy): self._isCopy = isCopy
    def GetEffectValueEx(self, effID):
        if effID in self._effExDict:
            return self._effExDict[effID]
    def ResetEffectValueEx(self): self._effExDict = {}
    def AddEffectValueEx(self, effID, valueEx): self._effExDict[effID] = self._effExDict.get(effID, 0) + valueEx
    def AddEffectValueEx(self, effID, valueEx, calcType=1): self._effExDict[(effID, calcType)] = self._effExDict.get((effID, calcType), 0) + valueEx
    def GetEffectExDict(self): return self._effExDict
    def GetHaloObjIDList(self): return self._haloObjIDList
    def SetHaloObjIDList(self, haloObjIDList): self._haloObjIDList = haloObjIDList
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
@@ -4,12 +4,12 @@
#
##@package Skill.PassiveTrigger.PassiveEff_5022
#
# @todo:额外增加buff效果ID/属性ID值
# @todo:额外增加/减少buff效果ID/属性ID值
# @author hxp
# @date 2025-10-30
# @version 1.0
#
# 详细描述: 额外增加buff效果ID/属性ID值
# 详细描述: 额外增加/减少buff效果ID/属性ID值
#
#-------------------------------------------------------------------------------
#"""Version = 2025-10-30 16:00"""
@@ -18,10 +18,12 @@
import GameWorld
def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
    effValues = curEffect.GetEffectValues()
    for index in range(0, len(effValues), 2):
        attrID = effValues[index]
        attrValue = effValues[index + 1] if len(effValues) > index + 1 else 0
        GameWorld.DebugLog("额外增加buff效果ID/属性ID值: attrID=%s,attrValue=%s" % (attrID, attrValue))
        connBuff.AddEffectValueEx(attrID, attrValue)
    effEx1 = curEffect.GetEffectValue(0) # 支持多个属性
    effEx2 = curEffect.GetEffectValue(1) # 支持多个属性
    for effEX in [effEx1, effEx2]:
        if not isinstance(effEX, list) or len(effEX) != 3:
            continue
        attrID, attrValue, calcType = effEX
        GameWorld.DebugLogEx("额外buff效果ID/属性ID值: attrID=%s,attrValue=%s,calcType=%s", attrID, attrValue, calcType)
        connBuff.AddEffectValueEx(attrID, attrValue, calcType)
    return True
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py
@@ -177,18 +177,26 @@
            nowLayerCnt = buff.GetLayer()
            GameWorld.DebugLogEx("    已经存在该buff: buffID=%s,skillTypeID=%s,ownerID=%s,buffRepeat=%s", buffID, skillTypeID, ownerID, buffRepeat)
            
            resetAddTiming = False # 一般只有覆盖的才重新计算回合,视为重新添加
            remainTime = buffSkill.GetLastTime()
            updLayerCnt = addLayerCnt
            if buffRepeat == 3: # 叠加层级
                updLayerCnt = nowLayerCnt + addLayerCnt
                if maxLayerCnt and updLayerCnt > maxLayerCnt:
                    updLayerCnt = maxLayerCnt
                GameWorld.DebugLogEx("        叠加层级: nowLayerCnt=%s,addLayerCnt=%s,updLayerCnt=%s,maxLayerCnt=%s", nowLayerCnt, addLayerCnt, updLayerCnt, maxLayerCnt)
            elif buffRepeat == 1: # 延长回合
                addTime = buffSkill.GetLastTime()
                remainTime = buff.GetRemainTime() + addTime
                GameWorld.DebugLogEx("        延长回合: addTime=%s,updRemainTime=%s", addTime, remainTime)
            else:
                GameWorld.DebugLogEx("        默认覆盖")
                resetAddTiming = True
                
            # 重置回合、CD、值等
            buff.SetAddTiming(batObj.GetTiming())
            buff.SetRemainTime(buffSkill.GetLastTime())
            if resetAddTiming:
                buff.SetAddTiming(batObj.GetTiming())
            buff.SetRemainTime(remainTime)
            buff.SetLayer(updLayerCnt)
            buff.SetBuffValueList(buffValueList)
            buff.ResetEffectValueEx()
@@ -528,11 +536,11 @@
    '''
    
    objID = batObj.GetID()
    befHP = batObj.GetHP()
    befMaxHP = batObj.GetMaxHP()
    
    batAttrDict = batObj.ResetBattleEffect()
    
    befHP = batObj.GetHP()
    befMaxHP = batObj.GetMaxHP()
    GameWorld.DebugLogEx("RefreshBuffAttr ID:%s,atk=%s,def=%s,hp=%s/%s,batAttrDict=%s", 
                         objID, batObj.GetAtk(), batObj.GetDef(), befHP, befMaxHP, batAttrDict)
    
@@ -571,11 +579,14 @@
        skillData = buff.GetSkillData()
        
        effExDict = buff.GetEffectExDict()
        for effID, effValueEx in effExDict.items():
        for effCalcInfo, effValueEx in effExDict.items():
            effID, calcType = effCalcInfo
            if effID not in ChConfig.AttrIDList:
                continue
            attrID = effID
            attrValue = effValueEx * layer
            if calcType == 2: # 减少,其他默认增加
                attrValue = -attrValue
            buffsAttrDict[attrID] = buffsAttrDict.get(attrID, 0) + attrValue
            skbufAttrDict[attrID] = skbufAttrDict.get(attrID, 0) + attrValue
            
@@ -631,6 +642,9 @@
        if befHP and aftMaxHP > befMaxHP:
            aftHP += (aftMaxHP - befMaxHP)
            batObj.SetHP(aftHP, isNotify)
        elif aftHP > aftMaxHP:
            aftHP = aftMaxHP
            batObj.SetHP(aftHP, isNotify)
    GameWorld.DebugLogEx("    befHP=%s/%s, aftHP=%s/%s", befHP, befMaxHP, aftHP, aftMaxHP)
    GameWorld.DebugLogEx("    最终属性 ID:%s,atk=%s,def=%s,hp=%s/%s,%s", objID, batObj.GetAtk(), batObj.GetDef(), aftHP, aftMaxHP, batObj.GetBatAttrDict())
    return