diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 77 |
1 files changed, 39 insertions, 38 deletions
@@ -2204,10 +2204,10 @@ states.stasi_play_ceh = { return `play ${quoted_card_name[game.played_card]}` }, prompt() { - view.prompt = "Play " + quoted_card_name[game.played_card] - gen_action('influence') - gen_action('support_check') - }, + view.prompt = 'Play ' + quoted_card_name[game.played_card] + gen_action('influence') + gen_action('support_check') + }, influence() { push_undo() log_ops_banner() @@ -4326,7 +4326,7 @@ function log_event(n) { else if (cards[n].side === "D") game.log.push(".E:C" + n + ".D") else - game.log.push(".E:C" + n + ".N") + game.log.push(".E:C" + n + ".N") } function log_br() { @@ -4436,74 +4436,75 @@ function pop_summary_i() { function pop_summary_i() { if (game.summary.length > 0) { // Create a map to group by space and track totals and details - let grouped_summary = new Map(); - let c63_logged = false; - let deferred_logs = []; + let grouped_summary = new Map() + let c63_logged = false + let deferred_logs = [] - for (let [n, msg] of game.summary) { + for (let [ n, msg ] of game.summary) { // Special case: Log C63 only once - if (msg === "(-1 Op due to C63)") { + if (msg === '(-1 Op due to C63)') { if (!c63_logged) { - logi(msg); - c63_logged = true; + logi(msg) + c63_logged = true } - continue; + continue } // Direct log for messages like C50, C123 if (!/^£/.test(msg)) { if (msg.includes('VP')) { - deferred_logs.push(msg); - } else { - logi(msg); - } + deferred_logs.push(msg) + } else { + logi(msg) + } } // Extract the space identifier (e.g., %33) and type (e.g., "in" or "from") - let space_match = msg.match(/(in|from) (%\d+)/); - if (!space_match) continue; // Skip if no valid match + let space_match = msg.match(/(in|from) (%\d+)/) + if (!space_match) + continue // Skip if no valid match - let type = space_match[1]; - let space = space_match[2]; + let type = space_match[1] + let space = space_match[2] // Extract additional details (e.g., £DC .to £UU) - let details_match = msg.match(/\((.*?)\)$/); - let details = details_match ? details_match[1] : ""; + let details_match = msg.match(/\((.*?)\)$/) + let details = details_match ? details_match[1] : '' // Split the details into "start" and "end" parts - let [start, end] = details.split(" .to "); + let [ start, end ] = details.split(' .to ') // Group by type and space - let key = `${type} ${space}`; + let key = `${type} ${space}` if (!grouped_summary.has(key)) { - grouped_summary.set(key, { total: 0, start: "", end: "" }); + grouped_summary.set(key, { total: 0, start: '', end: '' }) } - let entry = grouped_summary.get(key); - entry.total += n; + let entry = grouped_summary.get(key) + entry.total += n // Update the start only if it's not already set if (start && !entry.start) { - entry.start = start; + entry.start = start } // Always update the end with the most recent value if (end) { - entry.end = end; + entry.end = end } } // Log the grouped results - for (let [key, { total, start, end }] of grouped_summary) { - let details = start && end ? ` (${start} .to ${end})` : ""; - logi(`${total} ${key}${details}`); + for (let [ key, { total, start, end } ] of grouped_summary) { + let details = start && end ? ` (${start} .to ${end})` : '' + logi(`${total} ${key}${details}`) } for (let msg of deferred_logs) { - logi(msg); - } + logi(msg) + } } - game.summary = []; -} + game.summary = [] +} function do_log_summary() { @@ -8383,7 +8384,7 @@ states.vm_tst_6 = { if (game.active === DEM) log('Democrat free 2 Ops support check.') else - log('Communist free 2 Ops support check.') + log('Communist free 2 Ops support check.') game.selected_space = space if ( game.active === DEM && |