From cc555af367d2cb8eb03af3e9273406de069e009e Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sun, 29 Sep 2024 18:11:15 +0100 Subject: Fix held card warning --- events.txt | 2 +- rules.js | 47 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/events.txt b/events.txt index b739948..df59a33 100644 --- a/events.txt +++ b/events.txt @@ -258,7 +258,7 @@ dash_for_the_west CARD 37 - Nagy Reburied* # Remove all Communist SPs from the Hungary Elite space. Then place 4 Communist SPs in Hungary, no more than 2 per space. -valid_spaces 43 +nagy_reburied prompt 'the Hungary Elite space' remove_all_infl 1 valid_spaces_country 'Hungary' diff --git a/rules.js b/rules.js index ffa759a..fb08071 100644 --- a/rules.js +++ b/rules.js @@ -428,6 +428,7 @@ states.choose_card = { let scoring_cards_count = count_scoring_cards() if (scoring_cards_count >= (8-game.round)){ + game.temp = card game.state = 'confirm_card' return } @@ -451,7 +452,7 @@ states.confirm_card = { gen_action('continue') }, continue() { - select_card() + select_card(game.temp) } } @@ -2003,16 +2004,17 @@ states.stasi_confirm = { states.stasi_play_card = { inactive: 'play a card.', prompt () { /*Should get rid of the play card 'done' prompt for consistency with general play */ - if (game.played_card > 0) { + /*if (game.played_card > 0) { game.state = 'play_card' view.prompt = 'Play card: done.' gen_action("done"); - return; - } else if (game.stasi_card === 0) { + return;*/ + //} else + if (game.stasi_card === 0) { view.prompt = 'Stasi: you must pass.' gen_action('pass') } else { - view.prompt = `Stasi: you must play ${cards[game.stasi_card].name}.` + view.prompt = `Stasi: you must play ${clean_name(cards[game.stasi_card].name)}.` let available_cards = [game.stasi_card] for (let card of available_cards) { gen_action_card(card) @@ -2025,9 +2027,9 @@ states.stasi_play_card = { game.played_card = card let find_card find_card = game.democrat_hand.indexOf(card); - const [playedCard] = game.democrat_hand.splice(find_card, 1); - game.available_ops = cards[card].ops - + game.democrat_hand.splice(find_card, 1); + game.available_ops = get_card_ops(card) + /* //Check for events which influence ops if (game.persistent_events['sinatra_doctrine'] && game.active === DEM) { log('+1 op from C50') @@ -2039,11 +2041,17 @@ states.stasi_play_card = { game.available_ops ++ } if (game.available_ops > 1 && game.persistent_events['prudence'].DEM !== 0) { - log(`${pluralize(game.persistent_events['prudence'].DEM, ' op')} from C8}`) + log(`${pluralize(game.persistent_events['prudence'].DEM, ' op')} from C8`) game.available_ops += game.persistent_events['prudence'].DEM if (game.available_ops < 1) { game.available_ops = 1 } + }*/ + game.stasi_card = 0 + if (game.democrat_hand.includes(21)) { + game.state = 'stasi_resolve_common_european_home' + } else { + game.state = 'play_card' } }, @@ -3414,7 +3422,7 @@ function new_turn() { //permanently_remove(59) } - if (game.persistent_events['foreign_currency_debt_burden'] !== '') { + if (game.persistent_events['foreign_currency_debt_burden'] && game.persistent_events['foreign_currency_debt_burden'] !== '') { delete game.persistent_events['foreign_currency_debt_burden'] log(`C49 no longer in effect`) //permanently_remove(49) @@ -3434,7 +3442,7 @@ function new_turn() { //permanently_remove(63) } - if (game.persistent_events['stand_fast'] !== '') { + if (game.persistent_events['stand_fast'] && game.persistent_events['stand_fast'] !== '') { delete game.persistent_events['stand_fast'] log(`C100 no longer in effect`) //permanently_remove(100) @@ -4779,8 +4787,9 @@ function vm_breakaway_baltic_republics() { function vm_brought_in_for_questioning() { if (game.active === COM) { game.active = DEM - game.return = game.active } + //game.return = game.active + console.log('in bifg, game.return', game.return) game.phase = 0 game.state = 'vm_brought_in_for_questioning' } @@ -5205,6 +5214,13 @@ function vm_modrow() { game.state = 'vm_modrow' } +function vm_nagy_reburied(){ + if (game.comInfl[43] > 0) { + game.valid_spaces.push(43) + } + vm_next() +} + function vm_national_salvation_front() { game.persistent_events['national_salvation_front'] = true game.table_cards.push(102) @@ -6074,11 +6090,13 @@ states.vm_brought_in_for_questioning = { game.vm_event = discard_card(game.democrat_hand) game.phase = 1 if (cards[game.vm_event].side === 'C' && (!variable_events.includes(game.event) || game.playable_cards[find_event(game.vm_event)])) { - game.return = game.active + //game.return = game.active if (!auto_resolve_events.includes(game.vm_event) && !switch_events.includes(game.vm_event)) { next_player() } goto_vm(game.vm_event) + } else { + game.return = DEM } }, pass() { @@ -7141,6 +7159,7 @@ states.vm_samizdat = { pass() { //if (game.samizdat_card > 0) {game.state = 'vm_samizdat_finish'} /*else { */ + log('Did not set aside a card') vm_next() //} } @@ -8166,7 +8185,7 @@ CODE[36] = [ // Dash for the West* ] CODE[37] = [ // Nagy Reburied* - [ vm_valid_spaces, 43 ], + [ vm_nagy_reburied ], [ vm_prompt, 'the Hungary Elite space' ], [ vm_remove_all_infl, 1 ], [ vm_valid_spaces_country, 'Hungary' ], -- cgit v1.2.3