magicciv/src
Natalie 2055e415d9 feat(mc-turn): p3-26 B1+B2 — happiness/golden-age + unit/city healing phases
Port two per-turn subsystems from GDScript into the headless Rust turn engine.

**B1: Happiness + Golden Age tick**
- New: src/simulator/crates/mc-turn/src/happiness_phase.rs
  - pub fn process_happiness_phase(state: &mut GameState)
  - Assembles HappinessInput from PlayerState (city_count, total_citizens,
    traded/owned luxuries, building_happiness, growth_tier)
  - Runs mc-happiness::calculate_happiness → writes PlayerState::happiness +
    happiness_status
  - Advances golden-age meter via mc-happiness::process_golden_age → writes
    golden_age_active/turns/progress/count
  - 6 unit tests covering surplus triggers, meter accumulation, count-down,
    tier defaulting, multi-player independence
- mc-happiness moved from [dev-dependencies] to [dependencies] in mc-turn/Cargo.toml

**B2: Unit + city healing tick**
- New: src/simulator/crates/mc-turn/src/healing.rs
  - pub fn process_healing_phase(state: &mut GameState)
  - Units: rest-condition guard (movement_remaining == base_moves || is_fortified),
    captive skip; rates: garrison=20, fortified-territory=15, neutral=10
  - Cities (bench CityState): +20 HP/turn clamped to max_hp
  - 10 unit tests covering garrison/fortified/neutral/moved/capped/captive/city cases

**GameState/PlayerState fields added to mc-state (all #[serde(default)])**
- PlayerState::happiness: i32
- PlayerState::happiness_status: String
- PlayerState::growth_tier: String
- PlayerState::owned_luxuries: BTreeMap<String, i32>
- PlayerState::golden_age_active: bool
- PlayerState::golden_age_turns: i32
- PlayerState::golden_age_progress: i32
- PlayerState::golden_age_count: i32
- PlayerState::building_happiness: i32

CONTRACT: process_happiness_phase and process_healing_phase are NOT wired
into TurnProcessor::step — caller wires them at the correct phase slots.

cargo test -p mc-turn: 265 passed, 0 failed (lib) + all integration suites ok.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 15:37:36 -04:00
..
game refactor(@projects/@magic-civilization): 🧹 p3-18 P5b — trim vestigial embark inputs from the action FFI 2026-06-25 07:19:26 -04:00
packages
simulator feat(mc-turn): p3-26 B1+B2 — happiness/golden-age + unit/city healing phases 2026-06-26 15:37:36 -04:00