diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -210,6 +210,8 @@ const com_tst_req = [6, 6, 7, 7, 8, 7, 6, 5] const scoring_cards = [22, 23, 42, 43, 55, 95] const C_TACTICS_FAILS = 52 const leader_cards = [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48] +const rallies = [1, 2, 3, 4, 5, 6] +const petitions = [31, 32, 33, 34, 35, 36] const wildcards = [49, 50, 51, 52] const elite_leaders = [37, 38, 39, 40] const leaders = [1, 4, 5, 6, 7] @@ -322,10 +324,8 @@ function start_game() { //Set starting influence spaces.forEach((space, index) => { - if (space !== null) { game.demInfl[index] = space.demInfl game.comInfl[index] = space.comInfl - } }) //Set starting placement ops @@ -1759,13 +1759,13 @@ states.support_loss ={ let rally_win = 0 let petition_win = 0 log(`Roll: D${roll}`) - if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.proxy_power_card === 'Rally in the Square') { rally_win = 2} - if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.proxy_power_card === 'Petition') { petition_win = 2} + if (rallies.includes(game.played_power_card) || game.proxy_power_card === 'Rally in the Square') { rally_win = 2} + if (petitions.includes(game.played_power_card) || game.proxy_power_card === 'Petition') { petition_win = 2} let modified_roll = roll + game.raised_stakes + rally_win - petition_win // Roll modifiers - if (game.active === COM && game.persistent_events.includes(62)) { - log('+1 from C62') + if (game.active === COM && game.persistent_events.includes(C_YAKOVLEV_COUNSELS_GORBACHEV)) { + log(`+1 from C${C_YAKOVLEV_COUNSELS_GORBACHEV}`) modified_roll ++ } @@ -1845,11 +1845,11 @@ states.vp_roll = { log(`Roll: D${roll}`) let rally_win = 0 let petition_win = 0 - if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.proxy_power_card === 'Rally in the Square') { rally_win = 2} - if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.proxy_power_card === 'Petition') { petition_win = 2} + if (rallies.includes(game.played_power_card) || game.proxy_power_card === 'Rally in the Square') { rally_win = 2} + if (petitions.includes(game.played_power_card) || game.proxy_power_card === 'Petition') { petition_win = 2} let modified_roll = roll + game.raised_stakes + rally_win - petition_win - if (game.active === DEM && game.persistent_events.includes(62)) { - log('+1 from C62') + if (game.active === DEM && game.persistent_events.includes(C_YAKOVLEV_COUNSELS_GORBACHEV)) { + log(`+1 from C${C_YAKOVLEV_COUNSELS_GORBACHEV}`) modified_roll ++ } if (modified_roll < 0) {modified_roll = 0} @@ -2700,17 +2700,17 @@ function do_sc(space) { function valid_spaces_setup() { game.valid_spaces = [] let valid_spaces_set = new Set(); - for (let i =0 ; i <= 74 ; i++) { + for (let i =0 ; i < spaces.length ; i++) { let space = spaces[i] if (game.state === 'com_init') { - infl = game.demInfl[i] + let infl = game.demInfl[i] if (infl === 0) { valid_spaces_set.add(space.space_id); } } else if (game.state === 'dem_init') { - infl = game.comInfl[i] + let infl = game.comInfl[i] if (infl === 0) { valid_spaces_set.add(space.space_id); } @@ -2724,16 +2724,16 @@ function valid_spaces_setup() { function valid_spaces_sc() { let valid_spaces_set = new Set(); - for (let i = 0 ; i <= 74; i++) { - space = spaces[i] + for (let i = 0 ; i < spaces.length; i++) { + let space = spaces[i] if (game.active === DEM) { - infl = game.comInfl[i] + let infl = game.comInfl[i] if (infl !== 0 ) { valid_spaces_set.add(space.space_id); } } else { - infl = game.demInfl[i] + let infl = game.demInfl[i] if (infl !== 0 ) { // Check Solidarity Legalised if (game.persistent_events.includes(C_SOLIDARITY_LEGALIZED) && space.space_id === S_GDANSK) {continue} @@ -2768,14 +2768,14 @@ function valid_spaces_sc() { function valid_spaces_support_loss() { let valid_spaces_set = new Set(); for (let i = 0; i < game.demInfl.length; i++) { - space = spaces[i] + let space = spaces[i] if (game.active === DEM) { - infl = game.demInfl[i] + let infl = game.demInfl[i] if (infl > 0 && space.country === game.pwr_struggle_in) { valid_spaces_set.add(space.space_id); } } else { - infl = game.comInfl[i] + let infl = game.comInfl[i] if (infl > 0 && space.country === game.pwr_struggle_in) { valid_spaces_set.add(space.space_id); } @@ -2796,7 +2796,7 @@ function valid_spaces_infl() { // Iterate over all spaces to find the ones with the player's influence for (let i = 0; i < game.demInfl.length; i++) { //piece = game.pieces[i] - space = spaces[i] + let space = spaces[i] let player_influence = game.active === COM ? game.comInfl[i] : game.demInfl[i]; @@ -3261,7 +3261,7 @@ function permanently_remove(card) { if (game.strategy_removed.includes(card)) {return} remove_from_discard(card) - card_index = game.table_cards.indexOf(card) + let card_index = game.table_cards.indexOf(card) if (card_index !== -1) { game.table_cards.splice(card_index, 1) } @@ -4510,7 +4510,7 @@ function vm_valid_spaces_opponent () { valid_spaces.push(space.space_id) } } else { - infl = game.demInfl[i] + let infl = game.demInfl[i] if (infl > 0) { valid_spaces.push(space.space_id) } @@ -5500,7 +5500,7 @@ function vm_legacy_of_martial_law() { } function vm_legacy_of_1968() { - for (let i = 0; i <= spaces.length; i++) { + for (let i = 0; i < spaces.length; i++) { let space = spaces[i] if ((!check_com_control(i) && space.country === 'Czechoslovakia')) { game.valid_spaces.push(space.space_id); @@ -7991,7 +7991,7 @@ states.vm_warsaw_pact_summit = { }, influence(){ push_undo() - for (let i = 0; i <= spaces.length; i++) { + for (let i = 0; i < spaces.length; i++) { let space = spaces[i] if (game.demInfl[i] === 0) { game.valid_spaces.push(space.space_id); @@ -8003,7 +8003,7 @@ states.vm_warsaw_pact_summit = { }, support_check(){ push_undo() - for (let i = 0; i <= spaces.length; i++) { + for (let i = 0; i < spaces.length; i++) { let space = spaces[i] if (game.demInfl[i] > 0 && (space.socio === 5 || space.socio === 6)) { game.valid_spaces.push(space.space_id) |