From 985bdf70fd0022733f75bf2106e69c6de77c26b1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 28 十一月 2025 17:29:51 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(卑弥呼所有技能;技能表增加字段Buff保留-BuffRetain,支持死亡保留、复活保留;增加触发方式42-大回合开始时(死亡后有效);增加属性ID 73复活生命加成、74复活怒气加成;优化效果6014-支持失败次数额外概率;优化死亡、复活时的buff处理;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/FormulaControl.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/FormulaControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/FormulaControl.py
index 514a9a4..650611d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/FormulaControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/FormulaControl.py
@@ -79,13 +79,14 @@
     #GameWorld.Log('ClearCompileFormulaDist Sucess AllFormulaDist = %s'%(AllFormulaDist))
     return
 
-def Eval(formulaKey, formula, paramDict, toInt=True, ceil=False, playerID=0):
+def Eval(formulaKey, formula, paramDict, toInt=True, ceil=False, ndigits=0, playerID=0):
     """ 动态计算
     :param formulaKey: 公式编译缓存key
     :param formula: 公式字符串,如 "int(Atk*10 + MaxHP)"
     :param paramDict: 参数字典,如 {'Atk': 100, 'MaxHP': 5000}
     :param toInt: 是否转为整数
     :param ceil: 是否向上取整
+    :param ndigits: 小数精确位数
     :return: 计算结果
     """
     compileFormula = GetCompileFormula(formulaKey, formula)
@@ -100,6 +101,7 @@
         'round': round,
         # 类型转换
         'int': int,
+        'long': long,
         'float': float,
         'bool': bool,
         # 数学常数
@@ -110,6 +112,8 @@
     try:
         # 执行计算
         value = eval(compileFormula, safe_env)
+        if ndigits > 0:
+            value = round(value, ndigits)
         if ceil:
             value = math.ceil(value)
         if toInt:

--
Gitblit v1.8.0