From 7fae364e76db6646bd462adc58258d27c532e2b6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 16 Sep 2022 01:09:33 +0200 Subject: Group dice when firing double/quadruple during assault/fortress defense. --- rules.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'rules.js') 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]) + } } } -- cgit v1.2.3