summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js590
1 files changed, 323 insertions, 267 deletions
diff --git a/rules.js b/rules.js
index 73ae13c..b7de6ec 100644
--- a/rules.js
+++ b/rules.js
@@ -84,7 +84,8 @@ exports.setup = function (seed, scenario, options) {
discard: false,
view_opp_hand: false,
strategy_removed: [],
- persistent_events: {prudence: {DEM: 0, COM: 0}},
+ persistent_events: [],
+ prudence: {DEM: 0, COM: 0},
power_struggle_deck: [],
power_struggle_discard: [],
dem_hand_limit: 8,
@@ -175,6 +176,8 @@ exports.view = function(state, player) {
dem_tst: game.dem_tst_position,
com_tst: game.com_tst_position,
persistent_events: game.persistent_events,
+ systematization: game.systematization,
+ the_tyrant_is_gone: game.the_tyrant_is_gone,
strategy_deck: game.strategy_deck.length,
strategy_discard: game.strategy_discard,
@@ -509,9 +512,9 @@ states.play_card ={
get_events(game.played_card)
}
- // Resolve cards with variable events
+ // Resolve cards with variable events (not Reformer)
- if (game.playable_cards.includes(game.played_card)) {
+ if (game.played_card !== 67 && game.playable_cards.includes(game.played_card)) {
get_events(game.played_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)) {
@@ -534,19 +537,22 @@ states.play_card ={
else {game.phase = 1}
game.return = game.active
if (switch_events.includes(game.played_card)) {next_player()}
- goto_vm(game.played_card)
+ game.vm_event = game.played_card
+ goto_vm(game.vm_event)
},
opp_event() {
+ push_undo()
log_gap(`Played C${cards[game.played_card].number} for the event`)
game.phase = 1 /*Do I still need this?*/
game.vm_infl_to_do = true
game.return = game.active
+ game.vm_event = game.played_card
if (auto_resolve_events.includes(game.played_card) || switch_events.includes(game.played_card)) {
- goto_vm(game.played_card)}
+ goto_vm(game.vm_event)}
else {
next_player()
- log(`C${game.played_card}`)
- goto_vm(game.played_card)
+ log(`C${game.vm_event}`)
+ goto_vm(game.vm_event)
}
},
influence() {
@@ -737,9 +743,9 @@ states.finish_support_check_prep = {
game.selected_space = find_space_index(space)
// Check for Austria-Hungary Border Reopened - check on first support check only
//console.log('game.austria_hungary_border_reopened_checked', game.austria_hungary_border_reopened_checked)
- if (game.available_ops > 1) {
- //console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', game.persistent_events['austria_hungary_border_reopened'])
- if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events['austria_hungary_border_reopened'] && game.active === DEM) {
+ if (game.active === DEM && game.available_ops > 1) {
+ //console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', 'austria_hungary_border_reopened'])
+ if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events.includes(58) && game.active === DEM) {
game.state = 'finish_austria_hungary_border_reopened_check'
return
}
@@ -855,27 +861,28 @@ states.tiananmen_square_attempt_fail = {
states.tst_goddess = {
inactive: 'choose whether to discard a card.',
prompt() {
- if (game.phase === 0) {
+ //if (game.phase === 0) {
view.prompt = 'Tiananmen Square Track award: you may discard a non-Power Struggle Card and draw a replacement.'
for (let card of game.valid_cards) {
gen_action_card(card)
}
gen_action('pass')
- } else {
+ /*} else {
view.prompt = 'Discard a card: done.'
gen_action('done')
- }
+ }*/
},
card(card) {
push_undo()
discard(card)
game.valid_cards = []
- game.phase++
- if (game.active === DEM) {
+ game.state = 'tst_goddess_draw'
+ //game.phase++
+ /*if (game.active === DEM) {
draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.democrat_hand.length +1, game.communist_hand.length)
} else {
draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.democrat_hand.length, game.communist_hand.length +1)
- }
+ }*/
},
pass() {
log('Did not discard')
@@ -885,7 +892,7 @@ states.tst_goddess = {
} else {
log_side()
}
- if (game.persistent_events['general_strike']) {
+ if (game.persistent_events.includes(5)) {
game.state = 'general_strike'
} else {
game.state = 'choose_card'
@@ -900,7 +907,34 @@ states.tst_goddess = {
log_side()
}
game.phase = 0
- if (game.persistent_events['general_strike']) {
+ if (game.persistent_events.includes(5)) {
+ game.state = 'general_strike'
+ } else {
+ game.state = 'choose_card'
+ }
+ }
+}
+
+states.tst_goddess_draw = {
+ inactive: 'choose whether to discard a card.',
+ prompt() {
+ view.prompt = 'Draw a replacement card.'
+ gen_action('draw')
+ },
+ draw() {
+ if (game.active === DEM) {
+ draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.democrat_hand.length +1, game.communist_hand.length)
+ } else {
+ draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.democrat_hand.length, game.communist_hand.length +1)
+ }
+ log_h2("Action Round " + game.round)
+ if (game.active === DEM) {
+ next_player()
+ } else {
+ log_side()
+ }
+ game.phase = 0
+ if (game.persistent_events.includes(5)) {
game.state = 'general_strike'
} else {
game.state = 'choose_card'
@@ -932,9 +966,8 @@ states.support_check_prep = {
// Check for Austria-Hungary Border Reopened - check on first support check only
//console.log('game.austria_hungary_border_reopened_checked', game.austria_hungary_border_reopened_checked)
- if (game.available_ops > 1) {
- // console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', game.persistent_events['austria_hungary_border_reopened'])
- if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events['austria_hungary_border_reopened'] && game.active === DEM) {
+ if (game.active === DEM && game.available_ops > 1) {
+ if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events.includes(58) && game.active === DEM) {
game.state = 'austria_hungary_border_reopened_check'
return
}
@@ -1022,15 +1055,15 @@ states.draw_power_cards = {
game.com_pwr_hand_limit = 0
}
// Events which affect cards drawn
- if (game.persistent_events['roundtable_talks'] && game.com_pwr_hand_limit >= 2) {
+ if (game.persistent_events.includes(17) && game.com_pwr_hand_limit >= 2) {
log('Democrat receives 2 cards from Communist due to C17')
game.dem_pwr_hand_limit += 2
game.com_pwr_hand_limit -= 2
discard_from_table(17)
- delete game.persistent_events['roundtable_talks']
+ game.persistent_events = game.persistent_events.filter(n => n !== 17)
}
- if (game.persistent_events['peasant_parties_revolt']) {
+ if (game.persistent_events.includes(72)) {
let farmer_check
for (let space of spaces) {
if (space && space.country === game.pwr_struggle_in && space.socio === 3 && check_dem_control(space.space_id)) {
@@ -1042,16 +1075,16 @@ states.draw_power_cards = {
game.dem_pwr_hand_limit += 1
game.com_pwr_hand_limit -= 1
permanently_remove(72)
- delete game.persistent_events['peasant_parties_revolt']
+ game.persistent_events = game.persistent_events.filter(n => n !== 72)
}
}
- if (game.persistent_events['national_salvation_front'] && game.dem_pwr_hand_limit >=2 && (game.pwr_struggle_in === 'Romania' || game.pwr_struggle_in === 'Bulgaria')) {
+ if (game.persistent_events.includes(102) && game.dem_pwr_hand_limit >=2 && (game.pwr_struggle_in === 'Romania' || game.pwr_struggle_in === 'Bulgaria')) {
log('Communist receives 2 cards from Democrat due to C102')
game.dem_pwr_hand_limit -= 2
game.com_pwr_hand_limit += 2
permanently_remove(102)
- delete game.persistent_events['national_salvation_front']
+ game.persistent_events = game.persistent_events.filter(n => n !== 102)
}
//Draw Power Cards
@@ -1071,7 +1104,7 @@ states.draw_power_cards = {
next_player()
}
log_h3('The Crowd Turns Against Ceausescu')
- game.persistent_events['the_crowd_turns_against_ceausescu'] = true
+ game.persistent_events.push(54)
game.state = 'the_crowd_turns_against_ceausescu_prep'
} else {
log_h2('Raise the Stakes')
@@ -1478,7 +1511,7 @@ states.support_loss ={
let modified_roll = roll + game.raised_stakes + rally_win - petition_win
// Roll modifiers
- if (game.active === COM && game.persistent_events['yakovlev']) {
+ if (game.active === COM && game.persistent_events.includes(62)) {
log('+1 from C62')
modified_roll ++
}
@@ -1547,8 +1580,8 @@ states.vp_roll = {
if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.played_power_card === 53) {rally_win = 2}
if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.played_power_card === 54) {petition_win = 2}
let modified_roll = roll + game.raised_stakes + rally_win - petition_win
- if (game.active === DEM && game.persistent_events['yakovlev']) {
- log('+1 from Yakovlev Counsels Gorbachev')
+ if (game.active === DEM && game.persistent_events.includes(62)) {
+ log('+1 from C62')
modified_roll ++
}
if (modified_roll < 0) {modified_roll = 0}
@@ -1629,7 +1662,7 @@ states.choose_power = {
score_country(game.pwr_struggle_in)
//Check if The Tyrant is Gone occurs
- if (game.table_cards.includes(97) && game.pwr_struggle_in === 'Romania' && game.persistent_events['the_crowd_turns_against_ceausescu']) {
+ if (game.table_cards.includes(97) && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(54)) {
game.return_state = 'finish_scoring'
game.state = 'the_tyrant_is_gone'
} else {
@@ -1678,7 +1711,7 @@ states.finish_scoring ={
done() {
console.log('game.return_state', game.return_state)
log('Power Struggle resolved') /*At this point log card dicarded or permanently removed? */
- if (game.persistent_events['new_years_eve_party'] === 2) {
+ if (game.persistent_events.includes(111)) {
game.state = 'new_years_eve_party'
return
}
@@ -1718,9 +1751,9 @@ states.end_turn_4_5_4 = {
log('Communist player has a held scoring card')
goto_game_over(DEM, `${DEM} won by held scoring card!`)
}
- else if (game.persistent_events['new_years_eve_party'] === 1) {
+ else if (game.persistent_events.includes(104)) {
log_h1(`New Year's Eve Party`)
- game.persistent_events['new_years_eve_party'] = 2
+ game.persistent_events.push(111)
game.state = 'new_years_eve_party'
}
else if(game.turn === 10) {
@@ -1728,7 +1761,7 @@ states.end_turn_4_5_4 = {
log_h2('Final Scoring')
//Check if the Communist receives VP from The Tyrant is Gone
- if (game.persistent_events['the_tyrant_is_gone'] > 0) {
+ if (game.persistent_events.includes(97)) {
game.vp -= 2
log(`Communist receives 2 VP from C97`)
}
@@ -1799,6 +1832,7 @@ states.final_scoring = {
game.temp['Bulgaria'] = true
},
done() {
+ delete game.temp
if (game.vp > 0) {
goto_game_over(DEM, `${DEM} wins on Victory Point Track!`)
} else if (game.vp < 0) {
@@ -1839,24 +1873,18 @@ states.general_strike = {
},
card (card) {
push_undo()
- log(`Discarded C${cards[card].number}`)
game.played_card = card
let find_card
- find_card = game.communist_hand.indexOf(card);
- game.communist_hand.splice(find_card, 1);
-
- //Check if the discarded card is a scoring card
- if (scoring_cards.includes(game.played_card)) {
- log(`Played C${card}`)
+ find_card = game.communist_hand.indexOf(card)
+ game.communist_hand.splice(find_card, 1)
+ game.available_ops = get_card_ops(card)
+ if (scoring_cards.includes(card)) {
+ log(`Played C${card} for the event`)
game.return_state = 'general_strike'
goto_vm(card)
- return
+ } else {
+ log(`Discarded C${cards[card].number}`)
}
-
- // Otherwise, set card ops for the roll
-
- game.available_ops = get_card_ops(card)
-
},
roll() {
clear_undo()
@@ -1864,8 +1892,8 @@ states.general_strike = {
log(`Rolled a ${roll}`)
log(`+${game.available_ops} from C${cards[game.played_card].number}.`)
- if (game.persistent_events['prudence'].COM !== 0) {
- log(`${game.persistent_events['prudence'].COM} from C8`)
+ if (game.prudence.COM !== 0) {
+ log(`${game.prudence.COM} from C8`)
roll --
}
@@ -1875,7 +1903,7 @@ states.general_strike = {
if (total > 5) {
log('The strike is over.')
permanently_remove(5)
- delete game.persistent_events['general_strike']
+ game.persistent_events = game.persistent_events.filter(n => n !== 5)
} else {
log('The strike continues. Required 6 or more')
}
@@ -1897,12 +1925,12 @@ states.honecker ={
push_undo()
game.round++
game.round_player = COM
- delete game.persistent_events['honecker']
+ game.persistent_events = game.persistent_events.filter(n => n !== 15)
game.state = 'choose_card'
},
pass() {
log('C15: passed')
- delete game.persistent_events['honecker']
+ game.persistent_events = game.persistent_events.filter(n => n !== 15)
end_round()
}
}
@@ -2076,9 +2104,9 @@ states.stasi_play_card = {
log('+1 op from Tiananmen Square Track')
game.available_ops ++
}
- if (game.available_ops > 1 && game.persistent_events['prudence'].DEM !== 0) {
- log(`${pluralize(game.persistent_events['prudence'].DEM, ' op')} from C8`)
- game.available_ops += game.persistent_events['prudence'].DEM
+ if (game.available_ops > 1 && game.prudence.DEM !== 0) {
+ log(`${pluralize(game.prudence.DEM, ' op')} from C8`)
+ game.available_ops += game.prudence.DEM
if (game.available_ops < 1) {
game.available_ops = 1
}
@@ -2142,14 +2170,14 @@ function add_infl(space) {
}
// Check Genscher
- if (game.persistent_events['genscher'] && game.active === DEM && spaces[clicked_space].country === 'East_Germany') {
+ if (game.persistent_events.includes(63) && game.active === DEM && spaces[clicked_space].country === 'East_Germany' && check_com_control(clicked_space)) {
game.available_ops--
- log(`(-1 op due to C63)`)
+ log_summary(`(-1 op due to C63)`)
} else if (check_opp_control(clicked_space)) {
game.available_ops -= 2
//Check if Austria Hungary Border Reopened was used to place last SP in a controlled space in East Germany. If so, game.available_op will be negative
if (game.available_ops < 0) {
- log(`(Used +1 op from C58)`)
+ log_summary(`(Used +1 op from C58)`)
}
} else {
game.available_ops--
@@ -2166,7 +2194,7 @@ function add_infl(space) {
check_control_change(clicked_space)
// Check Austria Hungary Border Reopened is true and condition has been met
- if (game.available_ops === 0 && game.active === DEM && game.persistent_events['austria_hungary_border_reopened'] && game.austria_hungary_border_reopened_tracker) {
+ if (game.available_ops === 0 && game.active === DEM && game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker) {
game.available_ops ++
log('+1 op from C58')
game.austria_hungary_border_reopened_tracker = false
@@ -2180,7 +2208,7 @@ function add_infl(space) {
if (game.available_ops === 1) {
//console.log(`in Genscher / AHBR check, game.persistent_events['genscher']`, game.persistent_events['genscher'])
if (game.active === DEM) {
- if (game.persistent_events['genscher'] || (game.persistent_events['austria_hungary_border_reopened'] && game.austria_hungary_border_reopened_tracker)) {
+ if (game.persistent_events.includes(63) || (game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker)) {
console.log('in gensher subcheck - remove non-East German controlled ')
game.valid_spaces = game.valid_spaces.filter(n => !(check_opp_control(n) && spaces[n].country !== 'East_Germany'))
} else {
@@ -2242,7 +2270,7 @@ function do_sc(space) {
//Check Helsinki Final Act
- if (game.active === COM && game.persistent_events['helsinki_final_act'] && (spaces[clicked_space].socio === 5 || spaces[clicked_space].socio === 6) ) {
+ if (game.active === COM && game.persistent_events.includes(26) && (spaces[clicked_space].socio === 5 || spaces[clicked_space].socio === 6) ) {
log('+1 VP from C26')
game.vp ++
if (check_vp()) {
@@ -2283,23 +2311,23 @@ function do_sc(space) {
//Check for events which modify card ops
// Check for Perestoika
- if (game.active === COM && game.persistent_events['perestroika']) {
+ if (game.active === COM && game.persistent_events.includes(25)) {
log(`+1 from C25`)
modifier++
}
// Check for Sinatra Doctrine
- if (game.active === DEM && game.persistent_events['sinatra_doctrine']) {
+ if (game.active === DEM && game.persistent_events.includes(50)) {
log(`+1 from C50`)
modifier++
}
// Check for Prudence
- if (game.active === DEM && game.persistent_events['prudence'].DEM !== 0) {
- log(`${pluralize(game.persistent_events['prudence'].DEM, ' op')} from C8`)
- modifier += game.persistent_events['prudence'].DEM
+ if (game.active === DEM && game.prudence.DEM !== 0) {
+ log(`${pluralize(game.prudence.DEM, ' op')} from C8`)
+ modifier += game.prudence.DEM
}
- if (game.active === COM && game.persistent_events['prudence'].COM !== 0) {
- log(`${pluralize(game.persistent_events['prudence'].COM, ' op')} from C8`)
- modifier += game.persistent_events['prudence'].COM
+ if (game.active === COM && game.prudence.COM !== 0) {
+ log(`${pluralize(game.prudence.COM, ' op')} from C8`)
+ modifier += game.prudence.COM
}
let modified_ops = card_ops + modifier
//Check modified card ops is not less than 1
@@ -2317,13 +2345,13 @@ function do_sc(space) {
// Events which modify SC rolls
- if (game.active === COM && game.persistent_events['tear_gas'] && spaces[clicked_space].socio === 6) {
+ if (game.active === COM && game.persistent_events.includes(30) && spaces[clicked_space].socio === 6) {
roll ++
log('+1 from C30')
permanently_remove(30)
- delete game.persistent_events['tear_gas']
+ game.persistent_events = game.persistent_events.filter(n => n !== 30)
}
- if (game.active === DEM && spaces[clicked_space].region === 'Eastern Europe' && game.persistent_events['frg_embassies']) {
+ if (game.active === DEM && spaces[clicked_space].region === 'Eastern Europe' && game.persistent_events.includes(74)) {
roll++
log('+1 from C74')
}
@@ -2331,19 +2359,19 @@ function do_sc(space) {
roll += 2
log('+2 from C76')
}*/
- if (game.active === DEM && spaces[clicked_space].country === 'East_Germany' && game.persistent_events['grenztruppen']) {
+ if (game.active === DEM && spaces[clicked_space].country === 'East_Germany' && game.persistent_events.includes(59)) {
roll--
log('-1 from C59')
}
- if ((game.active === COM && game.persistent_events['stand_fast'] === DEM && check_dem_control(clicked_space)) || (game.active === DEM && game.persistent_events['stand_fast'] === COM && check_com_control(clicked_space))){
+ if ((game.active === COM && game.stand_fast === DEM && check_dem_control(clicked_space)) || (game.active === DEM && game.stand_fast === COM && check_com_control(clicked_space))){
roll--
log('-1 from C100')
}
- if (game.active === DEM && game.persistent_events['elena'] && spaces[clicked_space].country === 'Romania') {
+ if (game.active === DEM && game.persistent_events.includes(101) && spaces[clicked_space].country === 'Romania') {
roll--
log('-1 from C101')
}
- if (game.active === DEM && game.persistent_events['austria_hungary_border_reopened'] && game.austria_hungary_border_reopened_tracker) {
+ if (game.active === DEM && game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker) {
roll++
log(`+1 from C58`)
}
@@ -2354,14 +2382,14 @@ function do_sc(space) {
const adj = count_adj(space)
console.log('adj', adj)
- if (game.active === COM && game.persistent_events['the_wall'] && spaces[clicked_space].country === 'East_Germany') {
+ if (game.active === COM && game.persistent_events.includes(9) && spaces[clicked_space].country === 'East_Germany') {
log('No adjacency for Democrats due to C9')
log('C9 no longer in effect')
roll += adj.com_adj
if (adj.com_adj > 0) {
log(`+${adj.com_adj} from adjacent control`)
}
- delete game.persistent_events['the_wall']
+ game.persistent_events = game.persistent_events.filter(n => n !== 9)
// Standard adjacency
} else {
@@ -2425,8 +2453,8 @@ function do_sc(space) {
} else {
log_msg_gap('No change in influence')
}
- if (game.active === COM && game.persistent_events['eco_glasnost'] && spaces[clicked_space].space_id === 66) {
- log_msg_gap('+1 VP from Eco Glasnost')
+ if (game.active === COM && game.persistent_events.includes(39) && spaces[clicked_space].space_id === 66) {
+ log_msg_gap('+1 VP from C39')
game.vp++
if (check_vp()) {
return
@@ -2469,7 +2497,8 @@ function valid_spaces_setup() {
function valid_spaces_sc() {
let valid_spaces_set = new Set();
-
+ console.log('valid spaces sc, persistent events', game.persistent_events)
+
for (let i = 1 ; i < 75; i++) {
space = spaces[i]
@@ -2481,25 +2510,27 @@ function valid_spaces_sc() {
} else {
infl = game.demInfl[i]
if (infl !== 0 ) {
- if (game.persistent_events['solidarity_legalised']) {
+ // Check Solidarity Legalised
+ if (game.persistent_events.includes(2)) {
if (space.space_id === 14) {continue}
}
- if (game.persistent_events['civic_forum']) {
+ // Check Civic Forum
+ if (game.persistent_events.includes(90)) {
if (space.space_id === 30) {continue}
}
- if (game.persistent_events['we_are_the_people']) {
+ // Check We Are the People
+ if (game.persistent_events.includes(48)) {
if (space.space_id === 9) {continue}
}
valid_spaces_set.add(space.space_id);
}
}
- console.log('valid spaces', game.valid_spaces)
}
//Check for Foreign Currency Debt Burden
- if (game.persistent_events['foreign_currency_debt_burden'] !== '') {
+ if (game.foreign_currency_debt_burden !== '') {
for (let n of valid_spaces_set) {
- if (spaces[n].country === game.persistent_events['foreign_currency_debt_burden']) {
+ if (spaces[n].country === game.foreign_currency_debt_burden) {
valid_spaces_set.delete(n);
}
}
@@ -2509,7 +2540,7 @@ function valid_spaces_sc() {
game.valid_spaces = Array.from(valid_spaces_set);
//Check for the Crown Turns Against Ceausescu
- if (game.is_pwr_struggle && game.pwr_struggle_in === 'Romania' && game.persistent_events['the_crowd_turns_against_ceausescu']) {
+ if (game.is_pwr_struggle && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(54)) {
game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country === 'Romania')
}
return game.valid_spaces;
@@ -2605,10 +2636,9 @@ function valid_spaces_infl() {
// Check if the adjacent space is controlled by the opponent
const opponent_control = check_opp_control(adj_piece.space_id)
//console.log('controlled?', opponent_control)
- //console.log('genscher?', game.persistent_events['genscher'])
//Check for Genscher. Can always place in East Germany even with 1 op
- if (game.active === DEM && adj_piece.country === 'East_Germany' && game.persistent_events['genscher']){
+ if (game.active === DEM && adj_piece.country === 'East_Germany' && game.persistent_events.includes(63)){
// console.log('space added with genscher')
valid_spaces_set.add(adj_piece.space_id)
}
@@ -2768,7 +2798,7 @@ function do_tst_attempt() {
log(`Rolled a ${roll}`);
roll += game.available_ops
- log(`+${game.available_ops} from the card operations value`)
+ log(`+${game.available_ops} from card Ops`)
// TIANANMEN SQUARE MODIFIERS
@@ -2788,9 +2818,9 @@ function do_tst_attempt() {
roll ++;
log('+1 for playing own card');
}
- if (game.active === COM && game.persistent_events['li_peng']) {
+ if (game.active === COM && game.persistent_events.includes(53)) {
roll ++
- log('+1 from Li Peng')
+ log('+1 from C53')
}
log(`Modified die roll: ${roll}`)
@@ -3118,7 +3148,7 @@ function end_stasi_choose_card() {
log_h2(`Action Round ${game.round}`)
next_player()
game.valid_spaces = []
- if (game.persistent_events['general_strike']) {
+ if (game.persistent_events.includes(5)) {
log_h3('C5')
game.state = 'general_strike'
} else {
@@ -3160,13 +3190,13 @@ function select_card(card){
game.available_ops = get_card_ops(card)
//Check Ligachev
- if (game.active === DEM && game.persistent_events['ligachev'] && card !== 14) {
+ if (game.active === DEM && game.persistent_events.includes(99) && card !== 14) {
log('-3 VP from C99')
game.vp -= 3
if (check_vp()) {
return
}
- delete game.persistent_events['ligachev']
+ game.persistent_events = game.persistent_events.filter(n => n !== 99)
}
game.state = 'play_card'
console.log('game.state', game.state)
@@ -3191,11 +3221,11 @@ function get_events(card){
function get_card_ops(card) {
let ops = cards[card].ops
- if (game.persistent_events['perestroika'] && game.active === COM) {
+ if (game.persistent_events.includes(25) && game.active === COM) {
log('+1 op from C25')
ops ++
}
- if (game.persistent_events['sinatra_doctrine'] && game.active === DEM) {
+ if (game.persistent_events.includes(50) && game.active === DEM) {
log('+1 op from C50')
ops ++
}
@@ -3205,27 +3235,27 @@ function get_card_ops(card) {
ops ++
}
- if ((game.active === DEM && game.persistent_events['prudence'].DEM !== 0)) {
+ if ((game.active === DEM && game.prudence.DEM !== 0)) {
if (ops > 2) {
- log(`${pluralize(game.persistent_events['prudence'].DEM,'op')} from C8`)
+ log(`${pluralize(game.prudence.DEM,'op')} from C8`)
} else {
if (ops > 1) {
log(`-1 op from C8`)
}
}
- ops += game.persistent_events['prudence'].DEM
+ ops += game.prudence.DEM
if (ops < 1) {
ops = 1
}
}
- if (game.active === COM && game.persistent_events['prudence'].COM !== 0) {
+ if (game.active === COM && game.prudence.COM !== 0) {
if (ops > 2) {
- log(`${pluralize(game.persistent_events['prudence'].COM,'op')} from C8`)
+ log(`${pluralize(game.prudence.COM,'op')} from C8`)
} else if (ops > 1) {
log(`-1 op from C8`)
}
- ops += game.persistent_events['prudence'].COM
+ ops += game.prudence.COM
if (ops < 1) {
ops = 1
}
@@ -3314,7 +3344,7 @@ function end_round() {
// Check if last round and if so resolve end turn events
if (game.round_player === DEM && game.round === 7) {
- if(game.persistent_events['honecker']) {
+ if(game.persistent_events.includes(15)) {
if (game.active !== COM) {
next_player()
}
@@ -3351,7 +3381,7 @@ function end_round() {
// Resolve end action round
- if(game.round_player === COM && game.persistent_events['stasi'] ) {
+ if(game.round_player === COM && game.persistent_events.includes(13)) {
game.round_player = DEM
if (game.active !== DEM) {
next_player()
@@ -3378,14 +3408,14 @@ function end_round() {
return
}
if (game.round_player === DEM) {
- if(game.persistent_events['stasi']) {
+ if(game.persistent_events.includes(13)) {
//console.log('stasi sub function')
if (game.active !== DEM) {
next_player()
}
game.state = 'stasi_end_round'
return
- } else if(game.round_player === DEM && game.persistent_events['general_strike']){
+ } else if(game.round_player === DEM && game.persistent_events.includes(5)){
game.state = 'general_strike'
game.round ++
log_h2(`Action Round ${game.round}`)
@@ -3446,52 +3476,57 @@ function new_turn() {
game.com_tst_attempted_this_turn = 0
game.tst_7 = false
game.tst_8 = false
- delete game.persistent_events['perestroika']
- game.persistent_events['prudence'] = {DEM: 0, COM: 0}
- delete game.persistent_events['sinatra_doctrine']
- delete game.persistent_events['stasi']
- delete game.persistent_events['honecker']
-
- //Remove Events on the table which last only 1 turn
- console.log('in new turn')
- if (game.persistent_events['austria_hungary_border_reopened']) {
- delete game.persistent_events['austria_hungary_border_reopened']
+
+ //Remove events that only last one turn
+ game.persistent_events = game.persistent_events.filter(n => n !== 25) /*Perestroika*/
+ game.prudence = {DEM: 0, COM: 0}
+ game.persistent_events = game.persistent_events.filter(n => n !== 50) /*Sinatra Doctrine*/
+ game.persistent_events = game.persistent_events.filter(n => n !== 13) /*Stasi*/
+ game.persistent_events = game.persistent_events.filter(n => n !== 15) /*Honecker*/
+
+ //Austria Hungary Border Reopened
+ if (game.persistent_events.includes(58)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== 58)
log(`C58 no longer in effect`)
//permanently_remove(58)
}
- if (game.persistent_events['elena']) {
- delete game.persistent_events['elena']
+ //Elena
+ if (game.persistent_events.includes(101)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== 101)
log(`C101 no longer in effect`)
//permanently_remove(101)
}
- if (game.persistent_events['grenztruppen']) {
- delete game.persistent_events['grenztruppen']
+ //GrenzTruppen
+ if (game.persistent_events.includes(59)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== 59)
log(`C59 no longer in effect`)
//permanently_remove(59)
}
-
- if (game.persistent_events['foreign_currency_debt_burden'] && game.persistent_events['foreign_currency_debt_burden'] !== '') {
- delete game.persistent_events['foreign_currency_debt_burden']
+ //Foreign Currency Debt Burden
+ if (game.persistent_events.includes(49)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== 49)
+ delete game.foreign_currency_debt_burden
log(`C49 no longer in effect`)
//permanently_remove(49)
}
-
- if (game.persistent_events['frg_embassies']) {
- delete game.persistent_events['frg_embassies']
+ //FRG Embassies
+ if (game.persistent_events.includes(74)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== 74)
log(`C74 no longer in effect`)
discard_from_table(74)
- //permanently_remove(74)
+ permanently_remove(74)
}
-
- if (game.persistent_events['genscher']) {
- delete game.persistent_events['genscher']
+ //Genscher
+ if (game.persistent_events.includes(63)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== 63)
log(`C63 no longer in effect`)
discard_from_table(63)
- //permanently_remove(63)
+ permanently_remove(63)
}
-
- if (game.persistent_events['stand_fast'] && game.persistent_events['stand_fast'] !== '') {
- delete game.persistent_events['stand_fast']
+ //Stand Fast
+ if (game.persistent_events.includes(100)) {
+ game.persistent_events = game.persistent_events.filter(n => n !== 100)
+ delete game.stand_fast
log(`C100 no longer in effect`)
//permanently_remove(100)
}
@@ -3510,11 +3545,11 @@ function new_turn() {
add_lateyear()
}
if (game.turn > 1) {
- if (game.persistent_events['presidential_visit']) {
+ if (game.persistent_events.includes(65)) {
game.com_hand_limit = 7
- log('Communist draws 7 cards due to Presidential Visit')
+ log('Communist draws 7 cards due to C65')
//permanently_remove(65)
- delete game.persistent_events['presidential_visit']
+ game.persistent_events = game.persistent_events.filter(n => n !== 65)
}
console.log('deck', game.strategy_deck)
console.log('game.com_hand_limit', game.com_hand_limit, 'communist hand before draw', game.communist_hand)
@@ -3547,7 +3582,7 @@ function new_turn() {
log_h2("Action Round " + game.round)
log_side()
//console.log('in start new AR call, game.active', game.active)
- if (game.persistent_events['general_strike']) {
+ if (game.persistent_events.includes(5)) {
game.state = 'general_strike'
}
else {
@@ -3738,25 +3773,25 @@ function reset_power() {
game.tactics_fails = ''
game.view_opp_hand = false
- if (game.persistent_events['peasant_parties_revolt']){
+ if (game.persistent_events.includes(72)){
permanently_remove(72)
game.table_cards = game.table_cards.filter(card => card !== 72)
- delete game.persistent_events['peasant_parties_revolt']
+ game.persistent_events = game.persistent_events.filter(n => n !== 72)
}
- if (game.persistent_events['yakovlev']) {
+ if (game.persistent_events.includes(62)) {
permanently_remove(62)
game.table_cards = game.table_cards.filter(card => card !== 62)
- delete game.persistent_events['yakovlev']
+ game.persistent_events = game.persistent_events.filter(n => n !== 62)
}
- if (game.persistent_events['the_crowd_turns_against_ceausescu'] && game.pwr_struggle_in === 'Romania'){
+ if (game.persistent_events.includes(54) && game.pwr_struggle_in === 'Romania'){
permanently_remove(54)
//game.table_cards = game.table_cards.filter(card => card !== 54)
- //game.persistent_events['the_crowd_turns_against_ceausescu'] = false
+
}
- if (game.pwr_struggle_in === 'Romania' && game.persistent_events['securitate']){
+ if (game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(70)){
//permanently_remove(70)
//game.table_cards = game.table_cards.filter(card => card !== 70)
- delete game.persistent_events['securitate']
+ game.persistent_events = game.persistent_events.filter(n => n !== 70)
}
}
@@ -3772,20 +3807,20 @@ function check_control_change(space_id) {
}*/
// Check if the Tyrant is Gone has been fulfilled
- if (game.persistent_events['the_tyrant_is_gone'] > 0 && check_dem_control(game.persistent_events['the_tyrant_is_gone'])) {
+ if (game.the_tyrant_is_gone > 0 && check_dem_control(game.the_tyrant_is_gone)) {
log('+2 VP from C97')
game.vp += 2
if (check_vp()) {
return
}
- delete game.persistent_events['the_tyrant_is_gone']
+ delete game.the_tyrant_is_gone
}
}
function check_systematization() {
// Check for Systematization - may not use this space
- if (game.persistent_events['systematization'] > 0) {
- game.valid_spaces = game.valid_spaces.filter(n => n !== game.persistent_events['systematization'])
+ if (game.systematization > 0) {
+ game.valid_spaces = game.valid_spaces.filter(n => n !== game.systematization)
}
}
@@ -3807,10 +3842,10 @@ function get_ops(card) {
ops++
}
//Events that influence ops
- if (game.persistent_events['perestroika']) {
+ if (game.persistent_events.includes(25)) {
ops++
}
- ops += game.persistent_events['prudence'].COM
+ ops += game.prudence.COM
} else {
//Check TST op bonus
@@ -3818,10 +3853,10 @@ function get_ops(card) {
ops++
}
//Events that influence ops
- if (game.persistent_events['sinatra_doctrine']) {
+ if (game.persistent_events.includes(50)) {
ops++
}
- ops += game.persistent_events['prudence'].DEM
+ ops += game.prudence.DEM
}
//Ops can never be less than one
if (ops <1) { ops = 1 }
@@ -3913,16 +3948,20 @@ function push_summary() {
}
function log_summary(msg) {
- for (let item of game.summary) {
- if (item[1] === msg) {
- item[0]++
- return
+
+ if (msg.startsWith('Added') || msg.startsWith('Removed')) {
+ for (let item of game.summary) {
+ if (item[1] === msg) {
+ item[0]++
+ return
+ }
}
}
game.summary.push([1, msg])
}
function pop_summary() {
+ console.log('summary', game.summary)
if (game.summary.length > 0) {
for (let [n, msg] of game.summary) {
if (n > 1) {
@@ -4177,7 +4216,7 @@ function vm_return() {
console.log('in vm_return, discard:', game.strategy_discard)
game.support_check_modifier = 0
game.vm_event = 0 /*Reset to 0 now that event has been completed. Hopefully this doesn't cause issues! */
- if (game.persistent_events['austria_hungary_border_reopened']) {
+ if (game.persistent_events.includes(58)) {
reset_austria_hungary_border_reopened()
}
@@ -4262,8 +4301,8 @@ function vm_valid_spaces_socio () {
game.valid_spaces = valid_spaces
// Check for Systematization - may not use this space
- if (game.persistent_events['systematization'] > 0) {
- game.valid_spaces = game.valid_spaces.filter(n => n !== game.persistent_events['systematization'])
+ if (game.systematization && game.systematization > 0) {
+ game.valid_spaces = game.valid_spaces.filter(n => n !== game.systematization)
}
vm_next()
}
@@ -4287,8 +4326,8 @@ function vm_valid_spaces_opponent_socio () {
}
game.valid_spaces = valid_spaces
// Check for Systematization - may not use this space
- if (game.persistent_events['systematization'] > 0) {
- game.valid_spaces = game.valid_spaces.filter(n => n !== game.persistent_events['systematization'])
+ if (game.systematization && game.systematization > 0) {
+ game.valid_spaces = game.valid_spaces.filter(n => n !== game.systematization)
}
vm_next()
}
@@ -4304,14 +4343,13 @@ function vm_valid_spaces_country () {
}
}
// Check for Systematization - may not use this space
- if (game.persistent_events['systematization'] > 0) {
- game.valid_spaces = game.valid_spaces.filter(n => n !== game.persistent_events['systematization'])
+ if (game.systematization && game.systematization > 0) {
+ game.valid_spaces = game.valid_spaces.filter(n => n !== game.systematization)
}
vm_next()
}
function vm_valid_spaces_sc () {
- console.log('in vm_valid_spaces_sc: game.persistent_events[we_are_the_people]', game.persistent_events['we_are_the_people'])
valid_spaces_sc()
vm_next()
}
@@ -4356,17 +4394,22 @@ function vm_valid_spaces_country_sc () {
}
} else {
if (space.country === country && game.demInfl[space.space_id] >0) {
- if (game.persistent_events['solidarity_legalised'] && space.space_id === 14) {continue}
- if (game.persistent_events['civic_forum'] && space.space_id === 30) {continue}
- if (game.persistent_events['we_are_the_people'] && space.space_id === 9) {continue}
+ //Check Solidarity Legalised
+ if (game.persistent_events.includes(2) && space.space_id === 14) {continue}
+
+ //Check Civic Forum
+ if (game.persistent_events.includes(90) && space.space_id === 30) {continue}
+
+ //Check We are the People
+ if (game.persistent_events.includes(48) && space.space_id === 9) {continue}
valid_spaces.push(space.space_id);
}
}
}
game.valid_spaces = valid_spaces
- if (!game.is_pwr_struggle && game.persistent_events['foreign_currency_debt_burden'] !== '') {
- game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country !== game.persistent_events['foreign_currency_debt_burden'])
+ if (!game.is_pwr_struggle && game.foreign_currency_debt_burden && game.foreign_currency_debt_burden !== '') {
+ game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country !== game.foreign_currency_debt_burden)
}
vm_next()
}
@@ -4374,7 +4417,7 @@ function vm_valid_spaces_country_sc () {
function vm_valid_spaces_country_socio_2() {
for (let space of spaces) {
if (!space) continue
- if (space.space_id === game.persistent_events['systematization']) continue
+ if (space.space_id === game.systematization) continue
if ((space.country === vm_operand(1) && space.socio === vm_operand(2)) || (space.country === vm_operand(1) && space.socio === vm_operand(3))) {
game.valid_spaces.push(space.space_id);
}
@@ -4386,7 +4429,7 @@ function vm_valid_spaces_region_socio() {
let valid_spaces = []
for (let space of spaces) {
if (!space) continue
- if (space.space_id === game.persistent_events['systematization']) continue
+ if (space.space_id === game.systematization) continue
if (space.region === vm_operand(1) && space.socio === vm_operand(2)) {
valid_spaces.push(space.space_id);
}
@@ -4467,7 +4510,7 @@ function vm_do_add_infl(space) {
push_undo()
console.log('in vm_do_add_infl, space', space)
const clicked_space = find_space_index(space)
- //console.log('at start, event', game.persistent_events['austria_hungary_border_reopened'], 'ahbr', game.austria_hungary_border_reopened, 'tracker', game.austria_hungary_border_reopened_tracker)
+
//log(`Added 1 influence in %${clicked_space}.`)
log_summary(`Added £ SP in %${clicked_space}.`)
@@ -4477,13 +4520,13 @@ function vm_do_add_infl(space) {
}
// Check Genscher
- if (game.persistent_events['genscher'] && game.active === DEM && spaces[clicked_space].country === 'East_Germany') {
+ if (game.persistent_events.includes(63) && game.active === DEM && spaces[clicked_space].country === 'East_Germany') {
game.vm_available_ops--
} else if (check_opp_control(clicked_space)) {
game.vm_available_ops -= 2
//Check if Austria Hungary Border Reopened was used to place last SP in a controlled space in East Germany. If so, game.vm_available_op will be negative
if (game.vm_available_ops < 0) {
- log(`(Used +1 op from C58)`)
+ log_summary(`(Used +1 op from C58)`)
}
} else {
game.vm_available_ops--
@@ -4500,7 +4543,7 @@ function vm_do_add_infl(space) {
check_control_change(clicked_space)
// Check Austria Hungary Border Reopened is true and condition has been met
- if (game.vm_available_ops === 0 && game.active === DEM && game.persistent_events['austria_hungary_border_reopened'] && game.austria_hungary_border_reopened_tracker) {
+ if (game.vm_available_ops === 0 && game.active === DEM && game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker) {
game.vm_available_ops ++
log('+1 Op from C58')
game.austria_hungary_border_reopened_tracker = false
@@ -4512,9 +4555,10 @@ function vm_do_add_infl(space) {
// Check for Genscher & Austria Hungary Border Reopened
if (game.vm_available_ops === 1) {
- console.log(`in Genscher / AHBR check, game.persistent_events['genscher']`, game.persistent_events['genscher'])
+
if (game.active === DEM) {
- if (game.persistent_events['genscher'] || (game.persistent_events['austria_hungary_border_reopened'] && game.austria_hungary_border_reopened_tracker)) {
+ //Check Genscher and AHBR
+ if (game.persistent_events.includes(63) || (game.persistent_events.includes(58) && game.austria_hungary_border_reopened_tracker)) {
console.log('in gensher subcheck - remove non-East German controlled ')
game.valid_spaces = game.valid_spaces.filter(n => !(check_com_control(n) && spaces[n].country !== 'East_Germany'))
} else {
@@ -4864,10 +4908,7 @@ function vm_adamec() {
}
function vm_army_backs_revolution() {
- /*if (game.persistent_events['securitate']) {
- permanently_remove(70)
- }*/
- game.persistent_events['securitate']
+ game.persistent_events = game.persistent_events.filter(n => n !== 70)
game.playable_cards = game.playable_cards.filter(n => n !== 70)
/*if (game.table_cards.includes(70)) {
permanently_remove(70)
@@ -4876,7 +4917,7 @@ function vm_army_backs_revolution() {
}
function vm_austria_hungary_border_reopened() {
- game.persistent_events['austria_hungary_border_reopened'] = true
+ game.persistent_events.push(58)
permanently_remove(58)
//game.table_cards.push(58)
//remove_from_discard(58)
@@ -4899,7 +4940,7 @@ function vm_breakaway_baltic_republics() {
}
game.playable_cards.push(109)
game.playable_cards = game.playable_cards.filter(n => n !== 14)
- if (!check_dem_control(56) && game.persistent_events['systematization'] !== 56) {game.valid_spaces.push(56)}
+ if (!check_dem_control(56) && game.systematization !== 56) {game.valid_spaces.push(56)}
if (!check_dem_control(70)) {game.valid_spaces.push(70)}
vm_next()
}
@@ -4952,7 +4993,7 @@ function vm_civic_forum() {
if (check_vp()) {
return
}
- game.persistent_events['civic_forum'] = true
+ game.persistent_events.push(90)
if (check_dem_control(31)) {
vm_next()
} else {
@@ -5016,13 +5057,13 @@ function vm_domino_theory() {
}
function vm_eco_glasnost() {
- game.persistent_events['eco_glasnost'] = true
+ game.persistent_events.push(39)
permanently_remove(39)
vm_next()
}
function vm_elena(){
- game.persistent_events['elena'] = true
+ game.persistent_events.push(101)
permanently_remove(101)
//game.table_cards.push(101)
//remove_from_discard(101)
@@ -5036,7 +5077,7 @@ function vm_eliminate(space_id) {
//console.log('adjacency before: Iasi', game.pieces[53].adjacent, 'Ploesti:', game.pieces[59].adjacent, 'Bucharesti:', game.pieces[61].adjacent)
// Remove clicked_space from the adjacency lists of its adjacent spaces
- adjacent_spaces.forEach(s => {
+ /* adjacent_spaces.forEach(s => {
game.pieces[s].adjacent = spaces[s].adjacent.filter(id => id !== space_id);
});
@@ -5077,13 +5118,13 @@ function vm_eliminate(space_id) {
function get_adjusted_adjacency(space_id) {
let adjacent_spaces = spaces[space_id].adjacent;
- if (adjacent_spaces.includes(game.persistent_events['systematization'])) {
- //console.log('in get adjusted adjacency, systemization',game.persistent_events['systematization'])
+ if (adjacent_spaces.includes(game.systematization)) {
+ //console.log('in get adjusted adjacency, systemization',game.systematization)
//console.log('adjacent_spaces', adjacent_spaces)
}
- if (game.persistent_events['systematization'] !== 0) {
+ if (game.systematization !== 0) {
//console.log('in systematization check')
- let eliminated_space_id = game.persistent_events['systematization'];
+ let eliminated_space_id = game.systematization;
return adjacent_spaces.map(adj_space_id => {
if (adj_space_id === eliminated_space_id) {
@@ -5111,6 +5152,7 @@ function vm_foreign_currency_debt_burden() {
}
//game.table_cards.push(49)
//remove_from_discard(49)
+ game.persistent_events.push(49)
game.state = 'vm_foreign_currency_debt_burden'
}
@@ -5124,7 +5166,7 @@ function vm_foreign_television() {
vm_next()
}
function vm_frg_embassies() {
- game.persistent_events['frg_embassies'] = true
+ game.persistent_events.push(74)
game.table_cards.push(74)
remove_from_discard(74)
log('C74 in effect')
@@ -5132,7 +5174,7 @@ function vm_frg_embassies() {
}
function vm_general_strike() {
- game.persistent_events['general_strike'] = true
+ game.persistent_events.push(5)
game.table_cards.push(5)
remove_from_discard(5)
log('C5 in effect')
@@ -5140,7 +5182,7 @@ function vm_general_strike() {
}
function vm_genscher() {
- game.persistent_events['genscher'] = true
+ game.persistent_events.push(63)
game.table_cards.push(63)
remove_from_discard(63)
log(`C63 in effect`)
@@ -5163,7 +5205,6 @@ function vm_goodbye_lenin() {
game.valid_cards.push(card)
}
}
- console.log('valid_cards', game.valid_cards)
game.state = 'vm_goodbye_lenin'
}
@@ -5180,7 +5221,7 @@ function vm_government_resigns() {
function vm_grenztruppen() {
console.log('in grenztruppen - player active:', game.active)
- game.persistent_events['grenztruppen'] = true
+ game.persistent_events.push(59)
permanently_remove(59)
//game.table_cards.push(59)
//remove_from_discard(59)
@@ -5201,13 +5242,12 @@ function vm_heal_our_bleeding_wounds() {
}
function vm_helsinki_final_act() {
- game.persistent_events['helsinki_final_act'] = true
+ game.persistent_events.push(26)
vm_next()
}
function vm_honecker() {
- game.persistent_events['honecker'] = true
- game.discard = true
+ game.persistent_events.push(15)
game.valid_cards = []
for (let c of game.strategy_discard) {
if (scoring_cards.includes(c)) {
@@ -5258,7 +5298,7 @@ function vm_kohl_proposes_reunification() {
if (check_vp()) {
return
}
- if (game.persistent_events['the_wall_must_go']) {
+ if (game.persistent_events.includes(86)) {
game.vm_event = 87
game.state = 'vm_common_european_home'
} else {
@@ -5288,7 +5328,7 @@ function vm_kremlin_coup() {
}
function vm_laszlo_tokes() {
- game.persistent_events['laszlo_tokes'] = true
+ game.persistent_events.push(73)
game.playable_cards.push(107)
game.state = 'vm_laszlo_tokes'
}
@@ -5309,14 +5349,14 @@ function vm_legacy_of_1968() {
}
function vm_li_peng() {
- game.persistent_events['li_peng'] = true
+ game.persistent_events.push(53)
//game.table_cards.push(53)
remove_from_discard(53)
vm_next()
}
function vm_ligachev() {
- game.persistent_events['ligachev'] = true
+ game.persistent_events.push(99)
vm_next()
}
@@ -5325,7 +5365,7 @@ function vm_malta_summit() {
}
function vm_massacre_in_timisoara() {
- delete game.persistent_events['laszlo_tokes']
+ game.persistent_events = game.persistent_events.filter(n => n !== 73)
vm_next()
}
@@ -5342,7 +5382,7 @@ function vm_nagy_reburied(){
}
function vm_national_salvation_front() {
- game.persistent_events['national_salvation_front'] = true
+ game.persistent_events.push(102)
game.table_cards.push(102)
remove_from_discard(102)
vm_next()
@@ -5368,7 +5408,7 @@ function vm_normalisation() {
}
function vm_peasant_parties_revolt() {
- game.persistent_events['peasant_parties_revolt'] = true
+ game.persistent_events.push(72)
log_msg_gap('C72 in effect')
game.table_cards.push(72)
remove_from_discard(72)
@@ -5376,7 +5416,7 @@ function vm_peasant_parties_revolt() {
}
function vm_perestroika() {
- game.persistent_events['perestroika'] = true
+ game.persistent_events.push(25)
log_msg_gap('C25 in effect')
permanently_remove(25)
vm_next()
@@ -5413,7 +5453,7 @@ function vm_power_struggle() {
//Check for Securitate
- if (game.pwr_struggle_in === 'Romania' && game.persistent_events['securitate']) {
+ if (game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(70)) {
console.log('in Securitate subcheck')
log('C70: Democrat reveals Power Struggle cards')
game.view_opp_hand = true
@@ -5424,7 +5464,7 @@ function vm_power_struggle() {
}
function vm_presidential_visit() {
- game.persistent_events['presidential_visit'] = true
+ game.persistent_events.push(65)
//game.table_cards.push(65)
//remove_from_discard(65)
log_msg_gap('C65 in effect')
@@ -5433,11 +5473,11 @@ function vm_presidential_visit() {
function vm_prudence() {
if (game.active === DEM) {
- game.persistent_events['prudence'].COM --
- log(`${game.persistent_events['prudence'].COM} to Communist ops this turn`)
+ game.prudence.COM --
+ log(`${game.prudence.COM} to Communist ops this turn`)
} else {
- game.persistent_events['prudence'].DEM --
- log(`${game.persistent_events['prudence'].DEM} to Democrat ops this turn`)}
+ game.prudence.DEM --
+ log(`${game.prudence.DEM} to Democrat ops this turn`)}
vm_next()
}
@@ -5461,7 +5501,7 @@ function vm_reformer_rehabilitated () {
}
function vm_roundtable_talks() {
- game.persistent_events['roundtable_talks'] = true
+ game.persistent_events.push(17)
game.table_cards.push(17)
remove_from_discard(17)
log_msg_gap('C17 in effect')
@@ -5494,7 +5534,7 @@ function vm_samizdat() {
}
function vm_securitate() {
- game.persistent_events['securitate'] = true
+ game.persistent_events.push(70)
permanently_remove(70)
//game.table_cards.push(70)
vm_next()
@@ -5511,12 +5551,13 @@ function vm_social_democratic_platform_adopted() {
function vm_solidarity_legalised() {
log_msg_gap(`C2 in effect`)
game.playable_cards.push(3)
- game.persistent_events['solidarity_legalised'] = true
+ game.persistent_events.push(2)
+ console.log('game.persistent_events', game.persistent_events)
vm_next()
}
function vm_st_nicholas_church () {
- game.persistent_events['st_nicholas_church'] = true
+ game.persistent_events.push(24)
game.playable_cards.push(61)
permanently_remove(24)
vm_next()
@@ -5524,14 +5565,15 @@ function vm_st_nicholas_church () {
function vm_stasi() {
log_msg_gap('C13 in effect')
- game.persistent_events['stasi'] = true
+ game.persistent_events.push(13)
vm_next()
}
function vm_stand_fast() {
+ game.persistent_events.push(100)
if (game.active === DEM) {
- game.persistent_events['stand_fast'] = DEM
- } else {game.persistent_events['stand_fast'] = COM}
+ game.stand_fast = DEM
+ } else {game.stand_fast = COM}
//game.table_cards.push(100)
vm_next()
}
@@ -5552,7 +5594,7 @@ function vm_tank_column() {
}
function vm_tear_gas () {
- game.persistent_events['tear_gas']= true
+ game.persistent_events.push(30)
game.table_cards.push(30)
remove_from_discard(30)
log_msg_gap('C30 in effect')
@@ -5562,8 +5604,8 @@ function vm_tear_gas () {
function vm_the_baltic_way() {
game.playable_cards.push(84)
game.stability++
- if (!check_dem_control(56) && game.persistent_events['systematization'] !== 56) {game.valid_spaces.push(56)}
- if (!check_dem_control(70) && game.persistent_events['systematization'] !== 70) {game.valid_spaces.push(70)}
+ if (!check_dem_control(56) && game.systematization !== 56) {game.valid_spaces.push(56)}
+ if (!check_dem_control(70) && game.systematization !== 70) {game.valid_spaces.push(70)}
log('+3 VP')
game.vp += 3
if (check_vp()) {
@@ -5578,7 +5620,6 @@ function vm_the_chinese_solution() {
}
function vm_the_crowd_turns_against_ceausescu() {
- //game.persistent_events['the_crowd_turns_against_ceausescu'] = true
game.table_cards.push(54)
remove_from_discard(54)
game.playable_cards.push(97)
@@ -5592,7 +5633,7 @@ function vm_the_monday_demonstrations() {
}
function vm_the_sinatra_doctrine() {
- game.persistent_events['sinatra_doctrine'] = true
+ game.persistent_events.push(50)
log_msg_gap('C50 in effect')
vm_next()
}
@@ -5607,7 +5648,7 @@ function vm_the_tyrant_is_gone() {
for (let i = 1; i < spaces.length; i++) {
let space = spaces[i]
if (game.demInfl[i] === 0 && space.country === 'Romania') {
- if (space.space_id === game.persistent_events['systematization']) {continue}
+ if (space.space_id === game.systematization) {continue}
game.valid_spaces.push(space.space_id)
}
}
@@ -5627,7 +5668,7 @@ function vm_the_tyrant_is_gone_prep() {
}
function vm_the_wall () {
- game.persistent_events['the_wall']= true
+ game.persistent_events.push(9)
//game.strategy_removed.push(9)
//game.table_cards.push(9)
log_msg_gap('C9 in effect')
@@ -5650,7 +5691,7 @@ function vm_warsaw_pact_summit() {
function vm_we_are_the_people() {
if (game.demInfl[6] > 0) {game.valid_spaces = [6]}
- game.persistent_events['we_are_the_people'] = true
+ game.persistent_events.push(48)
game.vm_influence_added[6] = 0
game.vm_available_ops = 4
game.state = 'vm_we_are_the_people_remove'
@@ -5678,7 +5719,7 @@ function vm_workers_revolt() {
}
function vm_yakovlev_counsels_gorbachev() {
- game.persistent_events['yakovlev'] = true
+ game.persistent_events.push(62)
log_msg_gap('C62 in effect')
game.table_cards.push(62)
remove_from_discard(62)
@@ -6079,7 +6120,7 @@ states.vm_support_check_prep = {
// Check for Austria-Hungary Border Reopened - check on first support check only
//First check for Monday Demonstrations - support checks will always be in East Germany
- if (game.played_card === 61 || game.vm_event === 61) {
+ if (game.vm_event === 61) {
game.austria_hungary_border_reopened_tracker = true
game.state = 'vm_do_support_check'
return
@@ -6087,9 +6128,8 @@ states.vm_support_check_prep = {
//Then check Austria-Hungary Border Reopened normally
//console.log('game.austria_hungary_border_reopened_checked', game.austria_hungary_border_reopened_checked)
- if (game.vm_available_ops > 1) {
- console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', game.persistent_events['austria_hungary_border_reopened'])
- if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events['austria_hungary_border_reopened'] && game.active === DEM) {
+ if (game.active === DEM && game.vm_available_ops > 1) {
+ if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events.includes(58) && game.active === DEM) {
game.state = 'vm_austria_hungary_border_reopened_check'
return
}
@@ -6125,9 +6165,9 @@ states.vm_ceh_support_check_prep = {
//Then check Austria-Hungary Border Reopened normally
//console.log('game.austria_hungary_border_reopened_checked', game.austria_hungary_border_reopened_checked)
- if (game.vm_available_ops > 1) {
- console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', game.persistent_events['austria_hungary_border_reopened'])
- if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events['austria_hungary_border_reopened'] && game.active === DEM) {
+ if (game.active === DEM && game.vm_available_ops > 1) {
+ console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', game.persistent_events.includes(58))
+ if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events.includes(58) && game.active === DEM) {
game.state = 'vm_austria_hungary_border_reopened_check'
return
}
@@ -6293,6 +6333,14 @@ states.vm_brought_in_for_questioning = {
game.phase = 1
if (cards[game.vm_event].side === 'C' && (cards[game.vm_event].playable || game.playable_cards.includes(game.vm_event))) {
//game.return = game.active
+ if (!game.vm_infl_to_do) {
+ if(game.round_player === DEM) {
+ game.return = COM
+ } else {
+ game.return = DEM
+ }
+ }
+ console.log('BIFQ discard: game.return', game.return)
if (!auto_resolve_events.includes(game.vm_event) && !switch_events.includes(game.vm_event)) {
next_player()
}
@@ -6351,7 +6399,7 @@ states.vm_central_committee_reshuffle = {
game.vm_active_country = "Romania"
log(`Chose ${country_name(game.vm_active_country)}`)
game.valid_spaces = [50,51,52,53,54,55,56,57,58,59,60,61,62,63]
- game.valid_spaces = game.valid_spaces.filter(space => space !== game.persistent_events['systematization'])
+ game.valid_spaces = game.valid_spaces.filter(space => space !== game.systematization)
vm_next()
},
bulgaria () {
@@ -6549,8 +6597,8 @@ states.vm_deutsche_marks = {
push_undo()
log(`Played C${cards[game.vm_event].number} to place SPs`)
game.vm_available_ops = cards[game.vm_event].ops
- if (game.persistent_events['perestroika']) {game.vm_available_ops++ }
- game.vm_available_ops += game.persistent_events['prudence'].COM
+ if (game.persistent_events.includes(25)) {game.vm_available_ops++ }
+ game.vm_available_ops += game.prudence.COM
valid_spaces_infl()
game.state = 'vm_add_infl'
},
@@ -6627,31 +6675,31 @@ states.vm_foreign_currency_debt_burden = {
},
east_germany() {
push_undo()
- game.persistent_events['foreign_currency_debt_burden'] = 'East_Germany'
+ game.foreign_currency_debt_burden = 'East_Germany'
log('Selected East Germany')
vm_next()
},
poland() {
push_undo()
- game.persistent_events['foreign_currency_debt_burden'] = 'Poland'
+ game.foreign_currency_debt_burden = 'Poland'
log('Selected Poland')
vm_next()
},
czechoslovakia() {
push_undo()
- game.persistent_events['foreign_currency_debt_burden'] = 'Czechoslovakia'
+ game.foreign_currency_debt_burden = 'Czechoslovakia'
log('Selected Czechoslovakia')
vm_next()
},
hungary() {
push_undo()
- game.persistent_events['foreign_currency_debt_burden'] = 'Hungary'
+ game.foreign_currency_debt_burden = 'Hungary'
log('Selected Hungary')
vm_next()
},
bulgaria() {
push_undo()
- game.persistent_events['foreign_currency_debt_burden'] = 'Bulgaria'
+ game.foreign_currency_debt_burden = 'Bulgaria'
log('Selected Bulgaria')
vm_next()
}
@@ -6705,7 +6753,7 @@ states.vm_goodbye_lenin_ops = {
influence(){
push_undo()
game.vm_available_ops = cards[this_card()].ops
- if (game.persistent_events['sinatra_doctrine']) {
+ if (game.persistent_events.includes(50)) {
log(`+1 from C50`)
game.vm_available_ops++
}
@@ -6908,7 +6956,7 @@ states.vm_kiss_of_death_finish = {
//game.return = game.active
console.log('kiss of death event section, discard', game.strategy_discard)
// Remove game.vm_event from the discard
- game.strategy_discard = game.strategy_discard.filter(n => n !== game.vm_event)
+ //game.strategy_discard = game.strategy_discard.filter(n => n !== game.vm_event)
console.log('kiss of death event section 2, discard', game.strategy_discard)
goto_vm(game.vm_event)
@@ -7055,7 +7103,7 @@ states.vm_laszlo_tokes = {
},
influence(){
push_undo()
- if (game.persistent_events['sinatra_doctrine']) {
+ if (game.persistent_events.includes(50)) {
log(`+1 op from C50`)
game.vm_available_ops = 3
} else {
@@ -7230,7 +7278,7 @@ states.vm_new_years_eve_party = {
},
end() {
push_undo()
- game.persistent_events['new_years_eve_party'] = 1
+ game.persistent_events.push(104)
log('Chooses to end the game. There will be no final scoring')
let power = game.revolutions.filter(value => value === false).length
if (power > 3) {
@@ -7529,7 +7577,7 @@ states.vm_systematization = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- /*if (game.persistent_events['systematization'] === 0) { */
+ /*if (game.systematization === 0) { */
view.prompt = 'Systematization: eliminate a space in Romania.'
for (let space_id of game.valid_spaces) {
gen_action_infl(spaces[space_id].name_unique);
@@ -7543,7 +7591,8 @@ states.vm_systematization = {
push_undo()
vm_eliminate(find_space_index(space))
game.valid_spaces = []
- game.persistent_events['systematization'] = find_space_index(space)
+ game.systematization = find_space_index(space)
+ game.persistent_events.push(69)
vm_next()
},
/* done() {
@@ -7642,7 +7691,7 @@ states.vm_the_tyrant_is_gone = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- if (game.persistent_events['the_tyrant_is_gone']=== 0) {
+ if (!game.the_tyrant_is_gone) {
view.prompt = 'The Tyrant is Gone: Select a space in Romania for the Ceausescus to flee to.'
for (let space_id of game.valid_spaces) {
if (!space_id) continue
@@ -7656,7 +7705,8 @@ states.vm_the_tyrant_is_gone = {
infl(space) {
push_undo()
log(`The Ceausescus flee to %${find_space_index(space)}`)
- game.persistent_events['the_tyrant_is_gone'] = find_space_index(space)
+ game.the_tyrant_is_gone = find_space_index(space)
+ game.persistent_events.push(97)
},
done () {
vm_next()
@@ -7733,7 +7783,7 @@ states.vm_the_wall_must_go = {
},
done() {
if (game.the_wall_must_go['dem_wins'] === 2) {
- game.persistent_events['the_wall_must_go'] = true
+ game.persistent_events.push(86)
log('+3 VP')
game.vp += 3
if (check_vp()) {
@@ -7745,10 +7795,18 @@ states.vm_the_wall_must_go = {
game.valid_spaces.push(space.space_id)
}
}
+ if (!game.vm_infl_to_do) {
+ if (game.round_player === DEM) {
+ game.return = COM
+ } else {
+ game.return = DEM
+ }
+ }
if (game.active === DEM) {next_player()}
vm_next ()
} else {
permanently_remove(86)
+ delete game.the_wall_must_go
vm_return()
}
}
@@ -8008,9 +8066,8 @@ states.vm_tst_6 = {
},
sc(space) {
push_undo()
- //console.log('in vm_valid_spaces_sc: game.persistent_events[we_are_the_people]', game.persistent_events['we_are_the_people'])
game.selected_space = find_space_index(space)
- if (game.active === DEM && game.persistent_events['austria_hungary_border_reopened'] && spaces[space].country === "East_Germany") {
+ if (game.active === DEM && game.persistent_events.includes(58) && spaces[space].country === "East_Germany") {
game.austria_hungary_border_reopened_tracker = true
}
game.state = 'vm_tst_6_sc'
@@ -8219,7 +8276,7 @@ CODE[9] = [ // The Wall*
]
CODE[10] = [ // Cult of Personality
- [ vm_if, ()=>!game.persistent_events['the_tyrant_is_gone'] ],
+ [ vm_if, ()=>!game.the_tyrant_is_gone ],
[ vm_valid_spaces_country_socio_2, 'Romania', 3, 4 ],
[ vm_prompt, 'Worker or Farmer spaces in Romania, no more than 2 per space' ],
[ vm_add_limited_infl, 4, 2 ],
@@ -8446,7 +8503,7 @@ CODE[40] = [ // Hungarian Democratic Forum
]
CODE[41] = [ // Ceausescu*
- [ vm_if, ()=>!game.persistent_events['the_tyrant_is_gone'] ],
+ [ vm_if, ()=>!game.the_tyrant_is_gone ],
[ vm_valid_spaces_country_sc, 'Romania' ],
[ vm_prompt, ' from Romania' ],
[ vm_remove_opp_infl, 3 ],
@@ -8692,7 +8749,6 @@ CODE[73] = [ // Laszlo Tokes*
CODE[74] = [ // FRG Embassies
[ vm_frg_embassies ],
- [ vm_permanently_remove ],
[ vm_return ],
]
@@ -8881,7 +8937,7 @@ CODE[96] = [ // The Chinese Solution*
]
CODE[97] = [ // The Tyrant is Gone*
- [ vm_if, ()=>game.persistent_events['the_crowd_turns_against_ceausescu'] ],
+ [ vm_if, ()=>game.persistent_events.includes(54) ],
[ vm_valid_spaces, 51 ],
[ vm_prompt, 'the Romanian Elite Space' ],
[ vm_remove_x_opp_infl, 4 ],
@@ -8917,7 +8973,7 @@ CODE[100] = [ // Stand Fast*
]
CODE[101] = [ // Elena*
- [ vm_if, ()=>!game.persistent_events['the_tyrant_is_gone'] ],
+ [ vm_if, ()=>!game.the_tyrant_is_gone ],
[ vm_valid_spaces, 51 ],
[ vm_prompt, 'the Romania Elite Space' ],
[ vm_add_x_infl, 2 ],
@@ -8970,7 +9026,7 @@ CODE[106] = [ // Social Democratic Platform Adopted*
]
CODE[107] = [ // Massacre in Timisoara*
- [ vm_if, ()=>!game.persistent_events['the_tyrant_is_gone'] ],
+ [ vm_if, ()=>!game.the_tyrant_is_gone ],
[ vm_massacre_in_timisoara ],
[ vm_valid_spaces_country_sc, 'Romania' ],
[ vm_prompt, 'Make Support Checks in Romania' ],