Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _engine.ink
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Generated by Inkwright from the game's notes. Do not edit; regenerate.
INCLUDE packs/narrative-check/rules.ink

LIST characters = xin, yanbo, zhiyong, yi
VAR character = xin
Expand Down Expand Up @@ -119,3 +120,6 @@ EXTERNAL roll_dice(formula, label)
// Without the engine the dice are flat: each table's average, 1 for anything else.
=== function roll_dice(formula, label) ===
~ return 1

// A choice tagged #use is taken with something carried, written into played first: { played == phone: … }.
VAR played = ()
19 changes: 2 additions & 17 deletions game.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
---
rules: { kind: sum, dice: [6, 6] }
languages: [zh, en]
difficulties: { trivial: 6, easy: 8, normal: 10, hard: 12, severe: 14, legendary: 16 }
skills:
- { id: reason, name: { zh: 理智, en: Reason }, voice: { stance: { zh: "这说得通,撑住。", en: "It adds up. Hold on." }, color: "#7a9cff" } }
- { id: stamina, name: { zh: 耐力, en: Stamina }, voice: { stance: { zh: 再坚持一下。, en: "Just a little longer." }, color: "#8fbf6a" } }
- { id: charm, name: { zh: 魅力, en: Charm }, voice: { stance: { zh: 这事能谈。, en: "We can talk about this." }, color: "#e6a23c" } }
- { id: insight, name: { zh: 洞察力, en: Insight }, voice: { stance: { zh: 注意到了吗。, en: "Did you notice?" }, color: "#b07cd8" } }
- { id: strength, name: { zh: 力量, en: Strength }, voice: { stance: { zh: 砸。, en: "Smash it." }, color: "#e26a6a" } }
system: { path: packs/narrative-check, version: 1 }
resources:
- { id: fear, name: { zh: 恐惧, en: Fear }, min: 0, max: 100, initial: 0 }
- { id: hp, name: { zh: 体力, en: Stamina }, min: 0, max: 10, initial: 10 }
- { id: battery, name: { zh: 电量, en: Battery }, min: 0, max: 100, initial: 80 }
- { id: dawn, name: { zh: 天亮前, en: Till dawn }, min: 0, max: 8, initial: 8 }
companionResources:
- { id: fear, name: { zh: 恐惧, en: Fear }, min: 0, max: 100, initial: 20 }
- { id: trust, name: { zh: 信任, en: Trust }, min: 0, max: 100, initial: 50 }
characters:
- { id: xin, name: { zh: 昕, en: Xin }, skills: { reason: 3, stamina: 3, charm: 5, insight: 4, strength: 2 }, companion: { fear: 30, trust: 60 }, items: [phone] }
- { id: yanbo, playable: false, name: { zh: 烟波, en: Yanbo }, skills: { reason: 5, stamina: 2, charm: 3, insight: 3, strength: 5 }, companion: { fear: 15, trust: 60 } }
Expand All @@ -32,13 +19,11 @@ items:
- { id: lighter, name: { zh: 打火机, en: Lighter }, desc: { zh: 厕所最里面那格地上捡的。, en: "Found on the floor of the last stall." } }
- { id: card, name: { zh: 阿泽的学生证, en: Aze's student card }, desc: { zh: "303 里的。能拿在手里的证据。", en: "From 303. Proof you can hold." } }
- { id: ledger, name: { zh: 登记本, en: Visitors' book }, desc: { zh: "值班室的。302 那行有个划掉的名字。", en: "From the office. A crossed-out name on the 302 line." } }
modifiers:
- { kind: perStep, resource: fear, step: 25, value: -1, skill: reason, label: fear }
---

# 302

宿舍恐怖冒险的规则配置。上面的属性就是 Inkwright 游戏模式读取的 `GameConfig`,改过之后运行命令"生成游戏引擎 ink"重新生成 `_engine.ink`。
宿舍恐怖冒险的规则配置。上面的属性就是 Inkwright 游戏模式读取的 `GameConfig`;规则、难度、五种技能和它们的声音、恐惧和体力、同伴的恐惧和信任、恐惧修正都来自规则包 `packs/narrative-check`(Inkwright 叙事检定包的一份副本,`system:` 指向它),这里只写这个游戏自己的东西。改过之后运行命令"生成游戏引擎 ink"重新生成 `_engine.ink`。

- id 全部英文(ink 变量名、选项标签里用);玩家看到的名字在 `name: { zh, en }` 里。
- 资源:恐惧是心理血条,体力是身体血条,电量是手机的光,“天亮前”是还剩几个小时(每去一个地方减一,归零天亮)。
Expand Down
9 changes: 1 addition & 8 deletions main.ink
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ VAR shone = 0 // things the torch was pointed at

// --- helpers -------------------------------------------------------------

=== function clamp(x, lo, hi) ===
{ x < lo:
~ return lo
}
{ x > hi:
~ return hi
}
~ return x
// clamp(x, lo, hi) comes from the rule pack (packs/narrative-check/rules.ink).

// Frighten a companion (negative d calms him).
=== function scare(c, d) ===
Expand Down
14 changes: 14 additions & 0 deletions packs/narrative-check/rules.ink
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Narrative check rules, pack version 1.0 (Inkwright). A game INCLUDEs this through its generated _engine.ink.
// Checks are tags on choices (* [Force the door #check:strength:hard]) read back with check(skill, n): a band 0..4,
// 3 or more is a success. Inner voices are #voice:<skill> lines. The engine rolls 2d6 + skill against the difficulty;
// every 25 fear takes 1 off reason. This file only adds the helpers stories share.

// x kept within lo..hi.
=== function clamp(x, lo, hi) ===
{ x < lo:
~ return lo
}
{ x > hi:
~ return hi
}
~ return x
27 changes: 27 additions & 0 deletions packs/narrative-check/system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
version: "1.0"
pack:
name: { zh: 叙事检定, en: Narrative checks }
description: { zh: "2d6 + 技能对难度的检定,五种技能各是一个内心的声音,恐惧和体力两条血条,同伴的恐惧和信任", en: "2d6 + skill against a difficulty, five skills that are inner voices, fear and stamina, companions' fear and trust" }
rules: { kind: sum, dice: [6, 6] }
languages: [zh, en]
difficulties: { trivial: 6, easy: 8, normal: 10, hard: 12, severe: 14, legendary: 16 }
skills:
- { id: reason, name: { zh: 理智, en: Reason }, voice: { stance: { zh: "这说得通,撑住。", en: "It adds up. Hold on." }, color: "#7a9cff" } }
- { id: stamina, name: { zh: 耐力, en: Stamina }, voice: { stance: { zh: 再坚持一下。, en: "Just a little longer." }, color: "#8fbf6a" } }
- { id: charm, name: { zh: 魅力, en: Charm }, voice: { stance: { zh: 这事能谈。, en: "We can talk about this." }, color: "#e6a23c" } }
- { id: insight, name: { zh: 洞察力, en: Insight }, voice: { stance: { zh: 注意到了吗。, en: "Did you notice?" }, color: "#b07cd8" } }
- { id: strength, name: { zh: 力量, en: Strength }, voice: { stance: { zh: 砸。, en: "Smash it." }, color: "#e26a6a" } }
resources:
- { id: fear, name: { zh: 恐惧, en: Fear }, min: 0, max: 100, initial: 0 }
- { id: hp, name: { zh: 体力, en: Stamina }, min: 0, max: 10, initial: 10 }
companionResources:
- { id: fear, name: { zh: 恐惧, en: Fear }, min: 0, max: 100, initial: 20 }
- { id: trust, name: { zh: 信任, en: Trust }, min: 0, max: 100, initial: 50 }
modifiers:
- { kind: perStep, resource: fear, step: 25, value: -1, skill: reason, label: fear }
---

# 叙事检定(Narrative checks)规则包 1.0

从宿舍恐怖游戏《302》的规则整理出来的第一方规则系统包。见 `说明.md`。
63 changes: 63 additions & 0 deletions packs/narrative-check/说明.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 叙事检定规则包(narrative-check 1.0)

Inkwright 的第一方规则系统包,从宿舍恐怖游戏《302》的规则里整理出来。适合以剧情为主的游戏:没有战斗流程,只有选项上的检定、技能变成的内心声音、两条血条和同伴关系。

## 用法

在游戏笔记(`game.md`)里写包的路径,再写自己的角色:

```yaml
system: { path: <到这个文件夹的相对路径>, version: 1 }
characters:
- { id: me, name: { zh: 我, en: Me }, skills: { reason: 3, stamina: 3, charm: 3, insight: 4, strength: 2 } }
- { id: lin, playable: false, name: { zh: 林, en: Lin }, skills: { reason: 4, stamina: 2, charm: 3, insight: 3, strength: 2 }, companion: { fear: 30, trust: 50 } }
```

故事里:

```ink
INCLUDE _engine.ink
* [贴着门听 #check:insight:normal]
{ check("insight", 10) >= 3:
听清了。
- else:
什么也没听清。
~ fear += 30
}
别出声。 #voice:reason
~ trust_lin = clamp(trust_lin + 10, 0, 100)
```

运行「生成游戏引擎 ink」后,生成的 `_engine.ink` 会 INCLUDE 这里的 `rules.ink`。`template/` 是一个能直接玩的例子(半夜的敲门声),「新建游戏」就是复制它。

## 包里有什么

- `system.md`:
- 规则:2d6 + 技能 ≥ 难度。难度有六档:trivial 6、easy 8、normal 10、hard 12、severe 14、legendary 16。
- 五种技能,每种都有自己的声音和颜色:理智、耐力、魅力、洞察力、力量。
- 两种资源:恐惧 0–100、体力 0–10。
- 同伴的两种资源:恐惧(默认 20)、信任(默认 50)。每个同伴都有自己的一份,比如 `fear_lin`、`trust_lin`。
- 一条修正:恐惧每满 25,理智检定 −1。
- `rules.ink`:`clamp(x, lo, hi)`,把一个数限制在区间里。改同伴的恐惧和信任时用得上,因为引擎只在一步结束后才把资源拉回范围。

## 规则

- **检定**:选项上写 `#check:<技能>:<难度>`,玩家在按钮上就能看到成功率。故事里用 `check("技能", 数字)` 读结果,得到 0–4 档,3 及以上算成功。失败也必须改变点什么,比如一个变量或者之后能选的选项;`check-ink --all` 会对什么都没改变的失败给出警告。
- **声音**:一行字带 `#voice:<技能>`,就会以那个技能的口吻、颜色显示。
- **恐惧**:心理的血条。恐惧越高,理智越差。
- **体力**:身体的血条。
- **同伴**:`playable: false` 的角色不能选来玩,但有自己的恐惧和信任。

## 改它

在游戏笔记里写一个同 id 的条目,就会替换包里的那一条。比如:

- 换一个技能的声音:写同 id 的 `skills:` 条目。
- 加一种资源:写在 `resources:` 里,比如《302》的电量和"天亮前"。
- 不要恐惧修正:写 `modifiers: []`。

包的 `system.md` 不用动。

## 谁在用

《302》(dorm-302):它的 `game.md` 只写自己的电量、天亮前、角色和物品,其余都来自这个包的一份副本。换成这个包以后,`check-ink --all` 两种语言的结果和换之前一样。
Loading