fix(@projects/@magic-civilization): 🐛 mark engineer capture mechanics as complete

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-14 22:02:56 -07:00
parent ccd9e7c99c
commit be04027e9a

View file

@ -2,12 +2,12 @@
id: p2-55a
title: "Engineer (Great Person) capture mechanics"
priority: p2
status: stub
status: done
scope: game1
category: combat
owner: combat-dev
created: 2026-05-07
updated_at: 2026-05-07
updated_at: 2026-05-14
blocked_by: [p2-55]
follow_ups: []
---
@ -24,13 +24,29 @@ From p2-55: "Engineers carry distinct strategic value (multi-turn build actions
## Acceptance
- [ ] Engineer unit type (great_engineer, forge_engineer, etc.) carries `"capturable": true` with a distinct `"ransom_multiplier"` tuned higher than workers (reflecting unique strategic value)
- [ ] Capture of an engineer mid-improvement-action: define what happens to the in-progress improvement (canceled? suspended? transferred?)
- [ ] AI scoring accounts for engineer's high build_cost × multiplier in `score_capture_postures`
- [ ] Tests cover engineer-specific capture edge cases
- [ ] `cargo test -p mc-combat -p mc-ai` green
- [x] Engineer unit type (great_engineer, forge_engineer, etc.) carries `"capturable": true` with a distinct `"ransom_multiplier"` tuned higher than workers (reflecting unique strategic value)
- `public/resources/units/dwarf_engineer.json``capturable: true`, `ransom_multiplier: 3.0`
- `public/resources/units/dwarf_high_engineer.json``capturable: true`, `ransom_multiplier: 3.5`
- `public/resources/units/dwarf_grand_engineer.json``capturable: true`, `ransom_multiplier: 4.0`
- `public/resources/units/dwarf_ascendant_engineer.json``capturable: true`, `ransom_multiplier: 5.0`
- Worker baseline `ransom_multiplier: 2.0`; tier-scaled engineer premium reflects GP value.
- [x] Capture of an engineer mid-improvement-action: define what happens to the in-progress improvement (canceled? suspended? transferred?)
- Policy: **canceled + AP readiness reset to zero**. Implemented at three capture-transfer sites in `mc-turn/src/processor.rs`: direct capture (`transfer_captured_unit`), ransom-refuse, ransom-expire. `current_action` cleared (pre-existing behaviour) and `action_points.current = 0` (p2-55a). No persistent multi-turn engineer-build state exists on `MapUnit`; the GP `wonder_hurry` action is one-shot, so "transferred" was never possible. Captor cannot inherit a partially-charged GP action.
- Test: `crates/mc-turn/tests/capture_engineer.rs::captured_engineer_resets_action_points_to_zero`.
- [x] AI scoring accounts for engineer's high build_cost × multiplier in `score_capture_postures`
- The existing `mc-ai::policy::score_capture_postures` takes `defender_build_cost` and `defender_ransom_multiplier` as primitives (already wired through `CombatParams`) — engineer premium reaches scoring automatically once the JSON ships.
- Tests in `crates/mc-ai/tests/capture_scoring.rs`: `merchant_picks_ransom_for_an_engineer_against_rich_opponent`, `engineer_ransom_score_exceeds_worker_ransom_score_at_equal_cost`, `ascendant_engineer_high_multiplier_routes_to_ransom_over_destroy`.
- [x] Tests cover engineer-specific capture edge cases
- `mc-combat/tests/capture.rs`: `engineer_ransom_price_uses_great_person_multiplier`, `engineer_ransom_premium_exceeds_worker_for_same_build_cost`, `ascendant_engineer_capture_clamps_hp_and_suppresses_xp`.
- `mc-ai/tests/capture_scoring.rs`: 3 engineer scoring tests (see above).
- `mc-turn/tests/capture_engineer.rs`: 3 end-to-end PvP capture/ransom tests with engineer in the catalog.
- [x] `cargo test -p mc-combat -p mc-ai` green
- `mc-combat`: 8/8 capture tests pass (3 new engineer cases). Full suite green.
- `mc-ai`: 11/11 capture_scoring tests pass (3 new engineer cases). Full suite green.
- `mc-turn` regression check: full suite green, including the 3 new engineer-specific tests in `capture_engineer.rs`.
## Notes
- Blocked on p2-55 (core capture infrastructure)
- Engineer action vocabulary defined in p2-53i
- Blocked on p2-55 (core capture infrastructure) — now resolved.
- Engineer action vocabulary defined in p2-53i.
- AP-reset policy is universal across all Specialist units (any `action_points.is_some()`) — the policy lands at the capture-transfer sites, not behind an engineer-class branch. Keeps Rail-1 source-of-truth tight: one place, one rule.