From b5797e6d486a1dfc9ef4fc98ef400f442a533236 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 2 Nov 2023 15:50:17 +0100 Subject: Round halved firepower per unit. --- rules.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/rules.js b/rules.js index 8dad2d3..83a9175 100644 --- a/rules.js +++ b/rules.js @@ -3799,8 +3799,10 @@ function goto_combat() { //logi("G" + gov_roll + " Combat") for (let u of game.combat.gov_units) { if (game.combat.harass) { - logi(`${unit_firepower(u)/2} U${u} (half)`) - gov_firepower += unit_firepower(u) / 2 + // When units fire at half Firepower Rating, round fractions up. + let fp = Math.ceil(unit_firepower(u)/2) + logi(`${fp} U${u} (half)`) + gov_firepower += fp } else { logi(`${unit_firepower(u)} U${u}`) gov_firepower += unit_firepower(u) @@ -3810,11 +3812,6 @@ function goto_combat() { set_unit_loc(u, loc) } - // When units fire at half Firepower Rating, round fractions up. - if (game.combat.harass) { - gov_firepower = Math.ceil(gov_firepower) - } - for (let i = 0; i < game.mission_air_pts; ++i) { let roll = roll_d6() logi("G" + roll + " Air PTS") -- cgit v1.2.3