From 61cccf6066db2628b151c185d875381575dfb422 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Wed, 23 Oct 2024 20:38:09 +0100 Subject: Updates for events with edge cases when all countries are/are not in revolution --- rules.js | 74 ++++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 23 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 4112e7f..3c927eb 100644 --- a/rules.js +++ b/rules.js @@ -6839,13 +6839,18 @@ states.vm_central_committee_reshuffle = { return `resolve ${clean_name(cards[57].name)}.` }, prompt() { - view.prompt = 'Central Committee Reshuffle: choose a country to add SPs.' - 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')} + if (game.revolutions.every(n => n === true)) { + view.prompt = 'Central Committee Reshuffle: no countries to choose.' + gen_action('pass') + } else { + view.prompt = 'Central Committee Reshuffle: choose a country to add SPs.' + 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() { push_undo() @@ -6890,6 +6895,10 @@ states.vm_central_committee_reshuffle = { game.valid_spaces = [64,65,66,67,68,69,70,71,72,73,74,75] vm_next() }, + pass() { + log('Passed') + vm_return() + } } @@ -8045,21 +8054,26 @@ states.vm_shock_therapy = { return `resolve ${clean_name(cards[game.played_card].name)}.` }, prompt() { - if (game.vm_active_country === '' ) { - view.prompt = 'Shock Therapy: choose a country where you hold Power:' - 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.phase === 2) { - view.prompt = 'Shock Therapy: done.' - gen_action('done') - } */ - else { - view.prompt = 'Shock Therapy: roll a die.' - gen_action('roll') + if (game.revolutions.every(n => n === false)) { + view.prompt = 'Shock Therapy: no countries to choose.' + gen_action('pass') + } else { + if (game.vm_active_country === '' ) { + view.prompt = 'Shock Therapy: choose a country where you hold Power:' + 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.phase === 2) { + view.prompt = 'Shock Therapy: done.' + gen_action('done') + } */ + else { + view.prompt = 'Shock Therapy: roll a die.' + gen_action('roll') + } } }, east_germany() { @@ -8114,6 +8128,10 @@ states.vm_shock_therapy = { vm_return() } }, + pass() { + log('Passed') + vm_return() + } /*done() { permanently_remove(93) vm_return() @@ -8125,6 +8143,10 @@ states.vm_social_democratic_platform_adopted = { return `resolve ${clean_name(cards[game.played_card].name)}.` }, prompt() { + if (game.revolutions.every(n => n === false)) { + view.prompt = 'Social Democratic Platform Adopted: no countries to choose.' + gen_action('pass') + } else { view.prompt = 'Select a country where the Democrat holds Power.' if (game.revolutions[0]) {gen_action('poland')} if (game.revolutions[1]) {gen_action('hungary')} @@ -8132,6 +8154,7 @@ states.vm_social_democratic_platform_adopted = { if (game.revolutions[3]) {gen_action('bulgaria')} if (game.revolutions[4]) {gen_action('czechoslovakia')} if (game.revolutions[5]) {gen_action('romania')} + } }, east_germany() { push_undo() @@ -8165,7 +8188,12 @@ states.vm_social_democratic_platform_adopted = { push_undo() game.vm_active_country = 'Bulgaria' log(`Selected ${country_name(game.vm_active_country)}`) - vm_next()} + vm_next() + }, + pass() { + log('Passed') + vm_return() + } } states.vm_systematization = { -- cgit v1.2.3