# Task D4 — Economy, Shops, and Safe Rest ## Scope Implemented D4 only: - Deterministic floor-three-and-later colony sizing with colony price modifiers. - Merchant shop stock, purchase, sale, keyboard navigation, transaction journal events, and gold HUD display. - Safe-room rest payment from floor three onward, including refusal on insufficient gold and full HP/focus restoration on successful rest. - Unit and end-to-end coverage for economy calculations and live shop/rest flows. No D5 functionality or unrelated systems were changed. ## Verification and fixes Initial `./scripts/verify.sh` run found one unit failure: `test_hud_uses_viewport_anchored_panels_with_distinct_stats_and_log_zones`. The added gold line had moved `EnemyHealthLabel` below `StatsPanel`. Expanded the existing stats panel to contain its label stack. The next full verification exposed a D4 E2E test setup issue: an untyped empty array could not be passed to `GameHud.refresh(..., events: Array[GameEvent], ...)`. The test now provides a typed empty `Array[GameEvent]`. Final verification succeeded: ```text ./scripts/verify.sh - Unit: 135 / 135 tests, 1,042 assertions - Integration: 7 / 7 tests, 9,255 assertions - E2E: 35 / 35 tests, 361 assertions - Visual: passed (normal and exit captures) ``` The Godot/GUT third-party UID/resource-cleanup warnings remain non-failing pre-existing runner noise; no script or parse errors occurred in the final run.