fix(p2-57c): add combat field to remaining UnitStats test constructors
The mc_units::UnitStats `combat: CombatStats` field added in cd339ff7d broke
four test-only catalog constructors that cargo check --workspace does not
compile (test targets are skipped by check): mc-player-api common/mod.rs and
the three capture_* integration tests. Adds the field (warrior gets its real
60/12/1 JSON line; the rest default to zero). cargo test --workspace --no-run
now exit 0 on apricot.
Gate lesson: after a catalog/struct field change, run
`cargo test --workspace --no-run`, not just `cargo check`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
05ad5fae86
commit
9ddd40abe6
4 changed files with 14 additions and 4 deletions
|
|
@ -24,7 +24,7 @@
|
|||
use mc_ai::evaluator::ScoringWeights;
|
||||
use mc_ai::tactical::state::{TacticalBuildingSpec, TacticalUnitSpec};
|
||||
use mc_turn::game_state::{GameState, MapUnit, PlayerState};
|
||||
use mc_units::{UnitStats, UnitsCatalog};
|
||||
use mc_units::{CombatStats, UnitStats, UnitsCatalog};
|
||||
|
||||
/// Mirror of `GdGameState::add_player_militarist` (api-gdext/src/lib.rs).
|
||||
///
|
||||
|
|
@ -213,6 +213,8 @@ pub fn build_runtime_units_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 2.0,
|
||||
build_cost: 0,
|
||||
logistics: None,
|
||||
// Mirrors public/resources/units/dwarf_warrior.json combat line.
|
||||
combat: CombatStats { hp: 60, attack: 12, defense: 1, ..Default::default() },
|
||||
});
|
||||
cat.insert(UnitStats {
|
||||
id: "dwarf_founder".into(),
|
||||
|
|
@ -223,6 +225,7 @@ pub fn build_runtime_units_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 2.0,
|
||||
build_cost: 80,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
cat
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use mc_replay::TurnEvent;
|
|||
use mc_turn::{
|
||||
capture::CapturePosture, AttackRequest, GameState, MapUnit, PlayerState, TurnProcessor,
|
||||
};
|
||||
use mc_units::{UnitStats as CatalogUnitStats, UnitsCatalog};
|
||||
use mc_units::{CombatStats, UnitStats as CatalogUnitStats, UnitsCatalog};
|
||||
|
||||
const CARAVAN_ID: u32 = 900;
|
||||
const MERCHANT_ID: u32 = 901;
|
||||
|
|
@ -38,6 +38,7 @@ fn build_trade_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 2.0,
|
||||
build_cost: 0,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
// merchant.json: tier-1 trade GP — premium ransom multiplier, modest cost.
|
||||
cat.insert(CatalogUnitStats {
|
||||
|
|
@ -49,6 +50,7 @@ fn build_trade_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 3.0,
|
||||
build_cost: 80,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
// caravan_master.json: tier-3 — higher cost AND higher multiplier.
|
||||
cat.insert(CatalogUnitStats {
|
||||
|
|
@ -60,6 +62,7 @@ fn build_trade_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 3.5,
|
||||
build_cost: 160,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
cat
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use mc_replay::TurnEvent;
|
|||
use mc_turn::{
|
||||
capture::CapturePosture, AttackRequest, GameState, MapUnit, PlayerState, TurnProcessor,
|
||||
};
|
||||
use mc_units::{UnitStats as CatalogUnitStats, UnitsCatalog};
|
||||
use mc_units::{CombatStats, UnitStats as CatalogUnitStats, UnitsCatalog};
|
||||
|
||||
const ENGINEER_ID: u32 = 800;
|
||||
|
||||
|
|
@ -42,6 +42,7 @@ fn build_engineer_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 2.0,
|
||||
build_cost: 0,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
// dwarf_engineer.json shape — capturable, premium ransom multiplier,
|
||||
// AP capacity 6 (tier-1 specialist ladder).
|
||||
|
|
@ -54,6 +55,7 @@ fn build_engineer_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 3.0,
|
||||
build_cost: 70,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
cat
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ use mc_replay::TurnEvent;
|
|||
use mc_turn::{
|
||||
capture::CapturePosture, AttackRequest, GameState, MapUnit, PlayerState, TurnProcessor,
|
||||
};
|
||||
use mc_units::{UnitStats as CatalogUnitStats, UnitsCatalog};
|
||||
use mc_units::{CombatStats, UnitStats as CatalogUnitStats, UnitsCatalog};
|
||||
|
||||
fn build_capturable_catalog() -> UnitsCatalog {
|
||||
let mut cat = UnitsCatalog::new();
|
||||
|
|
@ -56,6 +56,7 @@ fn build_capturable_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 2.0,
|
||||
build_cost: 0,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
cat.insert(CatalogUnitStats {
|
||||
id: "worker".into(),
|
||||
|
|
@ -66,6 +67,7 @@ fn build_capturable_catalog() -> UnitsCatalog {
|
|||
ransom_multiplier: 2.0,
|
||||
build_cost: 70,
|
||||
logistics: None,
|
||||
combat: CombatStats::default(),
|
||||
});
|
||||
cat
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue