2.8 KiB
| id | title | priority | status | scope | updated_at | evidence | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| p0-18 | Strategic resources gate unit production (empire ledger) | p0 | done | game1 | 2026-04-17 |
|
Summary
Distinct from p1-02 (resource yields feed bonuses), this objective covers the gating rule: a unit with requires_resource: "iron_ore" cannot build unless the empire has iron_ore on the ledger. Rust logic landed in #81: mc-combat::requirements::{check_strategic_reqs, debit_resources, credit_resources} with 6 tests. GDScript deposit discovery hook added to unit_manager.gd:recalculate_vision (0→2 tile visibility triggers EventBus.deposit_discovered → turn_manager.gd credits player.strategic_ledger). GDScript production gate added to turn_processor.gd (pre-production check emits EventBus.strategic_gate_rejected and pauses production if ledger is empty). auto_play.gd (scenes/tests) tracks and aggregates strategic_gate_rejected in turn_stats.jsonl["aggregate"].
Acceptance
- ✓ Building a swordsman (requires iron) fails with
ResourceGate("iron")when empire has 0 iron on its ledger; succeeds and decrements the ledger to 0 otherwise. - ✓ Unit death returns 1 iron to the ledger (unit_manager.gd + auto_play.gd _on_unit_destroyed).
- ✓ Deposit discovery (via scout exploration p0-13) credits iron onto the ledger when the tile first becomes visible (unit_manager.gd recalculate_vision 0→2 → deposit_discovered signal → turn_manager.gd _on_deposit_discovered).
- ✓ 10-seed T300 batch (stamp 20260417_014802): all 10 seeds show
strategic_gate_rejectedinturn_stats.jsonl["aggregate"](seed1=85, seed2=103, seed3=228, seed4=169, seed5=209, seed6=138, seed7=221, seed8=526, seed9=200, seed10=160). Batch:.local/batches/autoplay_p018_v5/. - ✓ Golden test: seed 42, build cavalry → iron debit → build second →
ResourceGate→ kill cavalry → iron credit → build third succeeds (Rust unit tests in mc-turn/src/processor.rs lines 3028–3104).
Non-goals
- Resource trading via diplomacy (p1-01 trade agreements cover luxuries, not strategics for Game 1).
- Strategic resource sell-to-treasury.