summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-16 01:09:33 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commit7fae364e76db6646bd462adc58258d27c532e2b6 (patch)
treea898776a2160467cd7131e000ccf830b636659dc
parente40e0171938dfe33c7069f2ca5c199a294bcd586 (diff)
downloadrommel-in-the-desert-7fae364e76db6646bd462adc58258d27c532e2b6.tar.gz
Group dice when firing double/quadruple during assault/fortress defense.
-rw-r--r--rules.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index 8d55078..4e33e65 100644
--- a/rules.js
+++ b/rules.js
@@ -4737,25 +4737,30 @@ function is_minefield_offensive_fire() {
function roll_battle_fire(who, tc) {
let fc = unit_class[who]
let cv = unit_cv(who)
+ let n = 1
// Double dice during assault
if (is_assault_battle())
- cv *= 2
+ n *= 2
// Double dice for non-armor defenders in fortress!
if (fc !== ARMOR && is_fortress_defensive_fire())
- cv *= 2
+ n *= 2
let fp = FIREPOWER_MATRIX[fc][tc]
let result = []
let total = 0
- for (let i = 0; i < cv; ++i) {
- let roll = roll_die()
- if (roll >= fp) {
- result.push(die_face_hit[roll])
- ++total
- } else {
- result.push(die_face_miss[roll])
+ for (let k = 0; k < n; ++k) {
+ if (k > 0)
+ result.push(" ")
+ for (let i = 0; i < cv; ++i) {
+ let roll = roll_die()
+ if (roll >= fp) {
+ result.push(die_face_hit[roll])
+ ++total
+ } else {
+ result.push(die_face_miss[roll])
+ }
}
}