Exact source used by this build. SHA-256: 3acb8457acfa75c40b113c73ee5ea4f121d931d9c6d1766ee87a87065bbabdec.

1 # Mines and combat implementation report
2 
3 Implemented generated, shared mine visits through floor 120 with the requested
4 40-floor MVP content designation. The generator uses the captured world seed,
5 floor number and calendar day. Three bands, connected rooms, rocks, ore, gems,
6 three geode types, monsters, mushroom/infested floors, ten-floor treasure and
7 five-floor shared elevator progress are content-driven.
8 
9 Players on the same floor share its area state. Different floors are separate
10 areas. Only occupied floors simulate; the last departing visitor retires the
11 floor and its temporary inventory objects. A disconnected visitor returns to
12 the configured mountain entrance. Treasure rewards remain claimed across
13 regenerated visits. XP belongs to the player who completes the mining action
14 or kills the monster.
15 
16 Combat includes directional attacks, crits, defense, knockback, recovery times,
17 sword block, dagger flurry, club slam, five monster behaviors, projectiles,
18 invulnerability, combat-level health and equipment. Rings implement glow,
19 magnet pickup, defense, attack, movement speed and healing on kills. Knockout
20 returns the player home with seeded gold/item loss; lost tools return the next
21 morning. The existing 2 AM pipeline supplies its separate penalty once.
22 Blacksmith geode cracking consumes one geode and the configured price atomically.
23 
24 The client adds health beside energy, generated floor rendering, manifest-keyed
25 shape placeholders, attack arcs, damage numbers, touch combat controls,
26 elevator/equipment screens and contextual mining/gathering/chest/ladder actions.
27 
28 ## Validation
29 
30 Final commands and results:
31 
32 ```text
33 $ bun run check
34 161 pass
35 0 fail
36 4027 expect() calls
37 Ran 161 tests across 32 files. [45.94s]
38 Validated 13 content domains: 12 crops, 101 items, and 8 Tiled areas.
39 
40 $ bun run --cwd apps/client build
41 218 modules transformed
42 built in 324ms
43 JavaScript 1,800.89 kB / gzip 443.64 kB
44 
45 $ bun test apps/server/test/mines-loop.test.ts
46 3 pass
47 0 fail
48 50 expect() calls
49 Ran 3 tests across 1 file. [202.00ms]
50 
51 $ git diff --check
52 (no errors)
53 ```
54 
55 The two-client tests use actual TCP WebSockets, production FarmWorld dispatch,
56 authentication, journaling and checkpoints with in-memory SQLite. Only the
57 Cloudflare socket/storage adapters and time source are substituted. Equipment,
58 balances and a separate floor-4 scenario are pre-join fixtures; all subsequent
59 gameplay uses server intents or alarms. Tests prove both players gain combat
60 XP, see the same ladder, descend together, incur the exact knockout wallet
61 deduction in shared and separate modes, and share/persist a new floor-5 unlock.
62 The general workerd transport tests also pass in the full check.
63 
64 Unit tests cover all 120 generated floors, daily changes and room connectivity,
65 all node/tier hit tables, shared/scoped state, treasure duplication prevention,
66 cooldowns, behavior families, equipment transactions, ring effects, knockout
67 caps, tool returns, and 2 AM charging without combat loss or double penalties.
68 
69 ## Files changed
70 
71 ```text
72 apps/
73   client/
74     public/assets/CREDITS.md
75     src/core/registry.test.ts
76     src/systems/index.ts
77     src/systems/movement/index.ts
78     src/systems/shops/index.ts
79     src/systems/mines/{index,model,rendering,style}.ts
80     test/mines-ui.test.ts
81   server/
82     src/index.ts
83     test/mines-loop.test.ts
84 packages/
85   content/
86     data/items/mines.json
87     data/mines/mines.json
88     src/domains/index.ts
89     src/domains/mines/{index,schema}.ts
90     test/domains.test.ts
91     test/mines-content.test.ts
92   sim/
93     src/clock.ts
94     src/systems/index.ts
95     src/systems/registry.ts
96     src/systems/inventory/index.ts
97     src/systems/movement/index.ts
98     src/systems/shops/index.ts
99     src/systems/mines/{index,model,generator,combat,geodes}.ts
100     src/systems/mines/IMPLEMENTATION.md
101     test/mines-{system,geodes,timing}.test.ts
102 ```
103 
104 ## Shared changes
105 
106 - The three system/domain registration files add mines; the simulation list
107   also exports the generic update-cadence selector.
108 - `sim/src/systems/registry.ts` and `sim/src/clock.ts` add `onElapsedTime` and an
109   optional system update interval. Combat needs elapsed time between the
110   existing seven/nine-second calendar ticks. Intervals are split at day/tick
111   boundaries without charging time twice.
112 - `server/src/index.ts` uses that generic cadence when scheduling alarms. No
113   mine-specific handler, protocol branch or scene coordinator was added.
114 - The inventory system exposes area cleanup and an optional pickup-radius
115   bonus. Mines use these helpers rather than mutating inventory-owned slices.
116 - Simulation movement reads the equipment speed hook, including its elapsed
117   budget charge; client movement uses the same speed calculation for prediction.
118 - The existing shops `crackGeode` stub delegates to the mines transaction and
119   accepts an optional inventory slot. Its client button now exposes the service.
120 - Two existing registry expectation tests include the new registration, and
121   the asset credits identify the new procedural graphics as CC0.
122 
123 ## Content slots and limits
124 
125 Creative names/descriptions remain `TBD`: `weapon_01`–`weapon_15`,
126 `monster_01`–`monster_12`, `ring_01`–`ring_06`, `boots_01`–`boots_03`,
127 `mineral_01`–`mineral_14`, mine forage, nodes and generated areas. Visuals have
128 manifest keys. There are three geode types; existing plain material item IDs
129 are reused. No dialogue, lore, copied assets or new runtime dependencies were added.
130 
131 All 120 floors are playable using the MVP catalog; the 40-floor designation is
132 content metadata, not a travel cap. Monster behaviors and procedural shapes
133 are the requested MVP implementations, not copied enemy/art implementations.
134 Entrance config is `mountain` / `mine-entrance`; a matching runtime warp supplies
135 its position, while the current map marker uses the configured fallback coordinates.
136 
137 Phone screenshots could not be verified: local Chrome aborted under the macOS
138 sandbox when launched by Playwright. Controls have 44 px minimum touch sizes and
139 portrait/short-landscape CSS, and client tests/build pass. Vite retains its
140 large-bundle warning because the application includes Phaser.
141 
142 Changes remain uncommitted under the project instruction not to commit without
143 an explicit request; no Git write was attempted. Nothing was deployed, pushed,
144 authenticated or history-rewritten. The initially clean worktree now contains
145 only the listed task changes. Existing ignored dependencies occupy approximately
146 520 MB and remain necessary for validation; local Worker state/cache is 28 MB,
147 client build output 1.7 MB, generated catalogs 24 KB and ignored runs 2 MB.
148 No unknown files were deleted. Available storage remained about 381 GiB.
149 
150 Numerical references were checked without copying creative content:
151 [Mining](https://wiki.stardewvalley.net/Mining),
152 [Pickaxes](https://wiki.stardewvalley.net/Pickaxes),
153 [Combat](https://wiki.stardewvalley.net/Combat),
154 [Mines](https://wiki.stardewvalley.net/The_Mines),
155 [Weapons](https://wiki.stardewvalley.net/Weapons), and
156 [Health](https://stardewvalleywiki.com/Health). The health reference confirms
157 the 1.6 cap of three lost inventory stacks, used here.
158