Repository navigation
Math Expressions
Noogear edited this page Mar 9, 2026
·
3 revisions
math 节点、check 的 value 字段以及动画配置中的 equation 类型均支持完整的数学表达式语法。
数学表达式语法完整文档(运算符、内置函数、变量引用、优先级)→ GloomLib Wiki
- math: "{attack} * (1 + {level} * 0.1)"
store: "scaledDamage"- check: hp
op: "<="
value: "{max_hp} * 0.3" # hp 低于 30% 最大生命animation:
wave:
type: equation
duration: 60
sample_interval: 2
math:
position:
x: "sin(t * 0.2) * 0.5"
y: "t * 0.04"
z: "cos(t * 0.2) * 0.5"
scale:
x: "1 + sin(t * 0.1) * 0.3"
y: "1 + sin(t * 0.1) * 0.3"
z: "1 + sin(t * 0.1) * 0.3"
opacity: "clamp(127 - t * 2, 0, 127)"settings:
offset:
x: "r * 0.6 - 0.3" # r ∈ [0, 1) 随机数
y: "r * 0.4"
z: "r * 0.6 - 0.3"# 带随机浮动的伤害
- math: "{base} * (1 + rand(0.4) - 0.2)"
store: "randomizedDamage"
# 冷却时间钳制
- math: "clamp({speed} * 0.8, 0.5, 5.0)"
store: "cooldown"
# RPG 伤害公式
- math: "clamp({attack} * (1 + {level} * 0.05) - {defense} * 0.3, 1, 99999)"
store: "finalDmg"