4329 【1.2】【后端】 骑宠争夺boss血量成长(NPC人数成长属性系数支持按范围配置或按公式配置)
1个文件已修改
13 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -301,11 +301,14 @@
    if strengthenPlayerCnt:
        mapID = GameWorld.GetMap().GetMapID()
        dataMapID = FBCommon.GetRecordMapID(mapID)
        formulaKey = "MapCoefficient_%s" % mapID
        playerCntAttrCoefficient = playerCntCoefficient.get(mapID, {})
        if not playerCntAttrCoefficient and dataMapID in playerCntCoefficient:
            playerCntAttrCoefficient = playerCntCoefficient[dataMapID]
            formulaKey = "MapCoefficient_%s" % dataMapID
        if npcID in npcIDPlayerCntCoefficient:
            playerCntAttrCoefficient = npcIDPlayerCntCoefficient[npcID]
            formulaKey = "NPCCoefficient_%s" % npcID
        for attrKey, coefficientDict in playerCntAttrCoefficient.items():
            if attrKey in attrDict:
                attrValue = attrDict[attrKey]
@@ -316,7 +319,15 @@
                if not hasattr(npcData, attrFuncName):
                    continue
                attrValue = getattr(npcData, attrFuncName)()
            coefficient = GameWorld.GetDictValueByRangeKey(coefficientDict, strengthenPlayerCnt, 1)
            # 按字典配置
            if isinstance(coefficientDict, dict):
                coefficient = GameWorld.GetDictValueByRangeKey(coefficientDict, strengthenPlayerCnt, 1)
            # 按公式配置
            elif isinstance(coefficientDict, str):
                formulaKey = "%s_%s" % (formulaKey, attrKey)
                coefficient = eval(FormulaControl.GetCompileFormula(formulaKey, coefficientDict))
            else:
                coefficient = 1
            attrDict[attrKey] = int(attrValue * coefficient)
            
    #GameWorld.DebugLog("计算NPC属性成长: npcID=%s,strengthenLV=%s,strengthenPlayerCnt=%s,baseMaxHP=%s,attrDict=%s"