perf(simulator): Adjust siege mechanics constants and wall penalties for balanced defense and siege unit effectiveness

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-15 21:27:53 -07:00
parent 81914d4f20
commit 49f991995d

View file

@ -12,7 +12,7 @@ pub const BASE_CITY_HP: i32 = 200;
pub const WALL_HP_PER_TIER: i32 = 50;
/// Siege unit bonus vs city HP (applied as positive modifier to siege damage).
const SIEGE_CITY_BONUS: f32 = 2.00;
const SIEGE_CITY_BONUS: f32 = 1.70;
/// City heals this much HP per turn.
pub const CITY_HEAL_PER_TURN: i32 = 10;
@ -23,12 +23,12 @@ 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.85 (walls), 2=0.75 (castle).
/// Scales by tier: 0=1.0, 1=0.80 (walls), 2=0.65 (castle).
pub fn melee_wall_penalty(wall_tier: i32) -> f32 {
match wall_tier {
0 => 1.0,
1 => 0.85,
_ => 0.75,
1 => 0.80,
_ => 0.65,
}
}
@ -90,9 +90,9 @@ mod tests {
#[test]
fn melee_penalty_scales_by_tier() {
assert!((melee_wall_penalty(0) - 1.0).abs() < 0.001);
assert!((melee_wall_penalty(1) - 0.85).abs() < 0.001);
assert!((melee_wall_penalty(2) - 0.75).abs() < 0.001);
assert!((melee_wall_penalty(3) - 0.75).abs() < 0.001);
assert!((melee_wall_penalty(1) - 0.80).abs() < 0.001);
assert!((melee_wall_penalty(2) - 0.65).abs() < 0.001);
assert!((melee_wall_penalty(3) - 0.65).abs() < 0.001);
}
#[test]
@ -111,7 +111,7 @@ mod tests {
#[test]
fn siege_bonus() {
assert!((siege_city_bonus() - 2.00).abs() < 0.001);
assert!((siege_city_bonus() - 1.70).abs() < 0.001);
}
#[test]