From 709c5f22e4e3c2e71f7385edbee0ce9922b25863 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Mon, 7 Oct 2024 19:12:12 +0100 Subject: Final tweaks to view --- rules.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 99450a1..b05c3e7 100644 --- a/rules.js +++ b/rules.js @@ -275,7 +275,7 @@ function gen_action(action, argument) { } view.actions[action].push(argument) } - console.log('view.actions: ', view.actions, 'view.actions[action]: ', view.actions[action]) + //console.log('view.actions: ', view.actions, 'view.actions[action]: ', view.actions[action]) } function gen_action_infl(space){ @@ -437,6 +437,7 @@ states.choose_card = { //Check for Tiananmen Square Track awards special abilities + console.log('game.tst_8', game.tst_8) if ((game.active === DEM && cards[card].side !== 'C' && game.dem_tst_position >= 8 && game.com_tst_position < 8 && !game.tst_8) || (game.active === COM && cards[card].side !== 'D' && game.com_tst_position >= 8 && game.dem_tst_position < 8 && !game.tst_8)){ gen_action('card_tst_8', card) } @@ -467,18 +468,17 @@ states.choose_card = { if (card !== 67 && game.playable_cards.includes(card)) { get_events(card) - } /* - if ((game.active === DEM && cards[game.played_card].side === 'D' && game.playable_cards[game.played_card].playable === 1) || (game.active === COM && cards[game.played_card].side === 'C' && game.playable_cards[game.played_card].playable ===1) || (cards[game.played_card].side === 'N'&& game.playable_cards[game.played_card].playable ===1)) { - gen_action('event') - } else if ((game.active === DEM && (cards[game.played_card].side === 'C' && game.playable_cards[game.played_card].playable ===1)) || game.active === COM && (cards[game.played_card].side === 'D' && game.playable_cards[game.played_card].playable ===1)) { - gen_action('opp_event') - } */ - - gen_action('card_influence', card) - if (game.active === DEM && game.dem_tst_attempted_this_turn === 0 && game.dem_tst_position <=8 || game.active === COM && game.com_tst_attempted_this_turn === 0 && game.com_tst_position <= 8) { - gen_action('card_tst', card) - } - gen_action('card_support_check', card) + } + + //Actions for non-scoring cards + + if (!scoring_cards.includes(card)) { + gen_action('card_influence', card) + if (game.active === DEM && game.dem_tst_attempted_this_turn === 0 && game.dem_tst_position <=8 || game.active === COM && game.com_tst_attempted_this_turn === 0 && game.com_tst_position <= 8) { + gen_action('card_tst', card) + } + gen_action('card_support_check', card) + } } } }, @@ -2603,6 +2603,7 @@ function remove_infl(space) { } function do_sc(space) { + clear_undo() log_gap(`Support check: ${space}`) let clicked_space = find_space_index(space) @@ -2612,10 +2613,12 @@ function do_sc(space) { log('+1 VP from C26') game.vp ++ if (check_vp()) { + game.state = 'game.over' + console.log('after check_vp, game.state', game.state) return } } - + console.log('continue support check, game.state', game.state) // Continue with Support Check Logic let roll = Math.floor(Math.random() * 6) + 1 @@ -2811,7 +2814,7 @@ function do_sc(space) { } } game.selected_space = 0 - clear_undo() + } @@ -3475,6 +3478,7 @@ function permanently_remove(card) { function check_vp() { if (game.vp >= 20) { goto_game_over(DEM, `${DEM} won an Automatic Victory!`) + console.log('after goto_game_over, game.state', game.state) return true } else if(game.vp <= -20) { goto_game_over(COM, `${COM} won an Automatic Victory!`) @@ -3496,6 +3500,7 @@ function goto_game_over(result, victory) { game.victory = victory log_h1("Game Over") log(game.victory) + console.log('game over, game.state', game.state) return } -- cgit v1.2.3