diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 16:16:40 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 16:16:40 +0800 |
| commit | 6c2f180cc7c8315e32d88cbe5d44928d495fe473 (patch) | |
| tree | b882d707e1ac1b31c885b19e1f2ce31534448c52 /src/LivingVillage.Kernel/Occupation.fs | |
| parent | 2f915a48837039dc772d7fa25b83b34a707922fd (diff) | |
| download | living-village-6c2f180cc7c8315e32d88cbe5d44928d495fe473.tar.gz | |
feat(kernel): P31 step1 occupation dialogue response bias
- Occupation.biasResponse: deterministic pure remap over Sim.responseFor;
no occupation = byte-identical pass-through (all intents x personalities).
farmer AskHelp Refused->Helpful; fisher SmallTalk Reserved->Friendly;
peddler SmallTalk Reserved->Bargaining; scholar Joke fully overridden to
Reserved (documented total-override semantics, opposite of personality).
- Sim.responseFor made public (same pure function, reused as the base path).
- Sim.chooseDialogueWith: extracted body of chooseDialogue with an injectable
respond function; chooseDialogue keeps identity semantics unchanged.
- Sim.appendAnnal made public for the upcoming story annal writes.
- 9 new kernel tests (92 -> 101); performance digest unchanged.
Diffstat (limited to 'src/LivingVillage.Kernel/Occupation.fs')
| -rw-r--r-- | src/LivingVillage.Kernel/Occupation.fs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/LivingVillage.Kernel/Occupation.fs b/src/LivingVillage.Kernel/Occupation.fs index 2168c4e..8ce5060 100644 --- a/src/LivingVillage.Kernel/Occupation.fs +++ b/src/LivingVillage.Kernel/Occupation.fs @@ -241,3 +241,34 @@ module Occupation = /// Sim.quotePrice 的输出经职业偏置映射;None(无报价)原样穿透。 let biasedQuote (kind: Kind option) (playerIsBuyer: bool) (baseQuote: float32 option) : float32 option = baseQuote |> Option.map (fun price -> price * quoteBiasOf kind playerIsBuyer) + + // ---- 对话分支倾向(design §5 / P-d):村民对玩家职业的确定性回应偏差 ---- + // 全部为纯函数重映射:基底仍走 Sim.responseFor 的人格口径,偏差不引入随机。 + // 无职业(None)= 原回应逐字节不变。 + // 规则(各自只作用于签名意图,其余意图原样穿透): + // 农夫 AskHelp:Refused → Helpful(老实人家,求助不落空); + // 渔夫 SmallTalk:Reserved → Friendly(聊的是天气鱼汛,冷场变热络); + // 货郎 SmallTalk:Reserved → Bargaining(三句不离买卖,更易进讨价还价); + // 书生 Joke:完全覆盖为 Reserved(读过书的人讲笑话,众人反而拘谨)—— + // 与 personality 相反时采用完全覆盖语义而非概率偏向,确定性可测(design §5 反差感)。 + let private remapResponse + (kind: Kind) + (intent: Sim.DialogueIntent) + (baseResponse: Sim.DialogueResponse) + : Sim.DialogueResponse = + match kind, intent, baseResponse with + | Farmer, Sim.AskHelp, Sim.Refused -> Sim.Helpful + | Fisher, Sim.SmallTalk, Sim.Reserved -> Sim.Friendly + | Peddler, Sim.SmallTalk, Sim.Reserved -> Sim.Bargaining + | Scholar, Sim.Joke, _ -> Sim.Reserved + | _ -> baseResponse + + let biasResponse + (kind: Kind option) + (intent: Sim.DialogueIntent) + (personality: Sim.Personality) + : Sim.DialogueResponse = + let baseResponse = Sim.responseFor intent personality + match kind with + | None -> baseResponse + | Some kind -> remapResponse kind intent baseResponse |
