From 1dda3d626b80d346354efeafe7b5f7f40d571b50 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 24 十月 2018 17:17:18 +0800 Subject: [PATCH] 4329 【1.2】【后端】 骑宠争夺boss血量成长(NPC人数成长属性系数支持按范围配置或按公式配置) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py index 3f0bc15..09556f1 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py +++ b/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" -- Gitblit v1.8.0