summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/WorldBootstrap.fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LivingVillage.Desktop/WorldBootstrap.fs')
-rw-r--r--src/LivingVillage.Desktop/WorldBootstrap.fs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/WorldBootstrap.fs b/src/LivingVillage.Desktop/WorldBootstrap.fs
index 0e8ea30..f8ba775 100644
--- a/src/LivingVillage.Desktop/WorldBootstrap.fs
+++ b/src/LivingVillage.Desktop/WorldBootstrap.fs
@@ -18,6 +18,23 @@ module WorldBootstrap =
let private daylightStartTick = 6L * Sim.ticksPerDay / 24L
+ /// 新档职业状态:按世界 seed 与职业种子生成 nowTick 所属日的 Offered 任务(design §3)。
+ let occupationStateFor (seed: uint64) (kind: Occupation.Kind) (nowTick: int64) : Occupation.State =
+ let baseState = Occupation.stateOf kind
+ { baseState with
+ Today = Occupation.dailyTaskOf seed (Occupation.occupationSeedOf kind) (Occupation.dayIndexOf nowTick) kind }
+
+ /// 跨日刷新当日任务;同日(含 Done/Failed 终态)原样保留。
+ let refreshOccupationToday (seed: uint64) (state: Occupation.State) (nowTick: int64) : Occupation.State =
+ { state with
+ Today =
+ Occupation.refreshToday
+ seed
+ (Occupation.occupationSeedOf state.Profile.Kind)
+ state.Profile.Kind
+ nowTick
+ state.Today }
+
let initialWorldWithOccupation (startAtDaylight: bool) (seed: uint64) (count: int) (occupation: Occupation.State option) : World =
if count < 0 || count > npcSpawnTiles.Length then
invalidArg (nameof count) "Desktop bootstrap supports at most 30 NPCs."