feat(simulator): Update siege damage and success conditions to integrate with city HP for balanced simulation

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-29 12:26:49 -07:00
parent ffd739caa8
commit 20ced127f9

View file

@ -27,14 +27,16 @@ const RANGED_CITY_HP_FRACTION: f32 = 0.75;
/// Compute the penalty multiplier for melee attacks against a walled city.
/// Returns a value < 1.0 that the attacker's effective strength is multiplied by.
/// Scales by tier: 0=1.0, 1=0.70 (walls), 2=0.55 (castle).
/// Paired with the melee-to-city damage fraction in resolver.rs that halves
/// structural damage from non-siege melee attacks.
/// Scales by tier: 0=1.0, 1=0.40 (walls), 2=0.25 (castle).
/// p1-29 R5a: tightened from 0.70/0.55 → 0.40/0.25 so a walled city resists
/// overwhelming siege ("+200% defense" handoff target). Paired with the
/// melee-to-city damage fraction in resolver.rs and the BASE_CITY_HP=500 bump
/// in mc-city. Siege units bypass via `siege_city_bonus`.
pub fn melee_wall_penalty(wall_tier: i32) -> f32 {
match wall_tier {
0 => 1.0,
1 => 0.70,
_ => 0.55,
1 => 0.40,
_ => 0.25,
}
}
@ -143,12 +145,12 @@ mod tests {
"tier 0 (no walls) = 1.0"
);
assert!(
(melee_wall_penalty(1) - 0.70).abs() < EPS,
"tier 1 (walls) = 0.70"
(melee_wall_penalty(1) - 0.40).abs() < EPS,
"tier 1 (walls) = 0.40"
);
assert!(
(melee_wall_penalty(2) - 0.55).abs() < EPS,
"tier 2 (castle) = 0.55"
(melee_wall_penalty(2) - 0.25).abs() < EPS,
"tier 2 (castle) = 0.25"
);
}