summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-11-02 15:50:17 +0100
committerTor Andersson <tor@ccxvii.net>2023-11-02 15:50:31 +0100
commitb5797e6d486a1dfc9ef4fc98ef400f442a533236 (patch)
tree83b8097844234fc5244fdaef2b62e5810bb279ea
parentdffebaad66b230a35ef220de666b8bfc0ae9bbf7 (diff)
downloadalgeria-b5797e6d486a1dfc9ef4fc98ef400f442a533236.tar.gz
Round halved firepower per unit.
-rw-r--r--rules.js11
1 files 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")