Phase:P0 — Character Core + SRD / Rules Foundation
本文件只定義 P0 各 Subphase 完成後什麼必須成立。具體 DB schema、API、檔案結構與程式接線放在同目錄的開發設計方針.md。
最後更新:2026-08-29
P0 要建立 Adventure Table 後續角色與規則功能共用的第一層地基:
P0 不是完整創角器,也不是多人跑團功能。
P0 固定拆成六個可獨立實作、驗證與 commit 的 Subphases:
P0-A — Project Foundation
↓
P0-B — Character-Relevant SRD Foundation
↓
P0-C — Character Core & Persistence
↓
P0-D — Character Rules & Backend API
↓
P0-E — Character Sheet & State UI
↓
P0-F — Full P0 Integration & Closeout
不得跳過前置 Subphase 直接做後面的功能;每個 Subphase 完成時都必須先達到該節的完成條件,再進下一個。
P0-F 關門時,應能做到以下完整流程:
啟動專案
↓
載入並驗證 Character-Relevant SRD 5.1 reference data
↓
載入一名已存在的 Character
↓
Server 計算 Character Sheet 所需衍生數值
↓
Web UI 以三頁 Character Sheet 顯示
↓
修改 Current State(例如 HP / Prepared Spells / Spell Slot 使用狀態 / Condition / Inventory)
↓
保存
↓
重新啟動/重新載入
↓
Character Build 不變,Current State 保持最後保存結果
同時,P0 必須能承載一名合法的高等 Multiclass 角色資料,例如:
Human Fighter 5 / Wizard 5,Character Level 10。
這不代表 P0 要從 UI 一級一級建立這名角色;完整 Builder 與 progression validation 屬 P1。
建立後續 P0 能持續實作與驗證的最小可執行 Web 專案地基。
P0-A 完成時至少必須成立:
P0-A 不建立 Character、Combat、Room、Adventure、AI Runtime 等功能。
建立正式可用的 SRD content framework,並只導入 P0 / P1 角色系統真正需要的 SRD 5.1 structured reference content。
至少涵蓋:
要求:
例如:Fireball 的 spell definition 可在 P0 存在;Tactical AoE 是 P5。
P0-B 不導入:
這不是遺漏,而是刻意的 scope cut。P0~P3 沒有需要完整怪物戰鬥資料的驗收;以上資料明確延後到:
P4-A — Quick Combat 的第一個 Subphase
P4-A 開工時再依當時 Combat 需求設計具體 Monster Template schema / API;P0 不提前設計。
建立 Character 的正式資料模型與 persistence,使複雜角色可以在沒有 Builder、Rules UI、Room 或 Combat 的情況下可靠保存與讀回。
Character 至少要能表示:
P0 不要求完整檢查「玩家是否依合法創角流程選到這些資料」,但資料本身必須可被 schema / reference validation 正確讀取。
P0 必須分開:
Character Version 就是不可變的 Build Version,不包含 live Current State。
舊 Build Version 一旦建立不可原地修改。P0 只需要正式支援 version 1 與目前版本指標;Level Up Draft / Validate / Confirm 與 Version History UI 屬 P1。
Build 包含:
Current State 包含:
Prepared Spells 是可反覆變動的選擇,不得因為重新準備法術就建立新的 Build Version。
Inventory 的目前內容也不屬於 Build。角色撿到、丟掉、使用、裝備或卸下 Item,都只改 Current State;Build 中的 Starting Equipment 只用來產生角色最初的 Inventory,不是之後持續重算 Inventory 的來源。
Ability Scores 表示角色永久 Build 選擇全部解析後、但尚未套用 Numeric Override 的 Build Score。
Human racial increase、ASI、Feat 等永久 Build 效果若已屬於該 Build,必須已反映在保存的 Ability Score 中;之後 Rules Engine 不得再因 race reference 重複套同一加成。
Build 的 spell access 與 Current State Prepared selection 必須分開。
Build access 至少能區分:
Prepared 不得作為 Build access type。
Wizard Spellbook 屬 Build;Wizard 目前準備哪些法術屬 Current State。
Build 必須保留每個 Character Level 實際採用的 base HP gain,順序能與 class progression 對齊。
P0 fixture 使用 fixed value 只是測試基準,不代表全產品永遠只支援 fixed HP;P1 若支援 rolled HP,只需保存該級實際採用的 base HP gain。
P0-C 必須支援:
P0-C 建立固定驗證角色:
Human Fighter 5 / Wizard 5,Character Level 10
至少包含:
10, 6, 6, 6, 6, 4, 4, 4, 4, 4。標準 fixture 保持無 Numeric Override。
在 P0-C 的正式 Character model 上建立 Server authoritative rules calculation、CharacterSheetDTO 與 P0 所需 backend API。
Server 規則層至少提供:
規則計算至少遵守:
Build Ability Score
↓
Apply Ability Numeric Override(若有)
↓
Effective Ability Score
↓
Ability / Skill / Save / Spell / HP calculation
↓
Apply remaining Numeric Overrides
↓
CharacterSheetDTO
hp_progression + effective CON modifier,再套 Max HP override。P0 至少提供:
State mutation 至少能承載:
P0 不提供 production Character Builder workflow;fixture 可由 developer seed command 建立。
由標準 fixture 建立固定 test variant:
ability:strength = 18
ac = 19
max_hp = 80
至少預期:
Fighter(非 Eldritch Knight)5 / Wizard 5 的 spell slot progression 等同 Wizard 5,不會觸發多個 caster class 的 caster-level aggregation。
因此 P0 fixture 只證明:
完整 multiclass caster-level / combined spell-slot progression validation 屬 P1。
標準 fixture 至少算出:
| 項目 | 預期 |
|---|---|
| Total Character Level | 10 |
| Fighter Level | 5 |
| Wizard Level | 5 |
| Proficiency Bonus | +4 |
| STR Save | +7 |
| CON Save | +6 |
| Athletics | +7 |
| Arcana | +7 |
| Perception | +4 |
| Passive Perception | 14 |
| AC(Chain Mail + Shield) | 18 |
| Wizard Spell Save DC | 15 |
| Wizard Spell Attack | +7 |
| Max HP | 74 |
另外:
讓使用者在瀏覽器中真正查看已存在角色,並操作 P0 需要的 Current State;P0-E 不是 Character Builder。
Character Sheet 第一版固定三頁。
至少顯示:
Roleplay / Biography 可包含:Alignment、Personality、Ideal、Bond、Flaw、Biography、Goals、Relationships、Roleplay Guidance;全部 optional,不得因空白阻止角色存在或顯示。
至少顯示:
P0 的重點是正確表示與顯示;完整合法選法與升級流程屬 P1。
至少顯示 Current State 中的:
Inventory 必須能在不修改 Build 的情況下新增、移除與改變 live state。
P0-E 至少要能從 UI 操作或完成對應 persistence 流程:
Prepared Spells 的 model、API persistence 與 Sheet display 必須正確;P0 不要求完整 Prepare-Spells Wizard。
P0 也不要求完整 Short Rest Spend-Hit-Die workflow。
Frontend 不自行重算正式 D&D derived state。
Mutation flow 必須是:
UI action
↓
Server validate + persist
↓
Server 回傳/重新取得 authoritative state
↓
UI 更新
不得依賴只存在 browser memory 的正式角色狀態。
/characters/:characterId 可直接開啟 P0 fixture。d10 5/5 與 d6 5/5。P0-F 不新增新的大型產品功能;它負責把 P0-A~P0-E 串成可重現、可回歸、可人工操作的完整 P0,並證明以下 Acceptance Contracts 全部成立。
啟動時所有 P0 定義的 character-relevant SRD 5.1 類別可被載入;schema / required reference 錯誤必須明確失敗,不得靜默略過。
Monster / Beast 不屬於 AC-P0-01,已延後 P4-A。
後端可依穩定 key 取得指定 Race / Class / Spell / Equipment / Condition 等 P0 reference entry。
建立/載入一名 P0 fixture Character,保存後重新讀取,Build 與 Current State 資料一致。
修改 Current HP、Temporary HP、Prepared Spells、Condition、Spell Slot 使用狀態、Available Hit Dice,或對 live Inventory 新增/移除/改 quantity/改 equipped 狀態時,不會改變 Race / Class / Ability / Feature / Spell access / Spellbook / Starting Equipment 等 Build 資料,也不會產生新的 Build Version。
標準 fixture 的 Ability Modifier、Proficiency Bonus、Skill、Save、Passive Perception、AC、Spell Save DC / Spell Attack、Max HP 等結果符合 D&D 5e 2014 規則;另以固定 Numeric Override variant 驗證 override 後的 authoritative derived result。
Web UI 能顯示固定 Header 與三頁:Attributes / Skills、Spells、Inventory;Page 1 能依骰型顯示 Hit Dice Available / Total;optional Roleplay 空白時仍可正常使用。
修改 HP / Prepared Spells / resource / Hit Dice / condition / inventory 後重新載入頁面與重啟 server,狀態保持一致,Build Version 不變。
系統可載入並正確顯示一名 Human Fighter 5 / Wizard 5(Character Level 10)fixture;能分辨 total level、各 class level、class order、不同來源的 features / spells,以及 5d10 + 5d6 的 Hit Dice 結構。
本契約不代表 P0 已驗證 multiclass caster-level / combined spell-slot progression。
Character Sheet 使用 Server 回傳的 authoritative Character Sheet / derived data;重新整理後結果一致,不依賴只存在 browser memory 的正式角色狀態。
P0 可以在沒有 Room、Campaign、Session、AI、Combat、Adventure 的情況下獨立啟動與驗收。
只有以下全部成立才可進 P1:
P0 收尾後,再以實際完成的 codebase 為基礎規劃 P1 與 P1-A~P1-x。
P0 不可以採用會立即阻止以下能力的表示方式:
這些只要求相容,不要求 P0 提前做完整 P1 Builder。
以下不在 P0 實作:
若 P0 實作為了這些後續功能加入大量提前設計,視為 scope creep。