From d43deea462c61fd981efe64e66ca16f41a722495 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Thu, 29 Aug 2024 21:22:09 +0100 Subject: Further improvements to prompt and gameplay --- rules.js | 106 +++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 40 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 44cbfa8..1d14259 100644 --- a/rules.js +++ b/rules.js @@ -486,12 +486,14 @@ states.play_card ={ return } + view.prompt = `Play ${clean_name(cards[game.played_card].name)} for:` + if (scoring_cards.includes(game.played_card)) { - view.prompt = 'Play for:' + /*view.prompt = 'Play for:'*/ gen_action('event') return } - view.prompt = `Play ${clean_name(cards[game.played_card].name)} for:` + //Check for Tiananmen Square Track awards special abilities if ((game.active === DEM && cards[game.played_card].side !== 'C' && game.dem_tst_position >= 8 && game.com_tst_position < 8 && !game.tst_8) || (game.active === COM && cards[game.played_card].side !== 'D' && game.com_tst_position >= 8 && game.dem_tst_position < 8 && !game.tst_8)){ @@ -1138,11 +1140,11 @@ states.begin_power_struggle = { } states.power_struggle = { - inactive: 'play a card', + inactive: 'play a card.', prompt () { if (game.phase === 0) { if (game.valid_cards.length > 0) { - view.prompt = "Play a card" + view.prompt = "Play a card." for (let card of game.valid_cards) { gen_action_card(card) } @@ -1164,7 +1166,7 @@ states.power_struggle = { } } else if (game.phase === 2) { - view.prompt = 'You matched. Roll a die' + view.prompt = 'You matched. Roll a die.' gen_action('roll') } else if (game.phase === 3) { @@ -1260,7 +1262,7 @@ states.power_struggle = { do_valid_cards() }, march () { - log(`Played: P${power_cards[game.played_power_card].number} as a Strike`) + log(`Played: P${power_cards[game.played_power_card].number} as a March`) game.played_power_card = 21 game.phase = 1 next_player() @@ -1312,7 +1314,7 @@ states.power_struggle = { } states.support_loss ={ - inactive: 'do Support Loss', + inactive: 'do Support Loss.', prompt () { if (game.phase === 0) { view.prompt = 'You lost the Power Struggle. Roll a die for Support Loss.' @@ -1327,7 +1329,7 @@ states.support_loss ={ //} } } else if (game.phase === 1 && game.available_ops === 0 ) { - view.prompt = 'Support Loss: finished' + view.prompt = 'Support Loss: finished.' gen_action('done') } else if (game.phase === 1 && game.valid_spaces.length === 0) { view.prompt = 'No remaining influence to remove.' @@ -1382,13 +1384,13 @@ states.vp_roll = { inactive: 'do VP Roll', prompt () { if (game.phase === 0) { - view.prompt = 'Roll a die for Victory' + view.prompt = 'Roll a die for Victory.' gen_action('roll') } else if (game.phase === 1) { - view.prompt = 'Take power' + view.prompt = 'Take power.' gen_action('take') } else if (game.phase === 2) { - view.prompt = 'Proceed to scoring' + view.prompt = 'Proceed to scoring.' gen_action('scoring') } }, @@ -1443,7 +1445,7 @@ states.choose_power = { inactive: 'choose whether to remain in power.', prompt () { if (game.phase === 0) { - view.prompt = 'Choose whether to remain in power' + view.prompt = 'Choose whether to remain in power.' gen_action('retain') gen_action('surrender') } else if (game.phase === 1) { @@ -1466,10 +1468,12 @@ states.choose_power = { push_undo() score_country(game.pwr_struggle_in) check_vp() - game.state = 'score_country' + reset_power() + game.state = 'finish_scoring' + //game.state = 'score_country' } } - +/* states.score_country = { inactive: `score country`, prompt () { @@ -1479,10 +1483,11 @@ states.score_country = { done () { reset_power() /*if (game.return !== game.active) { - next_player()}*/ + next_player()} game.state = 'finish_scoring' } } +*/ states.finish_scoring ={ inactive: 'finish scoring.', @@ -1853,7 +1858,7 @@ function add_infl(space) { // Check Austria Hungary Border Reoponed is true and condition has been met if (game.available_ops === 0 && game.active === DEM && game.persistent_events['austria_hungary_border_reopened'] && game.austria_hungary_border_reopened_tracker && !game.austria_hungary_border_reopened) { game.available_ops ++ - log('+1 influence from Austria-Hungary Border Reopened') + log('+1 influence from C58') game.austria_hungary_border_reopened = true game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country === 'East_Germany') } @@ -2644,7 +2649,9 @@ function end_round() { // Check if last round and if so resolve end turn events if (game.round_player === DEM && game.round === 7) { if(game.persistent_events['honecker']) { - next_player() + if (game.active !== COM) { + next_player() + } game.state = 'honecker' return } /*else if (game.persistent_events['new_years_eve_party']) { @@ -3275,6 +3282,9 @@ function event_prompt(str) { if (typeof str === "function") str = str() console.log('str:', str) + if (!str) { + str = "" + } return str } @@ -4592,7 +4602,7 @@ function vm_the_tyrant_is_gone() { function vm_the_wall () { game.persistent_events['the_wall']= true - game.strategy_removed.push(9) + //game.strategy_removed.push(9) //game.table_cards.push(9) log_msg_gap('C9 in effect') vm_next() @@ -4741,7 +4751,7 @@ states.vm_add_infl = { gen_action('done') } else if (game.vm_available_ops > 0 ) { - view.prompt = `${cards[this_card()].name}: add ${game.vm_available_ops} influence to ${event_prompt()}.` + view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_available_ops} influence to ${event_prompt()}.` for (let space_id of game.valid_spaces) { /*const space = spaces.find(s => s && s.space_id === space_id); @@ -4781,13 +4791,17 @@ states.vm_add_infl_free = { gen_action_infl(spaces[space_id].name_unique); //} } - } else { + } /* else { view.prompt = 'Add influence: done.' gen_action('done') - } + } */ }, infl(space) { vm_do_add_infl_free(space) + if (game.vm_available_ops === 0 ) { + game.vm_event_done = true + vm_next() + } }, done () { game.vm_event_done = true @@ -4802,7 +4816,7 @@ states.vm_add_x_infl = { // inactive: `resolve ${cards[this_card()].name}: add influence.`, prompt () { if (game.vm_available_ops > 0 ) { - view.prompt = `${cards[this_card()].name}: Add ${game.vm_available_ops} influence to ${event_prompt()}.` + view.prompt = `${clean_name(cards[this_card()].name)}: Add ${game.vm_available_ops} influence to ${event_prompt()}.` for (let space_id of game.valid_spaces) { /*const space = spaces.find(s => s && s.space_id === space_id); @@ -4830,26 +4844,34 @@ states.vm_add_limited_infl = { }, prompt () { if (game.vm_available_ops > 0 && game.valid_spaces.length > 0) { - view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_available_ops} influence to ${event_prompt()}.` - + if (game.vm_max_infl === 1) { + view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_max_infl} influence to ${event_prompt()}.` + } + else { + view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_available_ops} influence to ${event_prompt()}.` + } for (let space_id of game.valid_spaces) { /*const space = spaces.find(s => s && s.space_id === space_id); if (space) { */ gen_action_infl(spaces[space_id].name_unique); //} } - } else { + } /*else { view.prompt = `${clean_name(cards[this_card()].name)}: done.` gen_action('done') - } + }*/ }, infl(space) { vm_do_add_limited_infl(space, game.vm_max_infl) + if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) { + game.vm_event_done = true + vm_next() + } }, - done () { + /*done () { game.vm_event_done = true vm_next() - } + }*/ } states.vm_remove_infl = { @@ -4940,11 +4962,11 @@ states.vm_remove_limited_infl = { states.vm_remove_all_infl = { inactive: 'remove influence', prompt () { - if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) { + /*if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) { view.prompt = 'Remove influence: done.' gen_action('done') return - } + }*/ view.prompt = `Remove all influence from ${event_prompt()}.` for (let space_id of game.valid_spaces) { @@ -4958,10 +4980,13 @@ states.vm_remove_all_infl = { vm_do_remove_all_infl(space) const clicked_space = find_space_index(space) game.vm_active_country = spaces[clicked_space].country + if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) { + vm_next() + } }, - done() { + /*done() { vm_next() - } + }*/ } states.vm_support_check_prep = { @@ -4995,9 +5020,9 @@ states.vm_support_check_prep = { } states.vm_do_support_check = { - inactive: 'do support checks', + inactive: 'do support checks.', prompt () { - view.prompt = `Target: ${spaces[game.selected_space].name_unique}. Roll a die` + view.prompt = `Target: ${spaces[game.selected_space].name_unique}. Roll a die.` gen_action('roll') }, roll() { @@ -5785,13 +5810,13 @@ states.vm_nepotism = { return `resolve ${cards[game.played_card].name}.` }, prompt() { - if (game.phase === 1 ) { + //if (game.phase === 1 ) { view.prompt = 'Roll a die.' gen_action('roll') - } else { + /*} else { view.prompt = 'Roll a die: done.' gen_action('done') - } + }*/ }, roll() { clear_undo() @@ -5805,11 +5830,12 @@ states.vm_nepotism = { else { log(`Rolled a ${roll}: adds 1 influence`) game.vm_available_ops = 1} - game.phase = 2 + //game.phase = 2 + vm_next() }, - done() { + /*done() { vm_next() - } + }*/ } states.vm_new_years_eve_party = { -- cgit v1.2.3