diff options
-rw-r--r-- | rules.js | 37 |
1 files changed, 19 insertions, 18 deletions
@@ -2881,7 +2881,7 @@ function flush_move_summary() { log(`Moved`) } - let keys = Object.keys(game.summary).sort((a,b)=>a-b) + let keys = Object.keys(game.summary).map(Number).sort((a,b)=>a-b) for (let mm of keys) { let n = game.summary[mm] let from = (mm) & 255 @@ -2908,9 +2908,9 @@ function flush_move_summary() { function flush_withdraw_summary() { log("Withdrew\n") - for (let to in game.summary) { - let n = game.summary[to] - to = to | 0 + for (let key in game.summary) { + let n = game.summary[key] + let to = +key if (to === 0) log(`>${n} eliminated`) else @@ -4885,12 +4885,11 @@ function gen_battle_target() { } } -function apply_auto_target() { +function apply_auto_target(who) { let hp = count_hp_in_battle() for (let i = 0; i < 4; ++i) hp[i] -= game.hits[i] - let who = game.selected let fc = unit_class[who] // armor must target armor if possible @@ -5238,31 +5237,33 @@ function goto_pursuit_hits() { function roll_pursuit_fire_imp(who, n, hp) { let speed = unit_speed[who] if (n === 2) { + let astr, bstr let a = roll_die() let b = roll_die() if (a >= 4) { game.hits++ - a = die_face_hit[a] + astr = die_face_hit[a] } else { - a = die_face_miss[a] + astr = die_face_miss[a] } if (b >= 4) { game.hits++ - b = die_face_hit[b] + bstr = die_face_hit[b] } else { - b = die_face_miss[b] + bstr = die_face_miss[b] } - game.flash = `${speed_name_cap[speed]} fired ${a}${b}.` + game.flash = `${speed_name_cap[speed]} fired ${astr}${bstr}.` } if (n === 1) { + let astr let a = roll_die() if (a >= 4) { game.hits++ - a = die_face_hit[a] + astr = die_face_hit[a] } else { - a = die_face_miss[a] + astr = die_face_miss[a] } - game.flash = `${speed_name_cap[speed]} fired ${a}.` + game.flash = `${speed_name_cap[speed]} fired ${astr}.` } log(game.flash) if (game.hits > hp) @@ -5694,7 +5695,7 @@ function goto_buildup_spending() { } function print_buildup_summary() { - let keys = Object.keys(game.summary.redeployed).sort((a,b)=>a-b) + let keys = Object.keys(game.summary.redeployed).map(Number).sort((a,b)=>a-b) if (keys.length > 0) { log("Redeployed") for (let mm of keys) { @@ -6341,7 +6342,7 @@ states.free_deployment = { }, end_deployment() { log(`Deployed`) - let keys = Object.keys(game.summary).sort((a,b)=>a-b) + let keys = Object.keys(game.summary).map(Number).sort((a,b)=>a-b) for (let x of keys) log(`>${game.summary[x]} at #${x}`) game.summary = null @@ -6811,7 +6812,7 @@ const SETUP = { }, "1941-42" () { - SETUP["1941"](-1) + SETUP["1941"]() setup_reinforcements(11) setup_reinforcements(17) @@ -6840,7 +6841,7 @@ function setup(scenario_name) { log_h1(scenario_name) - SETUP[scenario_name](-scenario.start) + SETUP[scenario_name]() setup_fortress(scenario, BARDIA) setup_fortress(scenario, BENGHAZI) |