From c41b9834c835555c8a595ae88af630da2e357537 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Tue, 10 Dec 2024 20:27:19 +0000 Subject: Add icons --- play.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'play.js') diff --git a/play.js b/play.js index 0135fd3..a68ee3c 100644 --- a/play.js +++ b/play.js @@ -860,6 +860,22 @@ function sub_die(match) { return die[match] || match } +function sub_icon(match) { + console.log('sub_icon called, match', match) + return ICONS[match] || match +} + +function sub_arrow(match) { + return '' +} + +const ICONS = { + '£CC': '', + '£CU': '', + '£DC': '', + '£DU': '', +} + const die = { D1: '', D2: '', @@ -885,7 +901,7 @@ function on_log(text, ix) { p.className = "i" } - + console.log('text', text) text = text.replace(/_/g, " ") text = text.replace(/C(\d+)/g, sub_card_name) @@ -893,6 +909,8 @@ function on_log(text, ix) { text = text.replace(/V(\d+)/g, sub_power_card_value) text = text.replace(/%(\d+)/g, sub_space_name) text = text.replace(/D[1-6]/g, sub_die) + text = text.replace(/£[CD][CU]\b/g, sub_icon) + text = text.replace(/.to/g, sub_arrow) if (text.match(/^\.h1/)) { text = text.substring(4) -- cgit v1.2.3 From 97656ab8c2b6a97f2616afa468bc002f1b85af40 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Tue, 10 Dec 2024 21:58:16 +0000 Subject: TST results in boxes --- play.css | 14 ++++++++++++++ play.js | 12 ++++++++++++ rules.js | 10 +++++----- 3 files changed, 31 insertions(+), 5 deletions(-) (limited to 'play.js') diff --git a/play.css b/play.css index 0ad71f5..59f65f2 100644 --- a/play.css +++ b/play.css @@ -89,6 +89,20 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); } #log .dem_nc { background-image: url(images/USd_blank.gif);} #log .dem_c {background-image: url(images/favicon_dem.svg);} +#log .number { + display: inline-block; + margin: 0; + text-indent: 0; + text-align: center; + width: 12px; + height: 12px; + line-height: 12px; + border: 1px solid #444; +} + +#log .number.d_tst { background-color: hsl(206, 85%, 80%); } +#log .number.c_tst { background-color: hsl(355, 70%, 80%); } + /* MAP */ #mapwrap { diff --git a/play.js b/play.js index a68ee3c..b74fb1f 100644 --- a/play.js +++ b/play.js @@ -874,6 +874,16 @@ const ICONS = { '£CU': '', '£DC': '', '£DU': '', + '.dT5': '5', + '.dT6': '6', + '.dT7': '7', + '.dT8': '8', + '.dT9': '9', + '.dT10': '10', + '.cT5': '5', + '.cT6': '6', + '.cT7': '7', + '.cT8': '8' } const die = { @@ -910,6 +920,8 @@ function on_log(text, ix) { text = text.replace(/%(\d+)/g, sub_space_name) text = text.replace(/D[1-6]/g, sub_die) text = text.replace(/£[CD][CU]\b/g, sub_icon) + text = text.replace(/\.cT(\d+)/g, sub_icon) + text = text.replace(/\.dT(\d+)/g, sub_icon) text = text.replace(/.to/g, sub_arrow) if (text.match(/^\.h1/)) { diff --git a/rules.js b/rules.js index 3235a31..7768459 100644 --- a/rules.js +++ b/rules.js @@ -2838,7 +2838,7 @@ function do_tst_attempt() { if (game.active === DEM) { game.dem_tst_attempted_this_turn = 1 if (roll >= dem_tst_req[game.dem_tst_position]) { - log(`Success: ${roll} >= ${dem_tst_req[game.dem_tst_position]}`) + log(`Success: ${roll} >= .dT${dem_tst_req[game.dem_tst_position]}`) game.dem_tst_position++ game.dem_tst_attempted = 0 @@ -2866,14 +2866,14 @@ function do_tst_attempt() { } game.state = 'tiananmen_square_attempt_success' } else { - log(`Fail: ${roll} < ${dem_tst_req[game.dem_tst_position]}`) + log(`Fail: ${roll} < .dT${dem_tst_req[game.dem_tst_position]}`) game.dem_tst_attempted = 1 game.state = 'tiananmen_square_attempt_fail' } } else { game.com_tst_attempted_this_turn = 1 if (roll >= com_tst_req[game.com_tst_position]) { - log(`Success: ${roll} >= ${com_tst_req[game.com_tst_position]}`) + log(`Success: ${roll} >= .cT${com_tst_req[game.com_tst_position]}`) game.com_tst_position++ game.com_tst_attempted = 0 @@ -2905,7 +2905,7 @@ function do_tst_attempt() { } game.state = 'tiananmen_square_attempt_success' } else { - log(`Fail: ${roll} < ${com_tst_req[game.com_tst_position]}`) + log(`Fail: ${roll} < .cT${com_tst_req[game.com_tst_position]}`) game.com_tst_attempted = 1 game.state = 'tiananmen_square_attempt_fail' } @@ -5013,7 +5013,7 @@ function vm_do_remove_x_infl(space) { } } } - let end = check_control(space) + let end_control = check_control(space) logi(`${game.vm_available_ops} from %${space}${get_icons(starting_control, end_control)}`) check_tyrant() game.vm_available_ops = 0 -- cgit v1.2.3