| | |
| | | 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]
|
| | |
| | | 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"
|