From 066774320d4f15cc049d65c9bb82e8564777e20b Mon Sep 17 00:00:00 2001 From: iainp5 Date: Thu, 10 Oct 2024 19:23:25 +0100 Subject: Tweak view when infl in double figures --- play.css | 38 ++++++++++++++++++++++++++++++++++++++ play.js | 16 ++++++++++++++++ rules.js | 38 ++++++++++++++++++++++++-------------- 3 files changed, 78 insertions(+), 14 deletions(-) diff --git a/play.css b/play.css index a3c3606..9171d3d 100644 --- a/play.css +++ b/play.css @@ -219,6 +219,16 @@ header.your_turn { background-color: orange; } left: 16px; } +.demInflValue_10 { + position: absolute; + box-sizing: border-box; + font-family: 'Open Sans'; + font-size: 20px; + font-weight: bold; + top: 10px; + left: 10px; +} + .comInflValue { position: absolute; box-sizing: border-box; @@ -229,6 +239,16 @@ header.your_turn { background-color: orange; } left: 74px; } +.comInflValue_10 { + position: absolute; + box-sizing: border-box; + font-family: 'Open Sans'; + font-size: 20px; + font-weight: bold; + top: 12px; + left: 68px; +} + .comInflValue.controlled, .held { color: whitesmoke; text-shadow: @@ -247,6 +267,24 @@ header.your_turn { background-color: orange; } -1px -1px 0 #ffffff; /* Left top */ } +.comInflValue_10.controlled, .held { + color: whitesmoke; + text-shadow: + 1px 1px 0 #c2272d, /* Right bottom */ + -1px 1px 0 #c2272d, /* Left bottom */ + 1px -1px 0 #c2272d, /* Right top */ + -1px -1px 0 #c2272d; /* Left top */ +} + +.comInflValue_10.uncontrolled { + color: #c2272d; + text-shadow: + 1px 1px 0 #ffffff, /* Right bottom */ + -1px 1px 0 #ffffff, /* Left bottom */ + 1px -1px 0 #ffffff, /* Right top */ + -1px -1px 0 #ffffff; /* Left top */ +} + /* GAME MARKERS */ diff --git a/play.js b/play.js index 7ae8644..7b18e6e 100644 --- a/play.js +++ b/play.js @@ -430,6 +430,14 @@ function on_update() { dem_marker.style.display = 'block'; dem_number.style.display = 'block'; + if (demInfl > 9) { + dem_number.classList.remove('demInflValue') + dem_number.classList.add('demInflValue_10') + } else { + dem_number.classList.add('demInflValue') + dem_number.classList.remove('demInflValue_10') + } + if(check_dem_control(demInfl, comInfl, space)){ dem_marker.classList.add('controlled') dem_number.classList.add('outlined_text') @@ -448,6 +456,14 @@ function on_update() { com_marker.style.display = 'block'; com_number.style.display = 'block'; + if (comInfl > 9) { + com_number.classList.remove('comInflValue') + com_number.classList.add('comInflValue_10') + } else { + com_number.classList.add('comInflValue') + com_number.classList.remove('comInflValue_10') + } + if(check_com_control(demInfl, comInfl, space)){ com_marker.classList.add('controlled') com_number.classList.add('controlled') diff --git a/rules.js b/rules.js index d26d16d..6d15377 100644 --- a/rules.js +++ b/rules.js @@ -7319,21 +7319,27 @@ states.vm_inflationary_currency = { return `resolve ${clean_name(cards[game.played_card].name)}.` }, prompt() { - view.prompt = 'Inflationary Currency: choose a country where your opponent has power.' - if (game.active === DEM) { - if (!game.revolutions[0]) {gen_action('poland')} - if (!game.revolutions[1]) {gen_action('hungary')} - if (!game.revolutions[2]) {gen_action('east_germany')} - if (!game.revolutions[3]) {gen_action('bulgaria')} - if (!game.revolutions[4]) {gen_action('czechoslovakia')} - if (!game.revolutions[5]) {gen_action('romania')} + console.log('game.revolutions', game.revolutions, 'length', game.revolutions.length) + if (game.revolutions.every(n => n === false)) { + view.prompt = 'Inflationary Currency: no countries to choose.' + gen_action('pass') } else { - if (game.revolutions[0]) {gen_action('poland')} - if (game.revolutions[1]) {gen_action('hungary')} - if (game.revolutions[2]) {gen_action('east_germany')} - if (game.revolutions[3]) {gen_action('bulgaria')} - if (game.revolutions[4]) {gen_action('czechoslovakia')} - if (game.revolutions[5]) {gen_action('romania')} + view.prompt = 'Inflationary Currency: choose a country where your opponent has power.' + if (game.active === DEM) { + if (!game.revolutions[0]) {gen_action('poland')} + if (!game.revolutions[1]) {gen_action('hungary')} + if (!game.revolutions[2]) {gen_action('east_germany')} + if (!game.revolutions[3]) {gen_action('bulgaria')} + if (!game.revolutions[4]) {gen_action('czechoslovakia')} + if (!game.revolutions[5]) {gen_action('romania')} + } else { + if (game.revolutions[0]) {gen_action('poland')} + if (game.revolutions[1]) {gen_action('hungary')} + if (game.revolutions[2]) {gen_action('east_germany')} + if (game.revolutions[3]) {gen_action('bulgaria')} + if (game.revolutions[4]) {gen_action('czechoslovakia')} + if (game.revolutions[5]) {gen_action('romania')} + } } }, east_germany() { @@ -7372,6 +7378,10 @@ states.vm_inflationary_currency = { log(`Chose ${country_name(game.vm_active_country)}`) vm_next() }, + pass() { + log('Passed') + vm_return() + } } states.vm_inflationary_currency_discard = { -- cgit v1.2.3