diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-29 17:05:59 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-29 17:05:59 +0000 |
commit | 17b3b412c6300ce5458d46acd4757b05403287fc (patch) | |
tree | fd3be0120dee9c45bb8f55256390ab0bebdfb967 | |
parent | 7a5e5c79016444f69ca9515a60d0ebe19a4b8780 (diff) | |
download | 1989-dawn-of-freedom-17b3b412c6300ce5458d46acd4757b05403287fc.tar.gz |
New handling of Common European Home
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | rules.js | 31 |
2 files changed, 20 insertions, 13 deletions
@@ -1298,7 +1298,7 @@ const cards = [ {number: 18, period: 1, side: 'C', name: 'Poszgay Defends the Revolution*', ops: 2, remove: true, playable: true, red: false}, {number: 19, period: 1, side: 'D', name: 'Papal Visit*', ops: 2, remove: true, playable: true, red: false}, {number: 20, period: 1, side: 'C', name: 'Deutsche Marks*', ops: 4, remove: true, playable: true, red: false}, - {number: 21, period: 1, side: 'N', name: 'Common European Home', ops: 2, remove: false, playable: true, red: false}, + {number: 21, period: 1, side: 'N', name: 'Common European Home', ops: 2, remove: false, playable: false, red: false}, {number: 22, period: 1, side: 'N', name: 'Power Struggle - Poland', ops: 0, remove: false, playable: true, red: false}, {number: 23, period: 1, side: 'N', name: 'Power Struggle - Hungary', ops: 0, remove: false, playable: true, red: false}, {number: 24, period: 1, side: 'D', name: 'St. Nicholas Church*', ops: 1, remove: true, playable: true, red: true}, @@ -342,7 +342,7 @@ function start_game() { // Set variable event cards where event is playable at start of game - game.playable_cards = [C_THE_WALL, C_GORBACHEV_CHARMS_THE_WEST, C_HONECKER, C_COMMON_EUROPEAN_HOME, C_MALTA_SUMMIT] + game.playable_cards = [C_THE_WALL, C_GORBACHEV_CHARMS_THE_WEST, C_HONECKER, C_MALTA_SUMMIT] draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.dem_hand_limit, game.com_hand_limit) @@ -627,6 +627,13 @@ states.play_card = { } } + // Check Common European Home + if (game.played_card === C_COMMON_EUROPEAN_HOME) { + if (ceh_card_check().length > 0) { + gen_action('event') + } + } + // Check for events if (event_is_playable(game.played_card)) { if ( @@ -2045,7 +2052,7 @@ states.stasi_end_round = { }, card(card) { push_undo() - log_gap(`Democrat selected C${card} as next card.`) + log_gap(`Democrat selected C${card} as next card`) game.stasi_card = card if (!scoring_cards.includes(card) && count_scoring_cards() >= (7-game.round)){ game.temp = card @@ -3397,6 +3404,7 @@ function event_is_playable(card) { } // Then check normally else if (game.playable_cards.includes(card)) { + console.log('in playable cards', game.playable_cards) return true } else if (cards[card].playable) { return true @@ -3617,7 +3625,6 @@ function end_round() { game.return = '' game.valid_cards = [] game.valid_spaces = [] - check_common_european_home() reset_austria_hungary_border_reopened() /* This should be redundant! */ // Check for duplicate card entries @@ -4086,12 +4093,6 @@ function check_systematization() { } } -function check_common_european_home() { - if (!game.playable_cards.includes(C_COMMON_EUROPEAN_HOME)) { - game.playable_cards.push(C_COMMON_EUROPEAN_HOME) - } -} - function this_card() { return game.vm_event > 0 ? game.vm_event : game.played_card } @@ -5048,20 +5049,26 @@ function vm_cluj_check() { } function vm_common_european_home() { + game.valid_cards = ceh_card_check() + game.state = "vm_common_european_home_choose" +} + +function ceh_card_check() { + let ceh_cards = [] if (game.active === DEM) { for (let c of game.democrat_hand) { if (cards[c].side === 'C') { - game.valid_cards.push(c) + ceh_cards.push(c) } } } else { for (let c of game.communist_hand) { if (cards[c].side === 'D') { - game.valid_cards.push(c) + ceh_cards.push(c) } } } - game.state = "vm_common_european_home_choose" + return ceh_cards } function vm_dash_for_the_west() { |