Skip to content

Math Node

Noogear edited this page Mar 9, 2026 · 2 revisions

数学运算 (math)

math 节点对数学表达式求值并将结果存入变量。

基本格式

- math: "<expression>"
  store: "<variableName>"
字段 类型 必填 说明
math String 数学表达式(支持 {变量} 引用)
store String 结果存入此变量名(double 类型)

示例

基本运算

- math: "{damage} * 1.5 + {bonus}"
  store: "finalDamage"

使用内置函数

- math: "clamp({attack} * (1 + {level} * 0.05) - {defense} * 0.3, 1, 99999)"
  store: "finalDmg"

带随机浮动

- math: "{base} * (1 + rand(0.4) - 0.2)"
  store: "randomizedDamage"

距离计算

- math: "sqrt({x}^2 + {y}^2 + {z}^2)"
  store: "distance"

条件表达式

- math: "{isCritical} >= 1 ? {damage} * 2 : {damage}"
  store: "finalDmg"

完整的运算符、函数、优先级参考 → 数学表达式

Clone this wiki locally