6.5 KiB
6.5 KiB
| id | title | priority | status | scope | owner | updated_at | evidence | blocked_by | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| p3-11 | Pioneer & Engineer action-point pool | p3 | done | game1 | shipwright | 2026-05-13 |
|
Context
public/games/age-of-dwarves/docs/units/SPECIALISTS.md proposes an action-point pool for Pioneer and Engineer instead of a single per-turn action. Tier-scaled capacity — 6 (T1), 10 (T2), 14 (T3) — drives:
- Pioneer: Found City consumes the entire pool; Prepare Land 2 AP each.
- Engineer: build/repair improvements 1–4 AP depending on improvement.
- Both recharge by entering a friendly city (full refill on a turn ended in-city); idle outside city does not recharge.
This replaces the current binary "did the worker act this turn" model.
Acceptance
- ✓
mc-core::ActionPoints { current: u8, capacity: u8 }newtype insrc/simulator/crates/mc-core/src/units.rs—src/simulator/crates/mc-core/src/units.rs:48-119. CompanionActionCost(u8)newtype atunits.rs:18-44and tier-ladder helperpioneer_engineer_ap_capacityatunits.rs:121-129. - ✓
MapUnitcarriesaction_points: Option<ActionPoints>(None for non-AP units). Resolved: the runtime unit type ismc_turn::game_state::MapUnit(not a newmc-units::Unit); spec wording predates the MapUnit decision. Field added atsrc/simulator/crates/mc-turn/src/game_state.rswith serde defaultNone(saves remain backward-compatible) andMapUnit::newreadsUnitsCatalog::get(unit_type).action_point_capacityto spawn the pool full. - ✓ Unit JSON under
public/resources/units/{pioneer,engineer}*.jsondeclaresaction_point_capacity. All four engineer tiers anddwarf_founder.jsoncarry the field: tier 1→6, tier 2→10, tier 3→14, tier 8→16. Nodwarf_pioneer.jsonexists;dwarf_founder.jsonis the current stand-in (tier 2 Veteran Pioneer = 10 AP). Pioneer-specific unit authoring deferred to content ticket. - ✓ Action registry
public/resources/unit_actions/*.json+ Rust resolver. JSON:found_city.json(ap_cost: all),prepare_land.json(ap_cost: 2),build_improvement.json(ap_cost: per-improvement table). Rust:mc-unitscrate created (src/simulator/crates/mc-units/);UnitActionDef+ApCostSpecinaction.rs;cost_for(action, ctx) -> Result<ActionCost, ApCostError>inap.rs. Testsap_cost_dispatch,per_improvement_lookup,all_consumes_remainingall green (cargo test -p mc-units— 3/3 passed). - ✓
mc-turn::processorrecharges to capacity on turn-end-in-friendly-city; otherwise no recharge. Implemented asrecharge_action_points(state)insrc/simulator/crates/mc-turn/src/lib.rsnext torefresh_units: walks each player's units, skips captives and non-AP units, and callsActionPoints::recharge_fullwhen(unit.col, unit.row)is in that player's owncity_positions. Wired intoTurnProcessor::stepatsrc/simulator/crates/mc-turn/src/processor.rsimmediately aftercrate::refresh_units(state). Five headless tests inap_recharge_testscover the on-city refill, off-city no-op,None-pool no-panic, captive skip, and the enemy-city-does-not-recharge-us cross-player guard. - ✓
cargo test -p mc-core units::tests::test_ap_capacity_tier_ladder,units::tests::test_found_city_consumes_all_ap,units::tests::test_in_city_rechargesgreen —src/simulator/crates/mc-core/src/units.rs:131-188(also coverstest_try_spend_saturates,test_can_afford). End-to-endengineer_recharges_in_city(and the on-city / off-city / captive / enemy-city variants) now live inmc-turn::ap_recharge_tests(5/5 green viacargo test -p mc-turn ap_recharge_tests).
Source-of-truth rails
- Rust crate:
mc-units::actionowns AP arithmetic + recharge;mc-turncalls it. No GDScript-side AP counter. - JSON path:
public/resources/units/*.json(capacity) +public/resources/unit_actions/*.json(ap_cost). Per p1-40 SSoT. - mc-core wrapper:
ActionPointsnewtype — no raw u8 counters across boundaries.
Out of scope
- Adding AP to military units — single rule, civilians only.
- Refund-on-cancel UX — single forward consumption.
- AI scoring of multi-AP turn plans — separate AI ticket.
References
public/games/age-of-dwarves/docs/units/SPECIALISTS.md