diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-06 08:29:17 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-06 08:29:17 +0000 |
commit | 670f88f5c4298a0b2e55bcffc9c80e446d78f967 (patch) | |
tree | 0e8e73da96ec082efecd5405153217dd23005088 /rules.js | |
parent | 24ef860ef52551fba2970bde282d1e33762b6bc7 (diff) | |
download | 1989-dawn-of-freedom-670f88f5c4298a0b2e55bcffc9c80e446d78f967.tar.gz |
Fix Common European Home for fuzzer
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -2994,7 +2994,6 @@ function is_auto_resolve(card) { } else if (card === C_DISSIDENT_ARRESTED) { let dem_intellectual_infl = spaces.filter(space => space.socio === 5 && game.demInfl[space.space_id] > 0).length - console.log('dem_intellectual_infl', dem_intellectual_infl) if (dem_intellectual_infl === 0) { if (!game.state.startsWith('vm')) { log('No influence to remove') } return true @@ -3107,27 +3106,27 @@ function event_is_playable(card) { function get_card_ops(card) { let ops = cards[card].ops if (game.persistent_events.includes(C_PERESTROIKA) && game.active === COM) { - if(game.state === 'choose_card' || game.state === 'stasi_play_card' || game.state === 'general_strike') { + if(game.state === 'choose_card' || game.state === 'stasi_play_card' || game.state === 'vm_common_european_home_play' || game.state === 'general_strike') { log(`+1 op from C${C_PERESTROIKA}`) } ops ++ } if (game.persistent_events.includes(C_THE_SINATRA_DOCTRINE) && game.active === DEM) { - if(game.state === 'choose_card' || game.state === 'stasi_play_card' || game.state === 'vm_laszlo_tokes') { + if(game.state === 'choose_card' || game.state === 'stasi_play_card' || game.state === 'vm_common_european_home_play' || game.state === 'vm_laszlo_tokes') { log(`+1 op from C${C_THE_SINATRA_DOCTRINE}`) } ops ++ } if ((game.active === DEM && game.dem_tst_position >= 2 && game.com_tst_position <= 1 && cards[card].ops === 1) || (game.active === COM && game.com_tst_position >=2 && game.dem_tst_position <= 1 && cards[card].ops === 1)) { - if(game.state === 'choose_card' || game.state === 'stasi_play_card') { + if(game.state === 'choose_card' || game.state === 'stasi_play_card' || game.state === 'vm_common_european_home_play') { log('+1 op from Tiananmen Square Track') } ops ++ } if ((game.active === DEM && game.prudence && game.prudence.DEM !== 0)) { - if(game.state === 'choose_card' || game.state === 'stasi_play_card' || game.state === 'vm_laszlo_tokes') { + if(game.state === 'choose_card' || game.state === 'stasi_play_card' || game.state === 'vm_common_european_home_play' || game.state === 'vm_laszlo_tokes') { if (ops > 2) { log(`${pluralize(game.prudence.DEM,'op')} from C${C_PRUDENCE}`) } else { @@ -3144,7 +3143,7 @@ function get_card_ops(card) { } if (game.active === COM && game.prudence && game.prudence.COM < 0) { - if(game.state === 'choose_card' || game.state === 'general_strike') { + if(game.state === 'choose_card' || game.state === 'general_strike' || game.state === 'vm_common_european_home_play') { if (ops > 2) { log(`${pluralize(game.prudence.COM,'op')} from C${C_PRUDENCE}`) } else if (ops > 1) { @@ -3297,29 +3296,31 @@ function end_round() { return [...new Set(duplicates)]; } - console.log('game.strategy_deck', game.strategy_deck, 'game.strategy_discard', game.strategy_discard, 'game.strategy_removed', game.strategy_removed, 'game.persistent_events', game.persistent_events, 'game.communist_hand', game.communist_hand, 'game.democrat_hand', game.democrat_hand) + //console.log('game.strategy_deck', game.strategy_deck, 'game.strategy_discard', game.strategy_discard, 'game.strategy_removed', game.strategy_removed, 'game.persistent_events', game.persistent_events, 'game.communist_hand', game.communist_hand, 'game.democrat_hand', game.democrat_hand) + card_check = card_check.sort((a, b) => a - b) if (check_duplicates(card_check)) { - console.log('card check', card_check) + console.log('duplicate cards: card check', card_check) + console.log('view.actions', view.actions) const duplicates = find_duplicates(card_check) console.log('game.strategy_deck', game.strategy_deck, 'game.strategy_discard', game.strategy_discard, 'game.strategy_removed', game.strategy_removed, 'game.persistent_events', game.persistent_events, 'game.communist_hand', game.communist_hand, 'game.democrat_hand', game.democrat_hand) throw new Error(`Duplicate cards detected: ${duplicates.join(', ')}`) } //console.log('cards in game', card_check.length) - card_check = card_check.sort((a, b) => a - b) + //console.log('cards in game', card_check) if (game.turn <= 3) { if (card_check.length !== 40) { - console.log('cards in game', card_check) + console.log('wrong number of cards in game', card_check) throw new Error(`Wrong number of cards: ${card_check.length}`) } } else if (game.turn <=7) { if (card_check.length !== 81) { - console.log('cards in game', card_check) + console.log('wrong number of cards in game', card_check) throw new Error(`Wrong number of cards: ${card_check.length}`) } } else if (card_check.length !== 110) { - console.log('cards in game', card_check) + console.log('wrong number of cards in game', card_check) throw new Error(`Wrong number of cards: ${card_check.length}`) } @@ -4653,13 +4654,14 @@ function vm_civic_forum() { } function vm_common_european_home() { - let hands = [...game.democrat_hand, ...game.communist_hand] - for (let c of hands) { - if (game.active === DEM) { + if (game.active === DEM) { + for (let c of game.democrat_hand) { if (cards[c].side === 'C') { game.valid_cards.push(c) } - } else { + } + } else { + for (let c of game.communist_hand) { if (cards[c].side === 'D') { game.valid_cards.push(c) } |