diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-29 00:24:08 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-29 00:24:08 +0800 |
| commit | a59a4bbe1ab45adb29d1367995230d3f09847d9b (patch) | |
| tree | 9570b3c7168a6252920138e380e2a9d9cb6f9acf /src/LivingVillage.Desktop/Game.fs | |
| parent | 80c99bc9251e4ca6304761ef9bd88f2724642278 (diff) | |
| download | living-village-a59a4bbe1ab45adb29d1367995230d3f09847d9b.tar.gz | |
p55: 当日任务经济闭环——设计口径物品报酬入账(夜捕鱼×2/送粮食物×1, 其余不发) + 连续完成天数(streak 跨日保留/漏完成清零) + v3 streak 尾段与 save(None) 兼容 + LV_P55_SHOT 证据
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/Game.fs | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 284c246..8162351 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -373,6 +373,13 @@ type LivingVillageGame() as this = let mutable p54Step = 0 let mutable p54PendingName = "" let mutable p54Pending = false + // P55 证据钩子:LV_P55_SHOT=1 时以农夫真实开局,跳到第 3 日(当日任务=送粮), + // 走「面板(待接受) → 接受 → 真实卖出 Food(送粮完成,设计口径 +食物×1)→ 面板(已完成)」, + // 打印 streak/背包/反馈,供 analyze 脚本核验报酬入账与连续天数。 + let p55ShotMode = Environment.GetEnvironmentVariable("LV_P55_SHOT") = "1" + let mutable p55Step = 0 + let mutable p55PendingName = "" + let mutable p55Pending = false let mutable autoplayFrames = 0 let mutable flowStep = 0 let mutable flowHold = 0 @@ -1307,6 +1314,77 @@ type LivingVillageGame() as this = p54PendingName taskText (M5Interaction.panelName m5View) m5View.Status bag p54Step <- p54Step + 1 + /// P55 证据:跳到第 3 日(送粮)→ 面板(待接受) → 接受 → 真实卖出 Food(完成 +食物×1)。 + member private this.PrepareP55Shot () = + let setDay3Noon () = + let tick = 3L * Sim.ticksPerDay + M6Presentation.resolveStartTick (Some 12.0) false + world <- { world with Tick = tick; Time = float tick * Sim.dtSeconds } + let ask (command: M5Command) = + let nextWorld, nextView = M5Interaction.apply command world m5View + world <- nextWorld + m5View <- nextView + if not p55Pending then + match p55Step with + | 0 -> + setDay3Noon () + // 用真实跨日刷新把当日任务推进到第 3 日(seed 42/农夫 = 送粮)。 + match m5View.Task with + | Some state -> m5View <- { m5View with Task = Some(WorldBootstrap.refreshOccupationToday 42UL state world.Tick) } + | None -> () + let npc = world.Npcs.[0] + world <- { world with Avatar = { world.Avatar with Pos = npc.Pos } } + ask M5Command.ShowTaskPanel + this.CenterCamera() + p55PendingName <- "p55-task-offered" + p55Pending <- true + | 1 -> + ask M5Command.AcceptTask + p55PendingName <- "p55-task-active" + p55Pending <- true + | 2 -> + ask M5Command.ClosePanel + ask M5Command.Interact + ask M5Command.SellToTarget + p55PendingName <- "p55-reward" + p55Pending <- true + | 3 -> + ask M5Command.ShowTaskPanel + p55PendingName <- "p55-task-done" + p55Pending <- true + | _ -> + printfn "p55-shot=done" + this.Exit() + + /// P55 证据:落盘并打印模板/状态/streak/背包/反馈。 + member private this.CaptureP55Shot () = + if p55Pending then + p55Pending <- false + System.IO.Directory.CreateDirectory recordDirectory |> ignore + this.SaveBackBuffer(sprintf "%s/%s.png" recordDirectory p55PendingName) + let stateText (state: Occupation.TaskState) = + match state with + | Occupation.Offered -> "offered" + | Occupation.Active -> "active" + | Occupation.Done -> "done" + | Occupation.Failed -> "failed" + let templateText, taskState, streak = + match m5View.Task with + | None -> "none", "none", 0 + | Some state -> + (match state.Today with + | Some task -> Occupation.taskNameOf task.TemplateId, stateText task.State, state.Streak + | None -> "none", "none", state.Streak) + let bag = + match m5View.Task with + | None -> "-" + | Some state -> + state.Backpack + |> List.map (fun (item, quantity) -> sprintf "%A=%d" item quantity) + |> String.concat ";" + printfn "p55-shot=%s template=%s state=%s streak=%d panel=%s status=%s bag=[%s]" + p55PendingName templateText taskState streak (M5Interaction.panelName m5View) m5View.Status bag + p55Step <- p55Step + 1 + /// P53 证据:真实录制提示出现/消失序列(远处 → 靠近 → 互动 → 关闭+离开)。 member private this.PrepareP53Recording () = let setHour (hour: float) = @@ -1844,6 +1922,16 @@ type LivingVillageGame() as this = else this.DispatchMenuInput Confirm elif menu.Page = Playing then this.PrepareP54Shot() + elif p55ShotMode then + if menu.Page = MainMenu then + this.DispatchMenuInput Confirm + elif menu.Page = OccupationSelect then + let targetIndex = + MenuState.occupationOptions |> List.findIndex (fun option -> option = Some Occupation.Farmer) + if menu.Selected <> targetIndex then this.DispatchMenuInput Down + else this.DispatchMenuInput Confirm + elif menu.Page = Playing then + this.PrepareP55Shot() elif menu.Page = Playing then this.UpdatePlaying gameTime kb pressed pressedAny elif menuShotMode then @@ -2263,6 +2351,8 @@ type LivingVillageGame() as this = this.CaptureP53Recording() if p54ShotMode && menu.Page = Playing then this.CaptureP54Shot() + if p55ShotMode && menu.Page = Playing then + this.CaptureP55Shot() /// 启动画面:分层天色 + 屋脊/水面剪影 + 标题淡入上浮 + 跳过提示,全部为帧计数纯函数。 member private this.DrawSplash() = |
