3 KiB
3 KiB
| id | title | priority | status | scope | owner | updated_at | evidence | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| p2-58b | Ambient encounter hook — mc-turn::movement calls roll_ambient_encounter per tile step | p2 | done | game1 | unassigned | 2026-05-07 |
|
Summary
With TileState.fauna_density and TileState.fauna_index now populated (p2-58a),
the per-tile-moved hook in mc-turn::movement (or processor.rs movement phase)
can build AmbientTileCtx from the live GameState and call
mc_ecology::encounter::roll_ambient_encounter(...).
Also needed: the ecology pipeline must write fauna_density + fauna_index back
onto TileState after worldgen (currently pick_fauna_for_tile in
mc-ecology::fauna_select uses an ephemeral context; the result needs to persist
on the tile for mc-turn to consume at runtime).
Acceptance
- ✓
mc-ecologyfinalise pass not needed —fauna_densityandfauna_indexare already onTileStatefrom p2-58a (worldgen writes them directly). The hook reads them at runtime fromGameState::grid.tiles[tile_idx]. - ✓
mc-turn::processor.rsStep 1b buildsAmbientTileCtxfromTileState.fauna_density+.fauna_indexper unit per turn. - ✓ Calls
mc_core::encounter::roll_ambient_encounter(ctx, unit_kind, rates, &mut rng)and pushesTurnEvent::AmbientEncounterFiredtoresult.events_emitted. - ✓
cargo test -p mc-turn --test ambient_encounter_integration— 1/1 passing (50-step walk throughfauna_density=0.8tile yields ≥1 encounter, seeded deterministic). - ✓ GUT integration test:
test_p2_58b_ambient_encounter.gd— headless GUT test assertingstep()resultambient_encounter_count ≥ 1within 50 steps atfauna_density=0.8,ecosystem_tier=5. Additionally asserts barren tile (density=0.0) yields zero encounters.EventBus.ambient_encounter_firedsignal declared inevent_bus.gdfor live-game dispatch.turn_result_to_dictnow exposesambient_encounter_count+ambient_encounters[]fromresult.events_emitted.dict_to_tileextended to acceptfauna_density,ecosystem_tier,fauna_indexfor GDScript test setup. (cycle 39)
Out of scope
- Pioneer escort rules (p2-59).
- Lair siege/assault/raid (p3-10).
- Encounter narrative text / event cards — separate UI objective.