feat(mc-combat): ✨ Add siege mechanics module with attack/defense logic and combat rules
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
5b13942db8
commit
274c7cc775
1 changed files with 3 additions and 3 deletions
|
|
@ -23,13 +23,13 @@ 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).
|
||||
/// Scales by tier: 0=1.0, 1=0.75 (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.
|
||||
pub fn melee_wall_penalty(wall_tier: i32) -> f32 {
|
||||
match wall_tier {
|
||||
0 => 1.0,
|
||||
1 => 0.70,
|
||||
1 => 0.75,
|
||||
_ => 0.55,
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ 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.70).abs() < 0.001);
|
||||
assert!((melee_wall_penalty(1) - 0.75).abs() < 0.001);
|
||||
assert!((melee_wall_penalty(2) - 0.55).abs() < 0.001);
|
||||
assert!((melee_wall_penalty(3) - 0.55).abs() < 0.001);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue