> For the complete documentation index, see [llms.txt](https://bothelp.hktrpg.com/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bothelp.hktrpg.com/guide/zh-hans/yu-le-gong-neng/storyteller-hu-dong-gu-shi-xi-tong/fan-li/04.-test.md).

# 04. test

```
// RUN_DESIGN 功能测试剧本 (v4: 大量变量组合与 if/ifs 分离测试)

[meta] title "大量变量组合与 if/ifs 分离测试"
[meta] author "SAD"
[intro] 这个剧本的内核在于起始页面(label 0)，它会运行密集的条件检查来验证引擎的运算逻辑。此版本特别区分了 if 条件链与 ifs 独立条件的行为，并添加了超过50种复杂的逻辑与算术比较。

// --- 玩家变量定义 ---
[player_var] player_name "请输入你的冒险者名字：" "例如：测试员"

// --- 游戏属性定义 (4个) ---
[stat_def] Strength 1 10 "力量 (Strength)"
[stat_def] Agility 1 10 "敏捷 (Agility)"
[stat_def] Wit 1 10 "智能 (Wit)"
[stat_def] Charm 1 10 "魅力 (Charm)"

// --- 故事开始 ---

[label] 0
[title] 变量测试平台
[text] 欢迎，{player_name}！系统正在运行大量条件检查...
[text] ---
[text] [ sezione 1: 'ifs' 独立条件测试 (应显示所有符合项目) ]

// 确切属性值 (使用 ifs)
[text|ifs=Strength==1]确切属性值 -> Strength: 1
[text|ifs=Strength==2]确切属性值 -> Strength: 2
[text|ifs=Strength==3]确切属性值 -> Strength: 3
[text|ifs=Strength==4]确切属性值 -> Strength: 4
[text|ifs=Strength==5]确切属性值 -> Strength: 5
[text|ifs=Strength==6]确切属性值 -> Strength: 6
[text|ifs=Strength==7]确切属性值 -> Strength: 7
[text|ifs=Strength==8]确切属性值 -> Strength: 8
[text|ifs=Strength==9]确切属性值 -> Strength: 9
[text|ifs=Strength==10]确切属性值 -> Strength: 10
[text]
[text|ifs=Agility==1]确切属性值 -> Agility: 1
[text|ifs=Agility==2]确切属性值 -> Agility: 2
[text|ifs=Agility==3]确切属性值 -> Agility: 3
[text|ifs=Agility==4]确切属性值 -> Agility: 4
[text|ifs=Agility==5]确切属性值 -> Agility: 5
[text|ifs=Agility==6]确切属性值 -> Agility: 6
[text|ifs=Agility==7]确切属性值 -> Agility: 7
[text|ifs=Agility==8]确切属性值 -> Agility: 8
[text|ifs=Agility==9]确切属性值 -> Agility: 9
[text|ifs=Agility==10]确切属性值 -> Agility: 10
[text]
[text|ifs=Wit==1]确切属性值 -> Wit: 1
[text|ifs=Wit==2]确切属性值 -> Wit: 2
[text|ifs=Wit==3]确切属性值 -> Wit: 3
[text|ifs=Wit==4]确切属性值 -> Wit: 4
[text|ifs=Wit==5]确切属性值 -> Wit: 5
[text|ifs=Wit==6]确切属性值 -> Wit: 6
[text|ifs=Wit==7]确切属性值 -> Wit: 7
[text|ifs=Wit==8]确切属性值 -> Wit: 8
[text|ifs=Wit==9]确切属性值 -> Wit: 9
[text|ifs=Wit==10]确切属性值 -> Wit: 10
[text]
[text|ifs=Charm==1]确切属性值 -> Charm: 1
[text|ifs=Charm==2]确切属性值 -> Charm: 2
[text|ifs=Charm==3]确切属性值 -> Charm: 3
[text|ifs=Charm==4]确切属性值 -> Charm: 4
[text|ifs=Charm==5]确切属性值 -> Charm: 5
[text|ifs=Charm==6]确切属性值 -> Charm: 6
[text|ifs=Charm==7]确切属性值 -> Charm: 7
[text|ifs=Charm==8]确切属性值 -> Charm: 8
[text|ifs=Charm==9]确切属性值 -> Charm: 9
[text|ifs=Charm==10]确切属性值 -> Charm: 10

// 属性两两比较 (使用 ifs)
[text] ---
[text|ifs=Strength>Agility]比较 -> Strength ({Strength}) > Agility ({Agility})
[text|ifs=Strength<Agility]比较 -> Strength ({Strength}) < Agility ({Agility})
[text|ifs=Strength==Agility]比较 -> Strength ({Strength}) == Agility ({Agility})
[text|ifs=Strength>Wit]比较 -> Strength ({Strength}) > Wit ({Wit})
[text|ifs=Strength<Wit]比较 -> Strength ({Strength}) < Wit ({Wit})
[text|ifs=Strength==Wit]比较 -> Strength ({Strength}) == Wit ({Wit})
[text|ifs=Strength>Charm]比较 -> Strength ({Strength}) > Charm ({Charm})
[text|ifs=Strength<Charm]比较 -> Strength ({Strength}) < Charm ({Charm})
[text|ifs=Strength==Charm]比较 -> Strength ({Strength}) == Charm ({Charm})
[text|ifs=Agility>Wit]比较 -> Agility ({Agility}) > Wit ({Wit})
[text|ifs=Agility<Wit]比较 -> Agility ({Agility}) < Wit ({Wit})
[text|ifs=Agility==Wit]比较 -> Agility ({Agility}) == Wit ({Wit})
[text|ifs=Agility>Charm]比较 -> Agility ({Agility}) > Charm ({Charm})
[text|ifs=Agility<Charm]比较 -> Agility ({Agility}) < Charm ({Charm})
[text|ifs=Agility==Charm]比较 -> Agility ({Agility}) == Charm ({Charm})
[text|ifs=Wit>Charm]比较 -> Wit ({Wit}) > Charm ({Charm})
[text|ifs=Wit<Charm]比较 -> Wit ({Wit}) < Charm ({Charm})
[text|ifs=Wit==Charm]比较 -> Wit ({Wit}) == Charm ({Charm})

[text] ---
[text] [ sezione 2: 'if' 条件链测试 (应只显示第一个符合项目) ]
[text|if=Strength > Agility && Strength > Wit && Strength > Charm]IF链 测试 -> 力量是最高的属性。
[text|if=Agility > Strength && Agility > Wit && Agility > Charm]IF链 测试 -> 敏捷是最高的属性。
[text|if=Wit > Strength && Wit > Agility && Wit > Charm]IF链 测试 -> 智能是最高的属性。
[text|if=Charm > Strength && Charm > Agility && Charm > Wit]IF链 测试 -> 魅力是最高的属性。
[text|if=Strength == Agility && Strength > Wit && Strength > Charm]IF链 测试 -> 力量和敏捷并列最高。
[text|else]IF链 测试 -> 属性最高者不唯一或条件未涵盖。

[text] ---
[text] [ sezione 3: 'ifs' 独立条件测试 - 50+ 复杂情况 ]
// 算术与比较
[text|ifs=(Strength + Agility) > 15]复合条件 -> 力量与敏捷的总和超过 15
[text|ifs=(Wit + Charm) < 5]复合条件 -> 智能与魅力的总和小于 5
[text|ifs=(Strength + Wit) > (Agility + Charm)]复合条件 -> 力量与智能之和 > 敏捷与魅力之和
[text|ifs=(Strength - Agility) > 5]复合条件 -> 力量比敏捷高出 5 以上
[text|ifs=Strength == (Agility + Wit)]复合条件 -> 力量等于敏捷与智能之和
[text|ifs=Charm * 2 > Strength]复合条件 -> 魅力的两倍大于力量
[text|ifs=Strength > 5 && Agility > 5]复合条件 -> 力量和敏捷都高于 5
[text|ifs=Wit <= 3 && Charm <= 3]复合条件 -> 智能和魅力都低于等于 3
[text|ifs=Strength >= 9 || Agility >= 9]复合条件 -> 力量或敏捷其中一项非常高 (>= 9)
[text|ifs=Wit == 10 || Charm == 10]复合条件 -> 智能或魅力其中一项达到顶点 (== 10)
[text|ifs=Strength > 5 && Wit > 5 && Charm > 5]复合条件 -> 力量、智能和魅力都很高 (皆 > 5)
[text|ifs=Strength < 5 || Agility < 5 || Wit < 5]复合条件 -> 力量、敏捷或智能至少有一项低于 5
[text|ifs=(Strength > 7 && Agility > 7) || (Wit > 7 && Charm > 7)]复合条件 -> (力敏组合 > 7) 或 (智魅组合 > 7)
[text|ifs=Strength >= Agility && Agility >= Wit && Wit >= Charm]复合条件 -> 属性呈现递减或相等趋势 (力>=敏>=智>=魅)
[text|ifs=Strength + Agility + Wit + Charm >= 35]复合条件 -> 四维总和达到 35 或以上
[text|ifs=Strength + Agility + Wit + Charm < 10]复合条件 -> 四维总和低于 10
[text|ifs=Strength > 3 && Strength < 8]复合条件 -> 力量处于中等范围 (3 < STR < 8)
[text|ifs=Agility == 1 || Agility == 10]复合条件 -> 敏捷为极端值 (1 或 10)
[text|ifs=Strength == Wit && Agility == Charm]复合条件 -> 属性两两成对相等 (力=智, 敏=魅)
[text|ifs=Strength != Agility && Strength != Wit && Strength != Charm && Agility != Wit && Agility != Charm && Wit != Charm]复合条件 -> 所有属性数值都互不相同
[text|ifs=Strength == Agility && Agility == Wit && Wit == Charm]复合条件 -> 所有属性数值完全相同
[text|ifs=(Strength * Wit) > (Agility * Charm)]复合条件 -> 力量与智能的乘积 > 敏捷与魅力的乘积
[text|ifs=Agility / 2 > Charm]复合条件 -> 敏捷的一半仍然大于魅力
[text|ifs=Strength % 2 == 0]复合条件 -> 力量是偶数
[text|ifs=Agility % 2 != 0]复合条件 -> 敏捷是奇数
[text|ifs=(Wit + Charm) % 2 == 0]复合条件 -> 智能与魅力之和为偶数
[text|ifs=(Strength > Agility || Strength > Wit) && Strength > Charm]复合条件 -> 力量至少比敏捷或智能高，且一定比魅力高
[text|ifs=Strength == 5 && Agility == 5 && Wit == 5 && Charm == 5]复合条件 -> 所有属性都是 5
[text|ifs=Strength > 1 && Agility > 1 && Wit > 1 && Charm > 1]复合条件 -> 没有任何属性为 1
[text|ifs=Strength == 10 && Agility == 10 && Wit == 10 && Charm == 10]复合条件 -> 所有属性都达到最大值
[text|ifs=(Strength + Agility) - (Wit + Charm) > 5]复合条件 -> (力+敏) 比 (智+魅) 的总和高出 5 以上
[text|ifs=Strength * Strength > 80]复合条件 -> 力量的平方大于 80 (即力量 > 8)
[text|ifs=Strength > Wit + 5]复合条件 -> 力量比智能高 5 点以上
[text|ifs=Charm < Agility - 3]复合条件 -> 魅力比敏捷低 3 点以上
[text|ifs=Strength == Agility || Strength == Wit || Strength == Charm]复合条件 -> 力量与至少一个其他属性相等
[text|ifs=Agility != Charm]复合条件 -> 敏捷与魅力数值不同
[text|ifs=Wit > (Strength + Agility + Charm) / 3]复合条件 -> 智能高于其他三项的平均值
[text|ifs=Strength * 10 + Agility > 80]复合条件 -> 复合权重检查 (10*STR + AGI > 80)
[text|ifs=Strength == 1 && Charm == 10]复合条件 -> 力量最低且魅力最高
[text|ifs=(Strength > 8 && Agility < 4) || (Wit > 8 && Charm < 4)]复合条件 -> 存在一组 "高攻低防" 或 "高智低魅" 的组合
[text|ifs=Agility % Strength == 0 && Strength > 1]复合条件 -> 敏捷是力量的倍数 (且力量>1)
[text|ifs=Strength + Wit == Agility + Charm]复合条件 -> 属性分组总和相等
[text|ifs=(Agility - 5) * (Wit - 5) > 0]复合条件 -> 敏捷和智能同在 5 的一侧 (同大于5或同小于5)
[text|ifs=(Strength > 5) && !(Agility > 5)]复合条件 -> 力量大于5，但敏捷不大于5
[text|ifs=Strength - Wit == 1 || Wit - Strength == 1]复合条件 -> 力量和智能的数值相邻
[text|ifs=Strength > 5 && Agility > 5 || Charm < 3]复合条件 -> (力量和敏捷都高) 或 (魅力极低)
[text|ifs=(Strength + Agility + Wit + Charm) / 4 > 6]复合条件 -> 平均属性大于 6
[text|ifs=Strength * Agility * Wit * Charm > 5000]复合条件 -> 四维乘积超过 5000
[text|ifs=Strength > Charm * 2 && Agility > Wit * 2]复合条件 -> 物理属性均为对应属性的两倍以上
[text|ifs=Strength == 1 && Agility == 2 && Wit == 3 && Charm == 4]复合条件 -> 属性为1,2,3,4的特定组合
[text|ifs=Wit - Strength > 3]复合条件 -> 智能显著高于力量 (差距>3)
[text|ifs=Agility * Charm > Strength * Wit]复合条件 -> 敏魅乘积大于力智乘积

[text] ---
[text] [ sezione 4: 独立的 'if/else' 链测试 (维持原样) ]
[text|if=Wit >= 10 && Strength >= 8]If/Else 链 -> 触发条件：高智能且高力量
[text|if=Strength >= 9 && Agility <= 2]If/Else 链 -> 触发条件：强攻低敏
[text|if=Agility >= 9 && Strength < 5]If/Else 链 -> 触发条件：高敏低力
[text|if=Strength == Agility && Agility == Wit && Wit == Charm]If/Else 链 -> 触发条件：四维完全均衡
[text|if=Strength + Agility + Wit + Charm >= 35]If/Else 链 -> 触发条件：四维总和极高
[text|if=Charm >= 8 && Wit < 5]If/Else 链 -> 触发条件：高魅力但低智能
[text|else]If/Else 链 -> 后备选项：不符合「高魅力但低智能」的条件

[text] ---
[text] [ sezione 5: 独立的 'if/else' 链测试 (高端1) ]
[text|if=!(Strength > Wit)]If/Else 链 -> 否定：力量不高于智能
[text|if=!(Agility <= 2)]If/Else 链 -> 否定：敏捷不小于等于2
[text|else]If/Else 链 -> 后备选项：未命中否定条件

[text] ---
[text] [ sezione 6: 独立的 'if/else' 链测试 (高端2) ]
[text|if=(Strength + Agility) >= (Wit + Charm)]If/Else 链 -> 复合总和：力敏不低于智魅
[text|if=(Strength >= 8) && (Wit >= 8) && !(Charm < 5)]If/Else 链 -> 复合条件：高力高智且魅力不低
[text|else]If/Else 链 -> 后备选项：不符合高端复合条件

[text] ---
[text] [ sezione 7: 独立的 'if/else' 链测试 (高端3) ]
[text|if=Strength % 2 == 0 && Wit % 2 == 0]If/Else 链 -> 同为偶数：力量与智能
[text|if=Strength % 2 != 0 && Wit % 2 != 0]If/Else 链 -> 同为奇数：力量与智能
[text|if=(Strength % 2) != (Wit % 2)]If/Else 链 -> 奇偶不同：力量与智能
[text|else]If/Else 链 -> 后备选项：未命中奇偶条件

[text] ---
[text] 测试完毕。请选择下一步。

[choice]
-> 继续进行故事 | 1
-> 直接跳到结局 | 100

[text] ---
[text] [ sezione 8: 骰子与 set 测试 ]
[set] roll=3d6+2
[text] 掷骰结果（3d6+2）：{roll}
[text|ifs=2d20>25]条件掷骰 2d20>25 命中
[text|ifs=2d20<=25]条件掷骰 2d20<=25 命中
[set|if=roll>=12] Strength=Strength+1
[set] mood=HAPPY
[text] 目前心情：{mood}

[text] ---
[text] [ sezione 9: random 测试（0%/100%） ]
[random] 0%
[text] 这行不应几乎出现（0%）
[random] 100%
[text] 这行应必定出现（100%）

[text] ---
[text] [ sezione 10: speaker 测试 ]
[text|speaker=Guide] 这是一段带有说话者属性的文本（目前显示同一般文本）。

[text] ---
[text] [ sezione 11: choice 与属性变更测试（2a/2b/2c 同页跳转） ]
[choice]
-> 测试跳转至页面2（路线 a，力量+2） | 2a | stat=Strength+2
-> 测试跳转至页面2（路线 b，敏捷+3） | 2b | stat=Agility+3
-> 测试跳转至页面2（路线 c，智能+4） | 2c | stat=Wit+4
-> 立即结束本回合 | END

[text] ---
[text] [ sezione 12: 变量 var_def 与条件 set/显示 测试 ]
[var_def] luck 3 18 "幸运 (Luck)"
[set] luck=3d6
[text] 你的幸运值为：{luck}
[text] 测试占位骰（{1D100}）：仅显示掷骰结果，无其他效果
[set|ifs=luck>=15] Charm=Charm+1
[set|ifs=luck<14] Agility=Agility-1
[text|ifs=luck>=15]幸运极佳：魅力 +1
[text|ifs=luck<14]幸运欠佳：敏捷 -1
[set|if=luck>50]Strength=Strength+1
[text|ifs=luck>50]幸运极佳：力量 +1
[set|if=luck<50]Wit=Wit+1
[text|ifs=luck<50]幸运极佳：智能 +1

[text] ---
[text] [ sezione 13: 选项条件显示/允许 测试 ]
[text] 以下选项会依条件显示：
[choice]
-> (需 Strength>=10) 测试条件选项 | 3 | if=Strength>=10
-> (需 Agility>=5) 测试条件选项 | 3 | if=Agility>=5
-> (需 Wit<=3) 测试条件选项 | 3 | if=Wit<=3

[text] ---
[text] [ sezione 14: if/else 链（总合比较与平手） ]
[text|if=Strength+Agility > Wit+Charm]If/Else 链 -> 力敏总合较高
[text|if=Strength+Agility == Wit+Charm]If/Else 链 -> 双方总合相等
[text|else]If/Else 链 -> 智魅总合较高

[text] ---
[text] [ sezione 15: random 30% 与条件 speaker ]
[random] 30%
[text] 这行有 30% 几率出现
[text|speaker=Guide,if=Charm>=7]（Guide）魅力 7 以上时才会看到这行

// 后续页面维持不变，以便在测试后还能继续操作
[label] 1
[title] 阴暗的小径
[text] 你踏上了阴暗的小径...
[choice]
-> 继续深入探索。 | 3
-> 回到岔路口。 | 0

[label] 2
[title] 多分支同页测试
[text] 你来到了同一个页面（2）。以下是当前属性：
[text] Strength={Strength}, Agility={Agility}, Wit={Wit}, Charm={Charm}
[text] 心情：{mood}
[choice]
-> 回到起点 | 0
-> 前往结局 | 100

[label] 3
[title] 森林深处的挑战
[text] 在森林的中心，你发现了一座被藤蔓覆盖的古老祭坛。
[choice]
-> 查看结局。 | 100

[label] 100
[title] 结局
[ending]
[text|if=Wit>=10]结局 -> 以智能取胜。
[text|if=Strength>=10]结局 -> 以力量取胜。
[text|if=Agility>=10]结局 -> 以敏捷取胜。
[text|else]结局 -> 你顺利地完成了这次的探险，虽然没有获得惊人的称号，但这段经历让你成长了不少。这是一次平凡而又充实的冒险。
[choice]
-> 重新开始一次新的冒险 | 0
-> 结束游戏 | END
```
