summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-29 01:26:27 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-29 01:27:36 +0100
commit65320688f373e7675c76a5083eebf6ac3fe1c071 (patch)
treed91741069b64913093cf97f97df5cbe14815749e
parentf323e07043babf1781b4aae57daf282460f85f92 (diff)
download1989-dawn-of-freedom-65320688f373e7675c76a5083eebf6ac3fe1c071.tar.gz
Use "prettier" tool to clean up some indentation and formatting.
-rw-r--r--rules.js1596
1 files changed, 1010 insertions, 586 deletions
diff --git a/rules.js b/rules.js
index 35512ac..08311f9 100644
--- a/rules.js
+++ b/rules.js
@@ -355,7 +355,7 @@ function democrat_setup_2() {
game.starting_infl = [2, 3, 3, 4, 2, 2]
}
-exports.view = function(state, player) {
+exports.view = function (state, player) {
game = state
view = {
@@ -422,12 +422,13 @@ exports.view = function(state, player) {
view.opp_hand = game.communist_hand_red
}
view.set_aside = game.democrat_set_aside /*Is this being used? */
- view.power_hand = [...game.dem_pwr_hand].sort((a, b) => a - b)
-
+ view.power_hand = [ ...game.dem_pwr_hand ].sort((a, b) => a - b)
} else if (player === COM) {
view.hand = game.communist_hand
- if (game.opp_power_hand && game.pwr_struggle_in === 'Romania') {view.opp_power_hand = [...game.dem_pwr_hand].sort((a, b) => a - b) }
- view.power_hand = [...game.com_pwr_hand].sort((a, b) => a - b)
+ if (game.opp_power_hand && game.pwr_struggle_in === 'Romania') {
+ view.opp_power_hand = [ ...game.dem_pwr_hand ].sort((a, b) => a - b)
+ }
+ view.power_hand = [ ...game.com_pwr_hand ].sort((a, b) => a - b)
}
if (player === DEM) {
@@ -514,9 +515,9 @@ states.place_starting_infl = {
gen_action("done")
return
} else if ((game.starting_infl.length === 5 && game.temp > 2) || game.temp > 3) {
- view.prompt = `Place your last ${pluralize(game.available_ops,'starting SP')}.`
+ view.prompt = `Place your last ${pluralize(game.available_ops, 'starting SP')}.`
} else {
- view.prompt = `Place ${pluralize(game.available_ops,'starting SP')}.`
+ view.prompt = `Place ${pluralize(game.available_ops, 'starting SP')}.`
}
for (let space_id of game.valid_spaces) {
gen_action_space(space_id)
@@ -538,13 +539,16 @@ states.place_starting_infl = {
new_turn()
clear_undo()
game.state = 'choose_card'
- }
+ },
}
states.choose_card = {
inactive: 'choose a card.',
prompt() {
- if ((game.active===DEM && game.democrat_hand.length === 0) || game.active === COM && game.communist_hand.length === 0) {
+ if (
+ (game.active === DEM && game.democrat_hand.length === 0) ||
+ (game.active === COM && game.communist_hand.length === 0)
+ ) {
view.prompt = 'No cards remaining: you must pass.'
gen_action('pass')
} else {
@@ -567,7 +571,7 @@ states.choose_card = {
if (!scoring_cards.includes(card)) {
let scoring_cards_count = count_scoring_cards()
- if (game.round !== 8 && scoring_cards_count >= (8-game.round)){
+ if (game.round !== 8 && scoring_cards_count >= 8 - game.round) {
game.temp = card
game.state = 'confirm_card'
return
@@ -578,7 +582,7 @@ states.choose_card = {
pass() {
log('No cards remaining. Passed')
game.state = 'end_round'
- }
+ },
}
states.confirm_card = {
@@ -590,14 +594,14 @@ states.confirm_card = {
},
continue() {
select_card(game.temp)
- }
+ },
}
states.play_card = {
get inactive() {
return `play ${clean_name(cards[game.played_card].name)}.`
},
- prompt () {
+ prompt() {
view.prompt = `Play ${clean_name(cards[game.played_card].name)} for:`
if (scoring_cards.includes(game.played_card)) {
@@ -606,7 +610,7 @@ states.play_card = {
}
// Check for Reformer Rehabilitated
- if (game.played_card === C_REFORMER_REHABILITATED && game.playable_cards.includes(C_REFORMER_REHABILITATED)){
+ if (game.played_card === C_REFORMER_REHABILITATED && game.playable_cards.includes(C_REFORMER_REHABILITATED)) {
if (game.active === DEM && (game.dem_tst_position > game.com_tst_position)) {
gen_action('event')
}
@@ -617,10 +621,32 @@ states.play_card = {
// Check for events
if (event_is_playable(game.played_card)) {
- if ((game.active === DEM && cards[game.played_card].side === 'C' && game.dem_tst_position >= 7 && game.com_tst_position < 7 && !game.tst_7) || (game.active === COM && cards[game.played_card].side === 'D' && game.com_tst_position >= 7 && game.dem_tst_position < 7 && !game.tst_7)){
+ if (
+ (game.active === DEM &&
+ cards[game.played_card].side === 'C' &&
+ game.dem_tst_position >= 7 &&
+ game.com_tst_position < 7 &&
+ !game.tst_7) ||
+ (game.active === COM &&
+ cards[game.played_card].side === 'D' &&
+ game.com_tst_position >= 7 &&
+ game.dem_tst_position < 7 &&
+ !game.tst_7)
+ ) {
gen_action('tst_7')
}
- if ((game.active === DEM && cards[game.played_card].side !== 'C' && game.dem_tst_position >= 8 && game.com_tst_position < 8 && !game.tst_8) || (game.active === COM && cards[game.played_card].side !== 'D' && game.com_tst_position >= 8 && game.dem_tst_position < 8 && !game.tst_8)){
+ if (
+ (game.active === DEM &&
+ cards[game.played_card].side !== 'C' &&
+ game.dem_tst_position >= 8 &&
+ game.com_tst_position < 8 &&
+ !game.tst_8) ||
+ (game.active === COM &&
+ cards[game.played_card].side !== 'D' &&
+ game.com_tst_position >= 8 &&
+ game.dem_tst_position < 8 &&
+ !game.tst_8)
+ ) {
gen_action('tst_8')
}
@@ -631,7 +657,10 @@ states.play_card = {
gen_action('influence')
gen_action('support_check')
- 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)) {
+ 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('tst')
}
},
@@ -641,7 +670,9 @@ states.play_card = {
log_gap(`Played C${game.played_card} for the event`)
game.vm_infl_to_do = false
game.return = game.active
- if (switch_events.includes(game.played_card)) {next_player()}
+ if (switch_events.includes(game.played_card)) {
+ next_player()
+ }
game.vm_event = game.played_card
goto_vm(game.vm_event)
},
@@ -652,8 +683,8 @@ states.play_card = {
game.return = game.active
game.vm_event = game.played_card
if (is_auto_resolve(game.played_card) || switch_events.includes(game.played_card)) {
- goto_vm(game.vm_event)}
- else {
+ goto_vm(game.vm_event)
+ } else {
next_player()
log(`C${game.vm_event}:`)
goto_vm(game.vm_event)
@@ -669,7 +700,7 @@ states.play_card = {
if (game.persistent_events.includes(58)) {
game.austria_hungary_border_reopened_tracker = true
}
- game.state='add_influence'
+ game.state = 'add_influence'
valid_spaces_infl()
},
tst() {
@@ -677,7 +708,7 @@ states.play_card = {
check_ligachev_non_event()
log_gap(`Played C${game.played_card} to the Tiananmen Square Track`)
finish_play_card()
- game.state='tiananmen_square_attempt'
+ game.state = 'tiananmen_square_attempt'
},
support_check() {
push_undo()
@@ -685,10 +716,11 @@ states.play_card = {
log_gap(`Played C${game.played_card} for support checks`)
finish_play_card()
game.available_ops = 2
- game.state='support_check_prep'
+ game.state = 'support_check_prep'
valid_spaces_sc()
},
- tst_7() { /*Cancel opponent event */
+ tst_7() {
+ /*Cancel opponent event */
push_undo()
check_ligachev_non_event()
log(`Played C${game.played_card}. Event cancelled using TST Award`)
@@ -696,7 +728,8 @@ states.play_card = {
game.vm_infl_to_do = true
game.state = 'resolve_opponent_event'
},
- tst_8() { /*Play card for ops and event */
+ tst_8() {
+ /*Play card for ops and event */
push_undo()
game.vm_event_to_do = true
game.vm_infl_to_do = true
@@ -704,9 +737,9 @@ states.play_card = {
log(`Played C${game.played_card} for event and operations`)
game.state = 'vm_tst_8'
},
- end_round () {
+ end_round() {
end_round()
- }
+ },
}
states.resolve_opponent_event = {
@@ -720,7 +753,10 @@ states.resolve_opponent_event = {
gen_action('support_check')
} else if (game.vm_event_to_do) {
// Check for Tiananmen Square Track ability - play opponent card without triggering event
- if ((game.active === DEM && game.dem_tst_position >= 7 && game.com_tst_position < 7 && !game.tst_7) || (game.active === COM && game.com_tst_position >= 7 && game.dem_tst_position < 7 && !game.tst_7)){
+ if (
+ (game.active === DEM && game.dem_tst_position >= 7 && game.com_tst_position < 7 && !game.tst_7) ||
+ (game.active === COM && game.com_tst_position >= 7 && game.dem_tst_position < 7 && !game.tst_7)
+ ) {
gen_action('tst_7')
}
view.prompt = `${clean_name(cards[game.played_card].name)}: you must resolve the opponent event.`
@@ -730,7 +766,7 @@ states.resolve_opponent_event = {
gen_action('end_round')
}
},
- influence(){
+ influence() {
push_undo()
check_ligachev_non_event()
log_gap(`Played C${game.played_card} to place SPs`)
@@ -756,8 +792,8 @@ states.resolve_opponent_event = {
log(`Resolved opponent event C${game.played_card}`)
if (is_auto_resolve(game.played_card) || switch_events.includes(game.played_card)) {
game.return = game.active
- goto_vm(game.vm_event)}
- else {
+ goto_vm(game.vm_event)
+ } else {
if (game.active === DEM) {
game.return = COM
} else {
@@ -777,12 +813,12 @@ states.resolve_opponent_event = {
end_round() {
push_undo()
end_round()
- }
+ },
}
states.add_influence = {
inactive: 'add SPs.',
- prompt () {
+ prompt() {
if (game.available_ops <= 0) {
view.prompt = 'Place SPs: done.'
if (!game.vm_event_to_do) {
@@ -809,25 +845,25 @@ states.add_influence = {
do_log_summary()
reset_austria_hungary_border_reopened()
game.state = 'resolve_opponent_event'
- }
+ },
}
states.tiananmen_square_attempt = {
inactive: 'do Tiananmen Square Attempt.',
- prompt () {
+ prompt() {
view.prompt = 'Tiananmen Square Track attempt: Roll a die.'
gen_action('roll')
},
roll() {
clear_undo()
game.vm_event_to_do = false
- do_tst_attempt ()
- }
+ do_tst_attempt()
+ },
}
states.tiananmen_square_attempt_success = {
inactive: 'do Tiananmen Square Attempt.',
- prompt () {
+ prompt() {
if (game.vm_event > 200) {
view.prompt = 'Tiananmen Square Track attempt successful. Go to TST Award.'
gen_action('done')
@@ -835,39 +871,38 @@ states.tiananmen_square_attempt_success = {
view.prompt = 'Tiananmen Square Track attempt successful.'
gen_action('end_round')
}
-
},
- done () {
+ done() {
push_undo()
goto_vm(game.vm_event)
},
- end_round () {
+ end_round() {
push_undo()
end_round()
- }
+ },
}
states.tiananmen_square_attempt_fail = {
inactive: 'do Tiananmen Square Attempt.',
- prompt () {
+ prompt() {
view.prompt = 'Tiananmen Square Track attempt failed.'
gen_action('end_round')
},
- end_round () {
+ end_round() {
push_undo()
end_round()
- }
+ },
}
states.tiananmen_square_attempt_done = {
inactive: 'do Tiananmen Square Attempt.',
- prompt () {
+ prompt() {
view.prompt = 'Tiananmen Square Track attempt: done.'
gen_action('end_round')
},
- end_round () {
+ end_round() {
end_round()
- }
+ },
}
states.tst_goddess = {
@@ -899,17 +934,29 @@ states.tst_goddess_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)
+ 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)
+ draw_cards(
+ game.strategy_deck,
+ game.democrat_hand,
+ game.communist_hand,
+ game.democrat_hand.length,
+ game.communist_hand.length + 1
+ )
}
end_goddess()
- }
+ },
}
states.support_check_prep = {
inactive: 'do support checks',
- prompt () {
+ prompt() {
if (game.available_ops === 0) {
if (game.is_pwr_struggle) {
view.prompt = 'The Crowd Turns Against Ceausescu. Support checks: done.'
@@ -935,7 +982,11 @@ states.support_check_prep = {
// Check for Austria-Hungary Border Reopened - check on first support check only
if (game.persistent_events.includes(58)) {
if (game.active === DEM && game.available_ops > 1) {
- if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events.includes(58) && game.active === DEM) {
+ if (
+ spaces[game.selected_space].country === 'East_Germany' &&
+ game.persistent_events.includes(58) &&
+ game.active === DEM
+ ) {
game.state = 'austria_hungary_border_reopened_check'
return
}
@@ -950,7 +1001,8 @@ states.support_check_prep = {
},
done() {
push_undo()
- if (game.is_pwr_struggle) {/*Crowd Turns Against Ceausescu should be the only time you end up here during a power struggle */
+ if (game.is_pwr_struggle) {
+ /*Crowd Turns Against Ceausescu should be the only time you end up here during a power struggle */
if (game.return !== game.active) {
next_player()
}
@@ -960,12 +1012,12 @@ states.support_check_prep = {
}
reset_austria_hungary_border_reopened()
game.state = 'resolve_opponent_event'
- }
+ },
}
states.do_support_check = {
inactive: 'do support checks.',
- prompt () {
+ prompt() {
view.prompt = `Support check: ${spaces[game.selected_space].name_unique}. Roll a die.`
gen_action('roll')
},
@@ -982,7 +1034,7 @@ states.do_support_check = {
game.state = 'support_check_prep'
return
}
- }
+ },
}
states.austria_hungary_border_reopened_check = {
@@ -998,7 +1050,7 @@ states.austria_hungary_border_reopened_check = {
},
no() {
game.state = 'do_support_check'
- }
+ },
}
states.end_round = {
@@ -1010,7 +1062,7 @@ states.end_round = {
end_round() {
push_undo()
end_round()
- }
+ },
}
//======================= POWER STRUGGLE ===============================
@@ -1026,12 +1078,12 @@ states.draw_power_cards = {
game.power_struggle_deck = [...all_power_cards]
let presence = check_presence(game.pwr_struggle_in)
if (presence.dem_spaces > 0) {
- game.dem_pwr_hand_limit = 6 + 2*(presence.dem_spaces - 1)
+ game.dem_pwr_hand_limit = 6 + 2 * (presence.dem_spaces - 1)
} else {
game.dem_pwr_hand_limit = 0
}
- if (presence.com_spaces > 0 ) {
- game.com_pwr_hand_limit = 6 + 2*(presence.com_spaces - 1)
+ if (presence.com_spaces > 0) {
+ game.com_pwr_hand_limit = 6 + 2 * (presence.com_spaces - 1)
} else {
game.com_pwr_hand_limit = 0
}
@@ -1059,7 +1111,11 @@ states.draw_power_cards = {
}
}
- if (game.persistent_events.includes(C_NATIONAL_SALVATION_FRONT) && game.dem_pwr_hand_limit >=2 && (game.pwr_struggle_in === 'Romania' || game.pwr_struggle_in === 'Bulgaria')) {
+ if (
+ game.persistent_events.includes(C_NATIONAL_SALVATION_FRONT) &&
+ 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 C${C_NATIONAL_SALVATION_FRONT}`)
game.dem_pwr_hand_limit -= 2
game.com_pwr_hand_limit += 2
@@ -1068,7 +1124,13 @@ states.draw_power_cards = {
// Draw Power Cards
game.is_pwr_struggle = true
- draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand_limit, game.com_pwr_hand_limit)
+ draw_cards(
+ game.power_struggle_deck,
+ game.dem_pwr_hand,
+ game.com_pwr_hand,
+ game.dem_pwr_hand_limit,
+ game.com_pwr_hand_limit
+ )
if (game.active === DEM) {
game.valid_cards = [...game.dem_pwr_hand]
} else {
@@ -1079,7 +1141,11 @@ states.draw_power_cards = {
log(`Democrat: ${game.dem_pwr_hand.length} cards`)
// Check if The Crowd Turns Against Ceausescu occurs
- if (game.persistent_events.includes(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU) && !game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED) && game.pwr_struggle_in === 'Romania') {
+ if (
+ game.persistent_events.includes(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU) &&
+ !game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED) &&
+ game.pwr_struggle_in === 'Romania'
+ ) {
if (game.active === COM) {
game.return = COM
next_player()
@@ -1127,7 +1193,8 @@ states.vm_the_crowd_turns_against_ceausescu = {
delete game.ceausescu_cards
valid_spaces_infl()
game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country === 'Romania')
- game.state = 'the_crowd_turns_against_ceausescu_infl' /* Send this to add_infl. Add check at end of add_infl similar to valid_spaces*/
+ game.state = 'the_crowd_turns_against_ceausescu_infl'
+ /* Send this to add_infl. Add check at end of add_infl similar to valid_spaces*/
},
support_check() {
push_undo()
@@ -1140,9 +1207,8 @@ states.vm_the_crowd_turns_against_ceausescu = {
states.the_crowd_turns_against_ceausescu_infl = {
inactive: 'add SPs.',
- prompt () {
- if (game.vm_available_ops === 0)
- {
+ prompt() {
+ if (game.vm_available_ops === 0) {
view.prompt = 'Place SPs: done.'
gen_action("done")
return
@@ -1163,17 +1229,19 @@ states.the_crowd_turns_against_ceausescu_infl = {
}
log_h2('Raise the Stakes')
game.state = 'raise_stakes_1'
- }
+ },
}
states.raise_stakes_1 = {
inactive: 'raise the stakes.',
- prompt () {
- if ((game.active === DEM && game.dem_pwr_hand.length < 3) || (game.active === COM && game.com_pwr_hand.length < 3)) {
+ prompt() {
+ if (
+ (game.active === DEM && game.dem_pwr_hand.length < 3) ||
+ (game.active === COM && game.com_pwr_hand.length < 3)
+ ) {
view.prompt = 'Raise the stakes: you must pass.'
gen_action('pass')
- }
- else if (game.raised_stakes_discard === 3) {
+ } else if (game.raised_stakes_discard === 3) {
view.prompt = 'Raise the stakes: done.'
gen_action('done')
} else {
@@ -1201,7 +1269,7 @@ states.raise_stakes_1 = {
game.valid_cards = []
}
},
- pass(){
+ pass() {
log('Did not raise the stakes')
game.raised_stakes_discard = 0
next_player()
@@ -1212,7 +1280,7 @@ states.raise_stakes_1 = {
}
game.state = 'raise_stakes_2'
},
- done () {
+ done() {
log_gap('Raised the stakes')
game.raised_stakes_discard = 0
next_player()
@@ -1222,13 +1290,16 @@ states.raise_stakes_1 = {
game.valid_cards = [...game.com_pwr_hand]
}
game.state = 'raise_stakes_2'
- }
+ },
}
states.raise_stakes_2 = {
inactive: 'raise the stakes.',
- prompt () {
- if ((game.active === DEM && game.dem_pwr_hand.length < 3) || (game.active === COM && game.com_pwr_hand.length < 3)) {
+ prompt() {
+ if (
+ (game.active === DEM && game.dem_pwr_hand.length < 3) ||
+ (game.active === COM && game.com_pwr_hand.length < 3)
+ ) {
view.prompt = 'Raise the stakes: you must pass.'
gen_action('pass')
return
@@ -1265,7 +1336,7 @@ states.raise_stakes_2 = {
log('Did not raise the stakes')
goto_struggle()
},
- done () {
+ done() {
log_gap('Raised the stakes')
goto_struggle()
},
@@ -1273,14 +1344,14 @@ states.raise_stakes_2 = {
states.power_struggle = {
inactive: 'play a card.',
- prompt () {
+ prompt() {
if (game.phase === 0) {
if (game.valid_cards.length > 0) {
view.prompt = "Play a card."
for (let card of game.valid_cards) {
gen_action_power_card(card)
}
- } else if ( game.valid_cards.length === 0) {
+ } else if (game.valid_cards.length === 0) {
view.prompt = 'No valid cards. You must concede.'
gen_action('concede')
}
@@ -1296,17 +1367,23 @@ states.power_struggle = {
view.prompt = `${base_prompt} You must concede.`
}
gen_action('concede')
- }
- else if (game.phase === 2) {
+ } else if (game.phase === 2) {
view.prompt = 'You matched. Roll a die.'
gen_action('roll')
- }
- else if (game.phase === 3) {
+ } else if (game.phase === 3) {
view.prompt = 'Play leader as:'
- if (game.tactics_fails !== "Strike") {gen_action('strike')}
- if (game.tactics_fails !== "March") {gen_action('march')}
- if (game.tactics_fails !== "Rally in the Square") {gen_action('rally')}
- if (game.tactics_fails !== "Petition") {gen_action('petition')}
+ if (game.tactics_fails !== 'Strike') {
+ gen_action('strike')
+ }
+ if (game.tactics_fails !== 'March') {
+ gen_action('march')
+ }
+ if (game.tactics_fails !== 'Rally in the Square') {
+ gen_action('rally')
+ }
+ if (game.tactics_fails !== 'Petition') {
+ gen_action('petition')
+ }
}
},
power_card(card) {
@@ -1319,9 +1396,11 @@ states.power_struggle = {
if (game.phase === 1) {
game.power_card_2 = card
}
- game.valid_cards=[]
+ game.valid_cards = []
game.return_state = 'power_struggle'
- if (game.phase === 0) {delete game.proxy_power_card}
+ if (game.phase === 0) {
+ delete game.proxy_power_card
+ }
if (card === PC_TACTIC_FAILS) {
if (game.proxy_power_card) {
log_gap(`Played P${PC_TACTIC_FAILS}: ${game.proxy_power_card} no longer playable`)
@@ -1341,17 +1420,20 @@ states.power_struggle = {
if (leader_cards.includes(card)) {
game.played_power_card = card
game.phase = 3
- } else if (card === 51){ /*Scare Tactics */
+ } else if (card === 51) {
+ /*Scare Tactics */
game.return = ''
goto_vm(351) /*Can I combine these 3 into a single stage where you goto_vm(300 + card) ? */
- } else if (card === 50) { /*Support Surges */
+ } else if (card === 50) {
+ /*Support Surges */
if (game.active === DEM) {
game.return = COM
} else {
game.return = DEM
}
goto_vm(350)
- } else if (game.phase === 0 && card === 49) { /*Support Falters */
+ } else if (game.phase === 0 && card === 49) {
+ /*Support Falters */
next_player()
goto_vm(349)
} else {
@@ -1379,7 +1461,7 @@ states.power_struggle = {
}
}
},
- roll () {
+ roll() {
clear_undo()
let roll = roll_d6()
log(`Roll: D${roll}`)
@@ -1394,7 +1476,7 @@ states.power_struggle = {
do_valid_cards()
}
},
- concede () {
+ concede() {
push_undo()
game.valid_cards = []
delete game.power_card_1
@@ -1409,39 +1491,39 @@ states.power_struggle = {
game.phase = 0
game.state = 'support_loss'
},
- strike () {
+ strike() {
log(`Played: P${game.played_power_card} as a Strike`)
game.proxy_power_card = 'Strike'
game.phase = 1
next_player()
do_valid_cards()
},
- march () {
+ march() {
log(`Played: P${game.played_power_card} as a March`)
game.proxy_power_card = 'March'
game.phase = 1
next_player()
do_valid_cards()
},
- rally () {
+ rally() {
log(`Played: P${game.played_power_card} as a Rally in the Square`)
game.proxy_power_card = 'Rally in the Square'
game.phase = 1
next_player()
do_valid_cards()
},
- petition () {
+ petition() {
log(`Played: P${game.played_power_card} as a Petition`)
game.proxy_power_card = 'Petition'
game.phase = 1
next_player()
do_valid_cards()
- }
+ },
}
states.support_loss = {
inactive: 'do Support Loss.',
- prompt () {
+ prompt() {
let ps_state = game.persistent_events.includes(111) ? "New Year's Eve Party" : "Power Struggle"
if (game.phase === 0) {
view.prompt = 'You lost the Power Struggle. Roll a die for Support Loss.'
@@ -1452,7 +1534,7 @@ states.support_loss = {
for (let space_id of game.valid_spaces) {
gen_action_space(space_id)
}
- } else if (game.phase === 1 && game.available_ops === 0 ) {
+ } else if (game.phase === 1 && game.available_ops === 0) {
view.prompt = `${ps_state} - ${country_name(game.pwr_struggle_in)}. Support Loss: finished.`
gen_action('done')
} else if (game.phase === 1 && game.valid_spaces.length === 0) {
@@ -1460,7 +1542,7 @@ states.support_loss = {
gen_action('done')
}
},
- roll () {
+ roll() {
game.available_ops = support_loss_roll[get_aftermath_roll()]
if (game.available_ops === 0) {
log('Does not remove SPs')
@@ -1474,18 +1556,18 @@ states.support_loss = {
game.remove_opponent_infl = false /* Don't know why this is needed... */
remove_infl(space, 'available_ops')
},
- done () {
+ done() {
do_log_summary()
next_player()
log_h3('Victory Point')
game.phase = 0
game.state = 'vp_roll'
- }
+ },
}
states.vp_roll = {
inactive: 'do VP Roll.',
- prompt () {
+ prompt() {
let ps_state = game.persistent_events.includes(111) ? "New Year's Eve Party" : "Power Struggle"
if (game.phase === 0) {
view.prompt = `${ps_state} - ${country_name(game.pwr_struggle_in)}: roll a die for Victory.`
@@ -1498,7 +1580,7 @@ states.vp_roll = {
gen_action('scoring')
}
},
- roll () {
+ roll() {
let roll = get_aftermath_roll()
let vp_change = vp_roll[roll]
if (game.active === DEM) {
@@ -1506,24 +1588,29 @@ states.vp_roll = {
} else {
log(`-${vp_change} VP`)
}
- if (game.active === DEM) {game.vp += vp_change}
- else {game.vp -= vp_change}
+ if (game.active === DEM) {
+ game.vp += vp_change
+ } else {
+ game.vp -= vp_change
+ }
if (game.active === DEM && roll >= 4) {
game.phase = 1
} else {
game.phase = 0
- if (game.active === DEM) {next_player()}
+ if (game.active === DEM) {
+ next_player()
+ }
game.state = 'choose_power'
}
},
- take () {
+ take() {
push_undo()
let scoring_card = scoring_cards[countries.indexOf(game.pwr_struggle_in)]
permanently_remove(scoring_card)
take_power(game.pwr_struggle_in)
game.phase = 2
},
- scoring () {
+ scoring() {
push_undo()
log_h2('Scoring')
score_country(game.pwr_struggle_in)
@@ -1533,7 +1620,7 @@ states.vp_roll = {
states.choose_power = {
inactive: 'choose whether to remain in power.',
- prompt () {
+ prompt() {
if (game.phase === 0) {
view.prompt = 'Choose whether to remain in power.'
gen_action('retain')
@@ -1548,18 +1635,18 @@ states.choose_power = {
retain_power(game.pwr_struggle_in)
game.phase = 1
},
- surrender () {
+ surrender() {
push_undo()
log(`Communist voluntarily surrenders power`)
take_power(game.pwr_struggle_in)
permanently_remove(game.played_card)
game.phase = 1
},
- scoring () {
+ scoring() {
push_undo()
score_country(game.pwr_struggle_in)
resolve_tyrant()
- }
+ },
}
states.the_tyrant_is_gone = {
@@ -1575,7 +1662,7 @@ states.the_tyrant_is_gone = {
log_h3(`C${C_THE_TYRANT_IS_GONE}`)
game.vm_event = C_THE_TYRANT_IS_GONE
goto_vm(game.vm_event)
- }
+ },
}
states.finish_scoring = {
@@ -1583,7 +1670,7 @@ states.finish_scoring = {
prompt() {
view.prompt = 'End power struggle.'
gen_action('done')
- } ,
+ },
done() {
log_msg_gap('Power Struggle resolved') /*At this point log card dicarded or permanently removed? */
if (game.persistent_events.includes(111)) {
@@ -1595,7 +1682,7 @@ states.finish_scoring = {
}
reset_power()
end_round()
- }
+ },
}
// ======================================= END TURN STATES ==========================================
@@ -1617,16 +1704,13 @@ states.end_turn_4_5_4 = {
if (dem_has_scoring_card && com_has_scoring_card) {
log('Both players have held scoring cards')
goto_game_over('', `The game is tied due to held scoring cards!`)
- }
- else if (dem_has_scoring_card) {
+ } else if (dem_has_scoring_card) {
log('Democrat player has a held scoring card')
goto_game_over(COM, `${COM} won by held scoring card!`)
- }
- else if (com_has_scoring_card) {
+ } else if (com_has_scoring_card) {
log('Communist player has a held scoring card')
goto_game_over(DEM, `${DEM} won by held scoring card!`)
- }
- else if (game.persistent_events.includes(C_NEW_YEARS_EVE_PARTY)) {
+ } else if (game.persistent_events.includes(C_NEW_YEARS_EVE_PARTY)) {
log_h1(`New Year's Eve Party`)
game.vm_event = 104
// Check if the Communist receives VP from The Tyrant is Gone
@@ -1639,8 +1723,7 @@ states.end_turn_4_5_4 = {
next_player()
}
game.state = 'new_years_eve_party'
- }
- else if(game.turn === 10) {
+ } else if (game.turn === 10) {
clear_undo()
log_h2('Final Scoring')
@@ -1650,11 +1733,10 @@ states.end_turn_4_5_4 = {
log(`Communist receives 2 VP from C97`)
}
game.state = 'final_scoring_held'
-
} else {
new_turn()
}
- }
+ },
}
states.final_scoring_held = {
@@ -1666,28 +1748,54 @@ states.final_scoring_held = {
bonus() {
push_undo()
const held_countries = game.revolutions.filter(value => value === false).length
- let vp_gain = 4*held_countries
+ let vp_gain = 4 * held_countries
log(`Communist holds power in ${pluralize(held_countries, 'country', 's')}: -${vp_gain} VP`)
- game.vp -= 4*held_countries
- game.temp = {'East_Germany': false, 'Poland': false, 'Czechoslovakia': false, 'Hungary': false, 'Romania': false, 'Bulgaria': false}
+ game.vp -= 4 * held_countries
+ game.temp = {
+ East_Germany: false,
+ Poland: false,
+ Czechoslovakia: false,
+ Hungary: false,
+ Romania: false,
+ Bulgaria: false,
+ }
game.state = 'final_scoring'
- }
+ },
}
states.final_scoring = {
inactive: 'score countries.',
prompt() {
- if (game.temp['East_Germany'] && game.temp['Poland'] && game.temp['Czechoslovakia'] && game.temp['Hungary'] && game.temp['Romania'] && game.temp['Bulgaria']) {
+ if (
+ game.temp['East_Germany'] &&
+ game.temp['Poland'] &&
+ game.temp['Czechoslovakia'] &&
+ game.temp['Hungary'] &&
+ game.temp['Romania'] &&
+ game.temp['Bulgaria']
+ ) {
view.prompt = 'Final scoring: done.'
gen_action('end')
} else {
view.prompt = 'Choose a country to score:'
- if (!game.temp['East_Germany']) {gen_action('east_germany')}
- if (!game.temp['Poland']) {gen_action('poland')}
- if (!game.temp['Czechoslovakia']) {gen_action('czechoslovakia')}
- if (!game.temp['Hungary']) {gen_action('hungary')}
- if (!game.temp['Romania']) {gen_action('romania')}
- if (!game.temp['Bulgaria']) {gen_action('bulgaria')}
+ if (!game.temp['East_Germany']) {
+ gen_action('east_germany')
+ }
+ if (!game.temp['Poland']) {
+ gen_action('poland')
+ }
+ if (!game.temp['Czechoslovakia']) {
+ gen_action('czechoslovakia')
+ }
+ if (!game.temp['Hungary']) {
+ gen_action('hungary')
+ }
+ if (!game.temp['Romania']) {
+ gen_action('romania')
+ }
+ if (!game.temp['Bulgaria']) {
+ gen_action('bulgaria')
+ }
}
},
east_germany() {
@@ -1723,7 +1831,7 @@ states.final_scoring = {
} else if (game.vp === 0) {
goto_game_over('', `The game is tied!`) /*Not sure what to pass for result */
}
- }
+ },
}
states.game_over = {
@@ -1740,18 +1848,18 @@ states.game_over = {
states.general_strike = {
inactive: 'discard a card.',
prompt() {
- if (game.played_card === 0 ) {
+ if (game.played_card === 0) {
view.prompt = 'General Strike: you must discard a card or play a Scoring Card.'
game.communist_hand
for (let card of game.communist_hand) {
gen_action_card(card)
}
- } else if (game.played_card > 0 ) {
+ } else if (game.played_card > 0) {
view.prompt = 'General Strike: roll a die.'
gen_action('roll')
}
},
- card (card) {
+ card(card) {
push_undo()
game.played_card = card
let find_card
@@ -1811,7 +1919,7 @@ states.honecker = {
log(`C${C_HONECKER}: passed`)
permanently_remove(C_HONECKER)
game.state = 'end_round'
- }
+ },
}
states.new_years_eve_party = {
@@ -1863,7 +1971,7 @@ states.new_years_eve_party = {
game.vm_event = 95
goto_vm(95)
},
- bulgaria () {
+ bulgaria() {
push_undo()
log('Chose to score Bulgaria')
game.vm_event = 43
@@ -1888,7 +1996,7 @@ states.new_years_eve_party = {
} else if (game.vp === 0) {
goto_game_over('', `New Year's Eve Party: The game is tied!`) /*Not sure what to pass for result */
}
- }
+ },
}
states.stasi_end_round = {
@@ -1932,7 +2040,7 @@ states.stasi_confirm_scoring_card = {
continue() {
push_undo()
end_stasi_choose_card()
- }
+ },
}
states.stasi_finish = {
@@ -1944,7 +2052,7 @@ states.stasi_finish = {
done() {
push_undo()
end_stasi_choose_card()
- }
+ },
}
states.stasi_confirm = {
@@ -1961,7 +2069,7 @@ states.stasi_confirm = {
states.stasi_play_card = {
inactive: 'play a card.',
- prompt () {
+ prompt() {
if (game.democrat_hand.length === 0) {
view.prompt = 'Stasi: you must pass.'
gen_action('pass')
@@ -1984,23 +2092,23 @@ states.stasi_play_card = {
game.state = 'play_card'
}
},
- pass () {
+ pass() {
log('No cards remaining. Passed')
//end_round()
game.state = 'end_round'
},
- done () {
+ done() {
if (game.democrat_hand.includes(C_COMMON_EUROPEAN_HOME)) {
game.state = 'stasi_resolve_common_european_home'
} else {
game.state = 'play_card'
}
- }
+ },
}
states.stasi_resolve_common_european_home = {
inactive: 'play a card.',
- prompt () {
+ prompt() {
view.prompt = `Stasi: play ${clean_name(cards[game.played_card].name)} with Common European Home?`
gen_action('yes')
gen_action('no')
@@ -2014,7 +2122,7 @@ states.stasi_resolve_common_european_home = {
},
no() {
game.state = 'play_card'
- }
+ },
}
// ==================== SUPPORTING STATE FUNCTIONS =============================
@@ -2025,13 +2133,18 @@ function add_infl(space, ops) {
// If AHBR - check AHBR conditions
if (game.persistent_events.includes(58)) {
- if (spaces[space].country !== 'East_Germany'){
+ if (spaces[space].country !== 'East_Germany') {
game.austria_hungary_border_reopened_tracker = false
}
}
// Check Genscher
- if (game.persistent_events.includes(C_GENSCHER) && game.active === DEM && spaces[space].country === 'East_Germany' && check_com_control(space)) {
+ if (
+ game.persistent_events.includes(C_GENSCHER) &&
+ game.active === DEM &&
+ spaces[space].country === 'East_Germany' &&
+ check_com_control(space)
+ ) {
game[ops]--
log_summary(`(-1 op due to C${C_GENSCHER})`)
} else if (check_opp_control(space)) {
@@ -2053,7 +2166,12 @@ function add_infl(space, ops) {
check_tyrant()
// Check Austria Hungary Border Reopened is true and condition has been met
- if (game[ops] === 0 && game.active === DEM && game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) && game.austria_hungary_border_reopened_tracker) {
+ if (
+ game[ops] === 0 &&
+ game.active === DEM &&
+ game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) &&
+ game.austria_hungary_border_reopened_tracker
+ ) {
game[ops] ++
log('+1 op from C58')
game.austria_hungary_border_reopened_tracker = false
@@ -2077,7 +2195,7 @@ function add_infl(space, ops) {
}
// Clear valid spaces if no IP remaining.
- if (game[ops] <= 0 ) {
+ if (game[ops] <= 0) {
game.valid_spaces = []
}
}
@@ -2115,8 +2233,12 @@ function remove_infl(space, ops) {
check_tyrant()
}
game[ops]--
- if (game.vm_influence_added && game.vm_influence_added[space] >= 0) {game.vm_influence_added[space]++}
- if (game[ops]===0) {game.valid_spaces = []}
+ if (game.vm_influence_added && game.vm_influence_added[space] >= 0) {
+ game.vm_influence_added[space]++
+ }
+ if (game[ops] === 0) {
+ game.valid_spaces = []
+ }
}
function do_sc(space) {
@@ -2131,24 +2253,24 @@ function do_sc(space) {
logi(`No adjacency for Democrats due to C${C_THE_WALL}`)
log_gap(`Roll: D${roll}`)
}
+
// Continue with Support Check Logic
- else { log(`Roll: D${roll}`) }
+ else {
+ log(`Roll: D${roll}`)
+ }
// Check for the Crowd Turns Against Ceausescu
-
if (game.is_pwr_struggle) {
roll += game.vm_available_ops
logi(`+${game.vm_available_ops} from Ceausescu`)
}
// Check if in Tiananmen Square Track Award
-
else if (game.state === 'vm_tst_6_sc') {
roll += get_tst_6_ops()
roll += 2
logi('+2 TST award')
- }
- else {
+ } else {
let card_ops = get_card_ops(this_card())
roll += card_ops
logi(`+${card_ops} from card ops`)
@@ -2166,15 +2288,26 @@ function do_sc(space) {
permanently_remove(C_TEAR_GAS)
game.persistent_events = game.persistent_events.filter(n => n !== C_TEAR_GAS)
}
- if (game.active === DEM && spaces[space].region === 'Eastern Europe' && game.persistent_events.includes(C_FRG_EMBASSIES)) {
+ if (
+ game.active === DEM &&
+ spaces[space].region === 'Eastern Europe' &&
+ game.persistent_events.includes(C_FRG_EMBASSIES)
+ ) {
roll++
logi(`+1 from C${C_FRG_EMBASSIES}`)
}
- if (game.active === DEM && spaces[space].country === 'East_Germany' && game.persistent_events.includes(C_GRENZTRUPPEN)) {
+ if (
+ game.active === DEM &&
+ spaces[space].country === 'East_Germany' &&
+ game.persistent_events.includes(C_GRENZTRUPPEN)
+ ) {
roll--
logi(`-1 from C${C_GRENZTRUPPEN}`)
}
- if ((game.active === COM && game.stand_fast === DEM && check_dem_control(space)) || (game.active === DEM && game.stand_fast === COM && check_com_control(space))){
+ if (
+ (game.active === COM && game.stand_fast === DEM && check_dem_control(space)) ||
+ (game.active === DEM && game.stand_fast === COM && check_com_control(space))
+ ) {
roll--
logi(`-1 from C${C_STAND_FAST}`)
}
@@ -2182,7 +2315,11 @@ function do_sc(space) {
roll--
logi(`-1 from C${C_ELENA}`)
}
- if (game.active === DEM && game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) && game.austria_hungary_border_reopened_tracker) {
+ if (
+ game.active === DEM &&
+ game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) &&
+ game.austria_hungary_border_reopened_tracker
+ ) {
roll++
logi(`+1 from C${C_AUSTRIA_HUNGARY_BORDER_REOPENED}`)
}
@@ -2199,9 +2336,9 @@ function do_sc(space) {
}
permanently_remove(C_THE_WALL)
- // Standard adjacency
} else {
- if (adj.dem_adj > 0 || adj.com_adj > 0 ){
+ // Standard adjacency
+ if (adj.dem_adj > 0 || adj.com_adj > 0) {
if (game.active === DEM) {
roll += adj.dem_adj
roll -= adj.com_adj
@@ -2231,7 +2368,7 @@ function do_sc(space) {
const change_infl = Math.max(0, roll - stability*2)
if (change_infl > 0) {
log_msg_gap(`Change influence: ${change_infl} SP`)
- if(game.active === DEM) {
+ if (game.active === DEM) {
if (change_infl > game.comInfl[space]) {
const residual = change_infl - game.comInfl[space]
game.comInfl[space] = 0
@@ -2260,7 +2397,11 @@ function do_sc(space) {
log_msg_gap('Change influence: 0 SP')
}
// Check VP awards
- if (game.active === COM && game.persistent_events.includes(C_HELSINKI_FINAL_ACT) && (spaces[space].socio === 5 || spaces[space].socio === 6) ) {
+ if (
+ game.active === COM &&
+ game.persistent_events.includes(C_HELSINKI_FINAL_ACT) &&
+ (spaces[space].socio === 5 || spaces[space].socio === 6)
+ ) {
log('+1 VP from C26')
game.vp ++
}
@@ -2280,7 +2421,7 @@ function do_sc(space) {
}
// If Austria-Hungary Border Reopened used, all future support checks must be in East Germany
- if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)){
+ if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) {
if (game.austria_hungary_border_reopened_tracker) {
game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country === 'East_Germany')
}
@@ -2310,21 +2451,30 @@ function valid_spaces_setup() {
function valid_spaces_sc() {
let valid_spaces_set = new Set()
- for (let i = 0 ; i < spaces.length; i++) {
+ for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
if (game.active === DEM) {
let infl = game.comInfl[i]
- if (infl !== 0 ) {
+ if (infl !== 0) {
valid_spaces_set.add(space.space_id)
}
} else {
let infl = game.demInfl[i]
- if (infl !== 0 ) {
+ if (infl !== 0) {
// Check Events that block support checks in a given space
- if (game.persistent_events.includes(C_SOLIDARITY_LEGALIZED) && space.space_id === S_GDANSK) {continue}
- if (game.persistent_events.includes(C_WE_ARE_THE_PEOPLE) && space.space_id === S_LEIPZIG) {continue}
- if (game.persistent_events.includes(C_FOREIGN_CURRENCY_DEBT_BURDEN) && space.country === game.foreign_currency_debt_burden) {continue}
+ if (game.persistent_events.includes(C_SOLIDARITY_LEGALIZED) && space.space_id === S_GDANSK) {
+ continue
+ }
+ if (game.persistent_events.includes(C_WE_ARE_THE_PEOPLE) && space.space_id === S_LEIPZIG) {
+ continue
+ }
+ if (
+ game.persistent_events.includes(C_FOREIGN_CURRENCY_DEBT_BURDEN) &&
+ space.country === game.foreign_currency_debt_burden
+ ) {
+ continue
+ }
valid_spaces_set.add(space.space_id)
}
@@ -2333,8 +2483,12 @@ 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.includes(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU)) {
- game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country === 'Romania')
+ if (
+ game.is_pwr_struggle &&
+ game.pwr_struggle_in === 'Romania' &&
+ game.persistent_events.includes(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU)
+ ) {
+ game.valid_spaces = game.valid_spaces.filter((n) => spaces[n].country === 'Romania')
}
return game.valid_spaces
}
@@ -2445,7 +2599,8 @@ function do_valid_cards() {
if (game.active === DEM) {
valid_cards(game.dem_pwr_hand, presence.dem_leaders)
} else {
- valid_cards(game.com_pwr_hand, presence.com_leaders)}
+ valid_cards(game.com_pwr_hand, presence.com_leaders)
+ }
}
function count_adj(space_id) {
@@ -2509,8 +2664,8 @@ function do_tst_attempt() {
// TIANANMEN SQUARE MODIFIERS
- if (game.active === DEM && game.dem_tst_attempted === 1 || game.active === COM && game.com_tst_attempted === 1) {
- roll ++
+ if ((game.active === DEM && game.dem_tst_attempted === 1) || (game.active === COM && game.com_tst_attempted === 1)) {
+ roll++
logi('+1 from previous TST attempts')
}
if (game.active === DEM && game.dem_tst_position >= 1 && game.com_tst_position === 0) {
@@ -2521,8 +2676,11 @@ function do_tst_attempt() {
roll ++
logi('+1 from TST award')
}
- if ((game.active === DEM && cards[game.played_card].side === 'D') || (game.active === COM && cards[game.played_card].side === 'C')) {
- roll ++
+ if (
+ (game.active === DEM && cards[game.played_card].side === 'D') ||
+ (game.active === COM && cards[game.played_card].side === 'C')
+ ) {
+ roll++
logi('+1 for playing own card')
}
if (game.active === COM && game.persistent_events.includes(53)) {
@@ -2558,15 +2716,18 @@ function do_tst_attempt() {
}
// Check if TST events occur
- if (game.dem_tst_position === 3 && game.com_tst_position < 3) {game.vm_event = 203}
- else if (game.dem_tst_position === 4 && game.com_tst_position < 4) {game.vm_event = 204}
+ if (game.dem_tst_position === 3 && game.com_tst_position < 3) {
+ game.vm_event = 203
+ } else if (game.dem_tst_position === 4 && game.com_tst_position < 4) {
+ game.vm_event = 204
+ }
game.state = 'tiananmen_square_attempt_success'
} else {
log(`${dem_tst_req[game.dem_tst_position]} required: fail`)
game.dem_tst_attempted = 1
game.state = 'tiananmen_square_attempt_fail'
}
- } else {
+ } else {
game.com_tst_attempted_this_turn = 1
if (roll >= com_tst_req[game.com_tst_position]) {
log(`${com_tst_req[game.com_tst_position]} required: success`)
@@ -2590,8 +2751,11 @@ function do_tst_attempt() {
}
// Check if TST events occur
- if (game.com_tst_position === 3 && game.dem_tst_position < 3) {game.vm_event = 203}
- else if (game.com_tst_position === 4 && game.dem_tst_position < 4) {game.vm_event = 204}
+ if (game.com_tst_position === 3 && game.dem_tst_position < 3) {
+ game.vm_event = 203
+ } else if (game.com_tst_position === 4 && game.dem_tst_position < 4) {
+ game.vm_event = 204
+ }
game.state = 'tiananmen_square_attempt_success'
} else {
log(`${com_tst_req[game.com_tst_position]} required: fail`)
@@ -2654,15 +2818,15 @@ function check_presence(country) {
dem_control: dem_control,
com_control: com_control,
dem_leaders: dem_leaders,
- com_leaders: com_leaders
+ com_leaders: com_leaders,
}
}
function battlegrounds(country) {
let battlegrounds = 0
- if (country === "Hungary") {
+ if (country === 'Hungary') {
battlegrounds = 4
- } else if (country === "Bulgaria") {
+ } else if (country === 'Bulgaria') {
battlegrounds = 5
} else {
battlegrounds = 6
@@ -2676,9 +2840,9 @@ function take_power(country) {
game.times_held[find_country_index(country)] = 1
}
-function retain_power(country){
+function retain_power(country) {
game.times_held[find_country_index(country)]++
- let vp_gain = get_value(country)*game.times_held[find_country_index(country)]
+ let vp_gain = get_value(country) * game.times_held[find_country_index(country)]
log(`Chooses to retain power`)
log(`-${vp_gain} VP`)
game.vp -= vp_gain
@@ -2689,10 +2853,10 @@ function score_country(country) {
// Get scoring values
let value_presence = get_value(country)
- let value_domination = value_presence*2
+ let value_domination = value_presence * 2
let value_control
- if (country !== "Hungary") {
- value_control = value_presence*3
+ if (country !== 'Hungary') {
+ value_control = value_presence * 3
} else {
value_control = 4
}
@@ -2708,8 +2872,7 @@ function score_country(country) {
if (presence.dem_control) {
logi(`Control: +${value_control} VP`)
dem_vp += value_control
- }
- else {
+ } else {
logi(`Domination: +${value_domination} VP`)
dem_vp += value_domination
}
@@ -2721,7 +2884,7 @@ function score_country(country) {
if (presence.com_spaces > 0) {
logi(`Presence: -${value_presence} VP`)
com_vp -= value_presence
- if (presence.com_battlegrounds >0) {
+ if (presence.com_battlegrounds > 0) {
logi(`Battlegrounds: -${presence.com_battlegrounds} VP`)
com_vp -= presence.com_battlegrounds
}
@@ -2729,14 +2892,12 @@ function score_country(country) {
} else {
log('No presence: 0 VP')
}
- }
- else if (presence.com_control || presence.com_domination) {
+ } else if (presence.com_control || presence.com_domination) {
log('Communist:')
if (presence.com_control) {
logi(`Control: -${value_control} VP`)
com_vp -= value_control
- }
- else {
+ } else {
logi(`Domination: -${value_domination} VP`)
com_vp -= value_domination
}
@@ -2752,7 +2913,7 @@ function score_country(country) {
logi(`Battlegrounds: +${presence.dem_battlegrounds} VP`)
dem_vp += presence.dem_battlegrounds
}
- log (`Total: +${dem_vp} VP`)
+ log(`Total: +${dem_vp} VP`)
} else {
log('No presence: 0 VP')
}
@@ -2794,7 +2955,7 @@ function score_country(country) {
// Calculate change VP
let change_vp = dem_vp + com_vp
game.vp += change_vp
- if (change_vp > 0 ) {
+ if (change_vp > 0) {
log_gap(`Scoring: +${change_vp} VP`)
} else {
log_gap(`Scoring: ${change_vp} VP`)
@@ -2803,9 +2964,12 @@ function score_country(country) {
function get_value(country) {
let value
- if (country === "East_Germany" || country === "Poland") {value = 3}
- else if (country === "Czechoslovakia" || country === "Romania") {value = 2}
- else value = 1
+ if (country === 'East_Germany' || country === 'Poland') {
+ value = 3
+ } else if (country === 'Czechoslovakia' || country === 'Romania') {
+ value = 2
+ } else
+ value = 1
return value
}
@@ -2824,8 +2988,12 @@ function get_aftermath_roll() {
log(`Roll: D${roll}`)
let rally_win = 0
let petition_win = 0
- 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}
+ 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
// Special check for Yakovlev Counsels Gobachev. Applies only if Democrat wins, so only if Com is doing support loss and if Dem is doing VP roll
@@ -2840,8 +3008,11 @@ function get_aftermath_roll() {
modified_roll ++
}
}
- if (modified_roll < 0) {modified_roll = 0}
- else if (modified_roll > 7) {modified_roll = 7}
+ if (modified_roll < 0) {
+ modified_roll = 0
+ } else if (modified_roll > 7) {
+ modified_roll = 7
+ }
if (game.raised_stakes !== 0) {
logi(`+${game.raised_stakes} from Raising the Stakes`)
@@ -2861,7 +3032,9 @@ function get_aftermath_roll() {
function add_to_persistent_events(card) {
game.persistent_events.push(card)
remove_from_discard(card)
- if (is_auto_resolve(card)) {log_gap(`C${card}:`)}
+ if (is_auto_resolve(card)) {
+ log_gap(`C${card}:`)
+ }
}
function permanently_remove(card) {
@@ -2876,7 +3049,7 @@ function check_vp() {
if (game.vp >= 20) {
goto_game_over(DEM, `${DEM} won an Automatic Victory!`)
return true
- } else if(game.vp <= -20) {
+ } else if (game.vp <= -20) {
goto_game_over(COM, `${COM} won an Automatic Victory!`)
return true
}
@@ -2893,7 +3066,7 @@ function goto_game_over(result, victory) {
return
}
-function goto_struggle(){
+function goto_struggle() {
game.raised_stakes_discard = 0
game.valid_cards = []
log_h2('Play Cards')
@@ -2939,7 +3112,8 @@ function end_goddess() {
}
}
-function check_reformer() { /*Is this function still used?*/
+function check_reformer() {
+ /*Is this function still used?*/
if (game.dem_tst_position !== game.com_tst_position) {
if (!game.playable_cards.includes(67)) {
game.playable_cards.push(67)
@@ -2959,7 +3133,7 @@ function count_scoring_cards() {
return scoring_check
}
-function select_card(card){
+function select_card(card) {
game.played_card = card
game.temp = 0
let find_card
@@ -3004,63 +3178,73 @@ function is_auto_resolve(card) {
let ceausecu_events = [10, 41, 69, 101, 107]
if (auto_resolve_events.includes(card)) {
return true
- }
- else if (card === C_THE_TYRANT_IS_GONE) {
+ } else if (card === C_THE_TYRANT_IS_GONE) {
if (game.persistent_events.includes(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU)) {
return true
}
- }
- else if (ceausecu_events.includes(card) && game.persistent_events.includes(THE_TYRANT_IS_GONE_OCCURRED)) {
+ } else if (ceausecu_events.includes(card) && game.persistent_events.includes(THE_TYRANT_IS_GONE_OCCURRED)) {
return true
- }
- else if (card === C_KOHL_PROPOSES_REUNIFICATION && !game.persistent_events.includes(C_THE_WALL_MUST_GO)) {
+ } else if (card === C_KOHL_PROPOSES_REUNIFICATION && !game.persistent_events.includes(C_THE_WALL_MUST_GO)) {
return true
- }
- else if (card === C_BROUGHT_IN_FOR_QUESTIONING && game.active === DEM) {
+ } else if (card === C_BROUGHT_IN_FOR_QUESTIONING && game.active === DEM) {
if (game.democrat_hand.length === 0) {
- if (!game.state.startsWith('vm')) { logi('Democrat has no cards to discard') }
- return true }
- }
- else if (card === C_DEUTSCHE_MARKS && game.active === DEM) {
+ if (!game.state.startsWith('vm')) {
+ logi('Democrat has no cards to discard')
+ }
+ return true
+ }
+ } else if (card === C_DEUTSCHE_MARKS && game.active === DEM) {
if (game.democrat_hand.length === 0) {
- if (!game.state.startsWith('vm')) { logi('Democrat has no cards to give') }
- return true }
- }
- else if (card === C_KISS_OF_DEATH && game.active === COM) {
+ if (!game.state.startsWith('vm')) {
+ logi('Democrat has no cards to give')
+ }
+ return true
+ }
+ } else if (card === C_KISS_OF_DEATH && game.active === COM) {
if (game.communist_hand.length === 0) {
- if (!game.state.startsWith('vm')) { logi('Communist has no cards to discard') }
- return true }
- }
- else if (card === C_DISSIDENT_ARRESTED && game.active === DEM) {
- let dem_intellectual_infl = spaces.filter(space => space.socio === 5 && game.demInfl[space.space_id] > 0).length
+ if (!game.state.startsWith('vm')) {
+ logi('Communist has no cards to discard')
+ }
+ return true
+ }
+ } else if (card === C_DISSIDENT_ARRESTED && game.active === DEM) {
+ let dem_intellectual_infl = spaces.filter((space) => space.socio === 5 && game.demInfl[space.space_id] > 0).length
if (dem_intellectual_infl === 0) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
} else if ((card === C_SAJUDIS || card === C_THE_BALTIC_WAY) && game.active === COM) {
- if (game.systematization && game.systematization === S_HARGHITA_COVASNA ) {
+ if (game.systematization && game.systematization === S_HARGHITA_COVASNA) {
if (check_dem_control(S_RAZGRAD)) {
- if (!game.state.startsWith('vm')) { logi('Minorities spaces already controlled') }
+ if (!game.state.startsWith('vm')) {
+ logi('Minorities spaces already controlled')
+ }
return true
}
} else if (check_dem_control(S_RAZGRAD) && check_dem_control(S_HARGHITA_COVASNA)) {
- if (!game.state.startsWith('vm')) { logi('Minorities spaces already controlled') }
+ if (!game.state.startsWith('vm')) {
+ logi('Minorities spaces already controlled')
+ }
return true
}
} else if (card === C_CEAUSESCU && game.active === DEM) {
let dem_romania_infl = spaces.filter(space => space.country === 'Romania' && game.demInfl[space.space_id] > 0).length
if (dem_romania_infl === 0) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
- }
- else if (card === C_WE_ARE_THE_PEOPLE && game.active === COM) {
+ } else if (card === C_WE_ARE_THE_PEOPLE && game.active === COM) {
if (game.demInfl[S_LUTHERAN_CHURCH] === 0) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
- }
- else if (card === C_BETRAYAL && game.active === DEM) {
+ } else if (card === C_BETRAYAL && game.active === DEM) {
if (!game.systematization === S_ORTHODOX_CHURCH_ROMANIA) {
if (game.demInfl[S_ORTHODOX_CHURCH_BULGARIA] === 0) {
if (!game.state.startsWith('vm')) { logi('No influence to remove') }
@@ -3070,26 +3254,33 @@ function is_auto_resolve(card) {
if (!game.state.startsWith('vm')) { logi('No influence to remove') }
return true
}
- }
- else if (card === C_GOVERNMENT_RESIGNS && game.active === COM) {
+ } else if (card === C_GOVERNMENT_RESIGNS && game.active === COM) {
let uncontrolled_elites = spaces.filter( space => spaces[space.space_id].socio === 1 && game.comInfl[space.space_id] > 0 && !check_control(space.space_id)).length
if (uncontrolled_elites === 0) {
- if (!game.state.startsWith('vm')) { logi('No uncontrolled Elite spaces') }
+ if (!game.state.startsWith('vm')) {
+ logi('No uncontrolled Elite spaces')
+ }
return true
}
} else if (card === C_ST_NICHOLAS_CHURCH && game.active === COM) {
if (check_dem_control(S_LUTHERAN_CHURCH)) {
- if (!game.state.startsWith('vm')) { logi('Lutheran Church already controlled') }
+ if (!game.state.startsWith('vm')) {
+ logi('Lutheran Church already controlled')
+ }
return true
}
} else if (card === C_BULGARIAN_TURKS_EXPELLED && game.active === DEM) {
- if (game.demInfl[S_RAZGRAD] === 0 ) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (game.demInfl[S_RAZGRAD] === 0) {
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
} else if (card === C_NORMALIZATION && game.active === DEM) {
- if (game.demInfl[S_PRAHA] === 0 && game.demInfl[S_PLZEN] === 0 ) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (game.demInfl[S_PRAHA] === 0 && game.demInfl[S_PLZEN] === 0) {
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
} else if (card === C_DOMINO_THEORY) {
@@ -3101,60 +3292,79 @@ function is_auto_resolve(card) {
} else if (card === C_UNION_OF_DEMOCRATIC_FORCES && game.active === COM) {
let bulgarian_presence = spaces.filter(space => space.country === 'Bulgaria' && game.comInfl[space.space_id] > 0).length
if (bulgarian_presence === 0) {
- if (!game.state.startsWith('vm')) { logi('No SPs to remove') }
+ if (!game.state.startsWith('vm')) {
+ logi('No SPs to remove')
+ }
return true
}
} else if (card === C_EXIT_VISAS && game.active === COM) {
if (game.democrat_hand.length === 0) {
- if (!game.state.startsWith('vm')) { logi('Democrat has no cards to discard') }
+ if (!game.state.startsWith('vm')) {
+ logi('Democrat has no cards to discard')
+ }
return true
}
} else if (card === C_SAMIZDAT && game.active === COM) {
if (game.democrat_hand.length === 0) {
- if (!game.state.startsWith('vm')) { logi('Democrat has no cards to set aside') }
+ if (!game.state.startsWith('vm')) {
+ logi('Democrat has no cards to set aside')
+ }
return true
}
} else if (card === C_SPITZEL && game.active === DEM) {
let dem_germany_infl = spaces.filter(space => space.country === 'East_Germany' && game.demInfl[space.space_id] > 0).length
if (dem_germany_infl === 0) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
} else if (card === C_MY_FIRST_BANANA && game.active === COM) {
let com_germany_infl = spaces.filter(space => space.country === 'East_Germany' && game.comInfl[space.space_id] > 0).length
if (com_germany_infl === 0) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
} else if (card === C_POLITBURO_INTRIGUE && game.active === DEM) {
let dem_bulgaria_infl = spaces.filter(space => space.country === 'Bulgaria' && game.demInfl[space.space_id] > 0).length
if (dem_bulgaria_infl === 0) {
- if (!game.state.startsWith('vm')) { logi('No influence to remove') }
+ if (!game.state.startsWith('vm')) {
+ logi('No influence to remove')
+ }
return true
}
} else if (card === C_SOLIDARITY_LEGALIZED) {
let uncontrolled_worker_farmer = vm_valid_spaces_solidarity_legalised()
if (uncontrolled_worker_farmer.length === 0) {
- if (!game.state.startsWith('vm')) { logi('No uncontrolled Worker or Farmer spaces in Poland') }
+ if (!game.state.startsWith('vm')) {
+ logi('No uncontrolled Worker or Farmer spaces in Poland')
+ }
return true
}
- }
- else {
+ } else {
return false
}
}
-function get_events(card){
+function get_events(card) {
if (event_is_playable(card)) {
if (cards[card].side === 'D') {
- if (game.active === DEM) {gen_action('event')}
- if (game.active === COM) {gen_action('opp_event')}
- }
- else if (cards[card].side === 'C') {
- if (game.active === COM) {gen_action('event')}
- if (game.active === DEM) {gen_action('opp_event')}
- }
- else {
+ if (game.active === DEM) {
+ gen_action('event')
+ }
+ if (game.active === COM) {
+ gen_action('opp_event')
+ }
+ } else if (cards[card].side === 'C') {
+ if (game.active === COM) {
+ gen_action('event')
+ }
+ if (game.active === DEM) {
+ gen_action('opp_event')
+ }
+ } else {
gen_action('event')
}
}
@@ -3191,27 +3401,49 @@ 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 === 'vm_common_european_home_play' || 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_common_european_home_play' || 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' || game.state === 'vm_common_european_home_play') {
+ 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' ||
+ 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_common_european_home_play' || game.state === 'vm_laszlo_tokes') {
+ if (game.active === DEM && game.prudence && game.prudence.DEM !== 0) {
+ 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 {
@@ -3228,7 +3460,11 @@ function get_card_ops(card) {
}
if (game.active === COM && game.prudence && game.prudence.COM < 0) {
- if(game.state === 'choose_card' || game.state === 'general_strike' || game.state === 'vm_common_european_home_play') {
+ 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) {
@@ -3239,7 +3475,8 @@ function get_card_ops(card) {
if (ops < 1) {
ops = 1
}
- } return ops
+ }
+ return ops
}
function get_tst_6_ops() {
@@ -3252,7 +3489,7 @@ function get_tst_6_ops() {
logi(`+1 op from C${C_THE_SINATRA_DOCTRINE}`)
ops ++
}
- if ((game.active === DEM && game.prudence && game.prudence.DEM !== 0)) {
+ if (game.active === DEM && game.prudence && game.prudence.DEM !== 0) {
if (ops > 0) {
log(`${pluralize(game.prudence.DEM,'op')} from C${C_PRUDENCE}`)
} else {
@@ -3295,7 +3532,10 @@ function finish_play_card() {
// Check if card is opponent card with event that needs to be resolved
if (cards[game.played_card].playable || game.playable_cards.includes(game.played_card)) {
- if ((game.active === DEM && cards[game.played_card].side === "C" ) || (game.active === COM && cards[game.played_card].side === "D")) {
+ if (
+ (game.active === DEM && cards[game.played_card].side === 'C') ||
+ (game.active === COM && cards[game.played_card].side === 'D')
+ ) {
game.vm_event_to_do = true
}
}
@@ -3312,13 +3552,15 @@ function finish_the_wall() {
}
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
- if (space.country === 'East_Germany' && game.comInfl[i] > 0){
+ if (space.country === 'East_Germany' && game.comInfl[i] > 0) {
game.valid_spaces.push(space.space_id)
}
}
- if (game.active === DEM) {next_player()}
+ if (game.active === DEM) {
+ next_player()
+ }
game.return = COM
- vm_next ()
+ vm_next()
} else {
permanently_remove(C_THE_WALL_MUST_GO)
delete game.the_wall_must_go
@@ -3343,7 +3585,8 @@ function finish_we_are_the_people() {
function end_round() {
// Check if the game is over! WHY IS THIS NEEDED?
if (game.state === 'game_over') {
- return}
+ return
+ }
// Check if the card needs to be discarded.
let discard_check = [...game.strategy_removed, ...game.persistent_events]
@@ -3401,7 +3644,7 @@ function end_round() {
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) {
+ } else if (game.turn <= 7) {
if (card_check.length !== 81) {
console.log('wrong number of cards in game', card_check)
throw new Error(`Wrong number of cards: ${card_check.length}`)
@@ -3416,14 +3659,13 @@ 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.includes(C_HONECKER)) {
+ if (game.persistent_events.includes(C_HONECKER)) {
if (game.active !== COM) {
next_player()
}
game.state = 'honecker'
return
- }
- else if (game.dem_tst_position >= 6 && game.com_tst_position <= 5) {
+ } else if (game.dem_tst_position >= 6 && game.com_tst_position <= 5) {
if (game.active !== DEM) {
next_player()
}
@@ -3441,8 +3683,7 @@ function end_round() {
game.return_state = 'end_turn_4_5_4'
goto_vm(206)
return
- }
- else {
+ } else {
clear_undo()
game.state = 'end_turn_4_5_4'
return
@@ -3451,7 +3692,7 @@ function end_round() {
// Resolve end action round
// Stasi check
- if(game.round_player === COM && game.persistent_events.includes(C_STASI)) {
+ if (game.round_player === COM && game.persistent_events.includes(C_STASI)) {
// If in Honecker, turn ends
if (game.round === 8) {
clear_undo()
@@ -3481,7 +3722,7 @@ function end_round() {
return
}
// Normal round end
- else if (game.round_player===COM) {
+ else if (game.round_player === COM) {
game.round_player = DEM
if (game.active !== DEM) {
next_player()
@@ -3493,14 +3734,14 @@ function end_round() {
}
if (game.round_player === DEM) {
- if(game.persistent_events.includes(C_STASI)) {
+ if (game.persistent_events.includes(C_STASI)) {
if (game.active !== DEM) {
next_player()
}
log_h3('C13')
game.state = 'stasi_end_round'
return
- } else if(game.round_player === DEM && game.persistent_events.includes(C_GENERAL_STRIKE)){
+ } else if (game.round_player === DEM && game.persistent_events.includes(C_GENERAL_STRIKE)) {
game.state = 'general_strike'
game.round ++
log_h2(`Action Round ${game.round}`)
@@ -3526,13 +3767,17 @@ function new_turn() {
clear_undo()
game.turn ++
game.round = 1
- game.valid_spaces=[]
+ game.valid_spaces = []
game.active = COM
game.round_player = COM
game.dem_tst_attempted_this_turn = 0
game.com_tst_attempted_this_turn = 0
- if (game.tst_7) {game.tst_7 = false}
- if (game.tst_8) {game.tst_8 = false}
+ if (game.tst_7) {
+ game.tst_7 = false
+ }
+ if (game.tst_8) {
+ game.tst_8 = false
+ }
delete game.selected_space
// Remove events that only last one turn
@@ -3554,15 +3799,19 @@ function new_turn() {
delete game.stasi_card
delete game.stand_fast
- if (game.samizdat_card > 0 ) {
+ if (game.samizdat_card > 0) {
game.democrat_hand.push(game.samizdat_card)
delete game.samizdat_card
}
log_h1("Turn " + game.turn)
- if (game.turn === 4) { add_midyear() }
- if (game.turn === 8) { add_lateyear() }
+ if (game.turn === 4) {
+ add_midyear()
+ }
+ if (game.turn === 8) {
+ add_lateyear()
+ }
if (game.turn > 1) {
if (game.persistent_events.includes(C_PRESIDENTIAL_VISIT)) {
@@ -3576,15 +3825,22 @@ function new_turn() {
}
// Check if TST effects need to be resolved
- if ((game.dem_tst_position >=5 && game.com_tst_position <= 4) || (game.com_tst_position >= 5 && game.dem_tst_position <= 4)) {
+ if (
+ (game.dem_tst_position >= 5 && game.com_tst_position <= 4) ||
+ (game.com_tst_position >= 5 && game.dem_tst_position <= 4)
+ ) {
log_h2('Tiananmen Square Track Award')
- if ((game.dem_tst_position >= 5 && game.com_tst_position <= 4 && game.active !== DEM) || (game.com_tst_position >= 5 && game.dem_tst_position <= 4 && game.active !== COM)) {
+ if (
+ (game.dem_tst_position >= 5 && game.com_tst_position <= 4 && game.active !== DEM) ||
+ (game.com_tst_position >= 5 && game.dem_tst_position <= 4 && game.active !== COM)
+ ) {
next_player()
}
- let hand = game.dem_tst_position >=5 ? game.democrat_hand : game.communist_hand
+ let hand = game.dem_tst_position >= 5 ? game.democrat_hand : game.communist_hand
for (let card of hand) {
- if (scoring_cards.includes(card)) continue
+ if (scoring_cards.includes(card))
+ continue
game.valid_cards.push(card)
}
game.state = 'tst_goddess'
@@ -3594,8 +3850,7 @@ function new_turn() {
if (game.persistent_events.includes(5)) {
log_h3('C5')
game.state = 'general_strike'
- }
- else {
+ } else {
game.state = 'choose_card'
}
}
@@ -3779,8 +4034,8 @@ function reset_power() {
delete game.view_opp_power_hand
let scoring_events = [C_PEASANT_PARTIES_REVOLT, C_YAKOVLEV_COUNSELS_GORBACHEV, C_THE_CROWD_TURNS_AGAINST_CEAUSESCU]
- for (let e of scoring_events ) {
- if (e === C_THE_CROWD_TURNS_AGAINST_CEAUSESCU ) {
+ for (let e of scoring_events) {
+ if (e === C_THE_CROWD_TURNS_AGAINST_CEAUSESCU) {
if (game.persistent_events.includes(e) && game.pwr_struggle_in === 'Romania') {
permanently_remove(e)
}
@@ -3802,7 +4057,11 @@ function check_tyrant() {
}
function resolve_tyrant() {
- if (game.persistent_events.includes(C_THE_TYRANT_IS_GONE) && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED)) {
+ if (
+ game.persistent_events.includes(C_THE_TYRANT_IS_GONE) &&
+ game.pwr_struggle_in === 'Romania' &&
+ game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED)
+ ) {
game.return_state = 'finish_scoring'
if (game.active !== DEM) {
next_player()
@@ -3813,7 +4072,8 @@ function resolve_tyrant() {
}
}
-function check_systematization() { /* Check for Systematization - may not use this space */
+function check_systematization() {
+ /* Check for Systematization - may not use this space */
if (game.systematization > 0) {
game.valid_spaces = game.valid_spaces.filter(n => n !== game.systematization)
}
@@ -4046,7 +4306,7 @@ function vm_next() {
vm_exec()
}
-function vm_logi(){
+function vm_logi() {
logi(vm_operand(1))
vm_next()
}
@@ -4139,26 +4399,29 @@ function vm_return() {
vm_end_event()
}
// Check if auto-resolve opponent event
- else if (is_auto_resolve(game.played_card) && ((cards[game.played_card].side === 'C' && game.active === DEM) || (cards[game.played_card].side === 'D' && game.active === COM) )) {
+ else if (
+ is_auto_resolve(game.played_card) &&
+ ((cards[game.played_card].side === 'C' && game.active === DEM) ||
+ (cards[game.played_card].side === 'D' && game.active === COM))
+ ) {
vm_end_event()
- }
- else {
+ } else {
game.state = 'vm_end_event'
}
}
function vm_end_event() {
if (game.return !== game.active) {
- next_player()}
+ next_player()
+ }
if (game.return_state === 'power_struggle') {
do_valid_cards()
}
if (game.return_state && game.return_state !== '') {
game.state = game.return_state
- }
- else if (game.vm_infl_to_do) {
- game.state = 'resolve_opponent_event'}
- else {
+ } else if (game.vm_infl_to_do) {
+ game.state = 'resolve_opponent_event'
+ } else {
end_round()
}
}
@@ -4177,7 +4440,7 @@ function vm_valid_spaces() {
vm_next()
}
-function vm_valid_spaces_opponent () {
+function vm_valid_spaces_opponent() {
let valid_spaces = []
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
@@ -4198,7 +4461,7 @@ function vm_valid_spaces_opponent () {
vm_next()
}
-function vm_valid_spaces_socio () {
+function vm_valid_spaces_socio() {
let valid_spaces = []
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
@@ -4211,7 +4474,7 @@ function vm_valid_spaces_socio () {
vm_next()
}
-function vm_valid_spaces_opponent_socio () {
+function vm_valid_spaces_opponent_socio() {
let valid_spaces = []
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
@@ -4232,10 +4495,13 @@ function vm_valid_spaces_opponent_socio () {
vm_next()
}
-function vm_valid_spaces_country () {
+function vm_valid_spaces_country() {
let country
- if (vm_operand(1)) {country = vm_operand(1)}
- else {country = game.vm_active_country}
+ if (vm_operand(1)) {
+ country = vm_operand(1)
+ } else {
+ country = game.vm_active_country
+ }
for (let space of spaces) {
if (space.country === country) {
game.valid_spaces.push(space.space_id)
@@ -4245,25 +4511,25 @@ function vm_valid_spaces_country () {
vm_next()
}
-function vm_valid_spaces_sc () {
+function vm_valid_spaces_sc() {
valid_spaces_sc()
vm_next()
}
-function vm_valid_spaces_country_opp () {
+function vm_valid_spaces_country_opp() {
let country = ''
if (vm_operand(1)) {
- country = vm_operand(1) }
- else {
+ country = vm_operand(1)
+ } else {
country = game.vm_active_country
}
for (let space of spaces) {
if (game.active === DEM) {
- if (space.country === country && game.comInfl[space.space_id] >0) {
+ if (space.country === country && game.comInfl[space.space_id] > 0) {
game.valid_spaces.push(space.space_id)
}
} else {
- if (space.country === country && game.demInfl[space.space_id]>0) {
+ if (space.country === country && game.demInfl[space.space_id] > 0) {
game.valid_spaces.push(space.space_id)
}
}
@@ -4271,11 +4537,11 @@ function vm_valid_spaces_country_opp () {
vm_next()
}
-function vm_valid_spaces_country_sc () {
+function vm_valid_spaces_country_sc() {
let active_country
if (vm_operand(1)) {
- active_country = vm_operand(1) }
- else {
+ active_country = vm_operand(1)
+ } else {
active_country = game.vm_active_country
}
valid_spaces_sc()
@@ -4285,8 +4551,12 @@ function vm_valid_spaces_country_sc () {
function vm_valid_spaces_country_socio_2() {
for (let space of spaces) {
- 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))) {
+ 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)
}
}
@@ -4296,7 +4566,8 @@ function vm_valid_spaces_country_socio_2() {
function vm_valid_spaces_region_socio() {
let valid_spaces = []
for (let space of spaces) {
- if (space.space_id === game.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)
}
@@ -4309,7 +4580,10 @@ function vm_valid_spaces_region_opp() {
let valid_spaces = []
for (let space of spaces) {
let s = space.space_id
- if ((game.active === DEM && space.region === vm_operand(1) && game.comInfl[s] > 0 ) || (game.active === COM && space.region === vm_operand(1) && game.demInfl[s] > 0 )) {
+ if (
+ (game.active === DEM && space.region === vm_operand(1) && game.comInfl[s] > 0) ||
+ (game.active === COM && space.region === vm_operand(1) && game.demInfl[s] > 0)
+ ) {
valid_spaces.push(space.space_id)
}
}
@@ -4321,8 +4595,11 @@ function vm_valid_spaces_solidarity_legalised() {
let valid_spaces = []
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
- let uncontrolled = (!check_control(i) && !check_opp_control(i))
- if ((space.country === 'Poland' && uncontrolled && space.socio === 3) || (space.country === 'Poland' && uncontrolled && space.socio === 4)) {
+ let uncontrolled = !check_control(i) && !check_opp_control(i)
+ if (
+ (space.country === 'Poland' && uncontrolled && space.socio === 3) ||
+ (space.country === 'Poland' && uncontrolled && space.socio === 4)
+ ) {
valid_spaces.push(space.space_id)
}
}
@@ -4376,12 +4653,16 @@ function vm_do_add_infl_free(space) {
}
function vm_add_infl() {
- if (vm_operand(1)) {game.vm_available_ops = vm_operand(1)}
+ if (vm_operand(1)) {
+ game.vm_available_ops = vm_operand(1)
+ }
game.state = 'vm_add_infl'
}
function vm_add_infl_free() {
- if (vm_operand(1)) {game.vm_available_ops = vm_operand(1)}
+ if (vm_operand(1)) {
+ game.vm_available_ops = vm_operand(1)
+ }
game.state = 'vm_add_infl_free'
}
@@ -4434,7 +4715,9 @@ function vm_do_add_limited_infl(space, max_infl) {
game.valid_spaces = game.valid_spaces.filter(id => id !== space)
}
check_tyrant()
- if (game.vm_available_ops === 0) {game.valid_spaces = [] }
+ if (game.vm_available_ops === 0) {
+ game.valid_spaces = []
+ }
}
function vm_remove_infl() {
@@ -4540,7 +4823,9 @@ function vm_do_remove_limited_infl(space, max_infl) {
}
check_tyrant()
- if (game.vm_available_ops === 0) {game.valid_spaces = []}
+ if (game.vm_available_ops === 0) {
+ game.valid_spaces = []
+ }
}
function vm_remove_all_infl() {
@@ -4604,7 +4889,7 @@ function vm_support_check_modified() {
game.state = 'vm_support_check_prep'
}
-function vm_switch_infl(id){
+function vm_switch_infl(id) {
push_undo()
game.demInfl[id] -= game.vm_available_ops
game.comInfl[id] += game.vm_available_ops
@@ -4616,8 +4901,11 @@ function vm_switch_infl(id){
/* ===================== EVENT SPECIFIC FUNCTIONS ========== */
function vm_40th_anniversary_celebration() {
- if (game.vp < 0 ) {game.vm_available_ops = 4}
- else {game.vm_available_ops = 2}
+ if (game.vp < 0) {
+ game.vm_available_ops = 4
+ } else {
+ game.vm_available_ops = 2
+ }
vm_next()
}
@@ -4657,8 +4945,12 @@ function vm_austria_hungary_border_reopened() {
}
function vm_betrayal() {
- if (game.demInfl[S_ORTHODOX_CHURCH_ROMANIA] > 0 ) { game.valid_spaces.push(S_ORTHODOX_CHURCH_ROMANIA) }
- if (game.demInfl[S_ORTHODOX_CHURCH_BULGARIA] >0 ) { game.valid_spaces.push(S_ORTHODOX_CHURCH_BULGARIA) }
+ if (game.demInfl[S_ORTHODOX_CHURCH_ROMANIA] > 0) {
+ game.valid_spaces.push(S_ORTHODOX_CHURCH_ROMANIA)
+ }
+ if (game.demInfl[S_ORTHODOX_CHURCH_BULGARIA] > 0) {
+ game.valid_spaces.push(S_ORTHODOX_CHURCH_BULGARIA)
+ }
game.state = 'vm_switch_infl'
}
@@ -4671,8 +4963,12 @@ function vm_breakaway_baltic_republics() {
}
game.playable_cards.push(C_KREMLIN_COUP)
game.playable_cards = game.playable_cards.filter(n => n !== C_GORBACHEV_CHARMS_THE_WEST)
- if (!check_dem_control(S_HARGHITA_COVASNA) && game.systematization !== S_HARGHITA_COVASNA) {game.valid_spaces.push(S_HARGHITA_COVASNA)}
- if (!check_dem_control(S_RAZGRAD)) {game.valid_spaces.push(S_RAZGRAD)}
+ if (!check_dem_control(S_HARGHITA_COVASNA) && game.systematization !== S_HARGHITA_COVASNA) {
+ game.valid_spaces.push(S_HARGHITA_COVASNA)
+ }
+ if (!check_dem_control(S_RAZGRAD)) {
+ game.valid_spaces.push(S_RAZGRAD)
+ }
vm_next()
}
@@ -4684,7 +4980,7 @@ function vm_brought_in_for_questioning() {
game.state = 'vm_brought_in_for_questioning'
}
-function vm_bulgarian_turks_expelled(){
+function vm_bulgarian_turks_expelled() {
game.remove_opponent_infl = true
game.vp -= 2
log('-2VP')
@@ -4697,18 +4993,27 @@ function vm_bulgarian_turks_expelled(){
function vm_ceausescu() {
let adj_cluj = false
- if (game.demInfl[S_TIMISOARA] > 0 ) {adj_cluj = true}
- if (game.demInfl[S_BABES_BOLYAI_UNIVERSITY] > 0 ) {adj_cluj = true}
- if (game.demInfl[S_ORTHODOX_CHURCH_ROMANIA] > 0 ) {adj_cluj = true}
- if (game.demInfl[S_BUCURESTI] > 0 ) {adj_cluj = true}
+ if (game.demInfl[S_TIMISOARA] > 0) {
+ adj_cluj = true
+ }
+ if (game.demInfl[S_BABES_BOLYAI_UNIVERSITY] > 0) {
+ adj_cluj = true
+ }
+ if (game.demInfl[S_ORTHODOX_CHURCH_ROMANIA] > 0) {
+ adj_cluj = true
+ }
+ if (game.demInfl[S_BUCURESTI] > 0) {
+ adj_cluj = true
+ }
- if (adj_cluj && game.comInfl[S_BUCURESTI]>0) {
+ if (adj_cluj && game.comInfl[S_BUCURESTI] > 0) {
game.valid_spaces = [S_BUCURESTI]
game.vm_available_ops = 1
game.remove_opponent_infl = false
game.state = 'vm_remove_infl'
+ } else {
+ vm_next()
}
- else {vm_next()}
}
function vm_central_committee_reshuffle() {
@@ -4732,8 +5037,8 @@ function vm_civic_forum() {
}
}
-function vm_cluj_check(){
- if (game.comInfl[S_CLUJ_NAPOCA] > 0 ) {
+function vm_cluj_check() {
+ if (game.comInfl[S_CLUJ_NAPOCA] > 0) {
game.valid_spaces.push(S_CLUJ_NAPOCA)
}
vm_next()
@@ -4786,7 +5091,9 @@ function vm_deutsche_marks() {
function vm_domino_theory() {
game.discard = true
for (let card of game.strategy_discard) {
- if (scoring_cards.includes(card)) {game.valid_cards.push(card) }
+ if (scoring_cards.includes(card)) {
+ game.valid_cards.push(card)
+ }
}
game.phase = 0
game.state = 'vm_play_event_from_discard'
@@ -4807,13 +5114,14 @@ function vm_eco_glasnost() {
vm_next()
}
-function vm_elena(){
+function vm_elena() {
add_to_persistent_events(C_ELENA)
logi(`-1 modifier to Democratic Support checks in Romania for the rest of this turn`)
vm_next()
}
-function vm_eliminate(space_id) { // Eliminate the democrat influence and move the communist influence to Bucuresti
+function vm_eliminate(space_id) {
+ // Eliminate the democrat influence and move the communist influence to Bucuresti
log(`Eliminated %${space_id}`)
if (space_id === S_BUCURESTI) {
game.demInfl[space_id] = 0
@@ -4858,9 +5166,12 @@ function vm_foreign_currency_debt_burden() {
}
function vm_foreign_television() {
- for (let i = 0 ; i < spaces.length; i++) {
- if (i === S_DRESDEN) {continue} /*Does not apply to Dresden*/
- if (game.comInfl[i] > 0 ) {
+ for (let i = 0; i < spaces.length; i++) {
+ if (i === S_DRESDEN) {
+ /* Does not apply to Dresden */
+ continue
+ }
+ if (game.comInfl[i] > 0) {
game.valid_spaces.push(i)
}
}
@@ -4921,10 +5232,13 @@ function vm_grenztruppen() {
function vm_heal_our_bleeding_wounds() {
let change_vp = 0
- if (game.turn <= 3) {change_vp = -3 }
- else if (game.turn <= 7) {change_vp = -1}
- else change_vp = 3
- if (change_vp >0) {
+ if (game.turn <= 3) {
+ change_vp = -3
+ } else if (game.turn <= 7) {
+ change_vp = -1
+ } else
+ change_vp = 3
+ if (change_vp > 0) {
log(`+${change_vp} VP`)
} else {
log(`-${change_vp} VP`)
@@ -4948,8 +5262,8 @@ function vm_honecker() {
game.valid_cards = []
for (let c of game.strategy_discard) {
if (scoring_cards.includes(c)) {
- continue}
- else {
+ continue
+ } else {
game.valid_cards.push(c)
}
}
@@ -4966,13 +5280,13 @@ function vm_inflationary_currency_discard() {
// Switch player and check the hand of their opponent to see if the have cards with ops > 3 to discard
next_player()
if (game.active === COM) {
- for (let card of game.communist_hand){
+ for (let card of game.communist_hand) {
if (get_card_ops(card) >= 3) {
game.valid_cards.push(card)
}
}
} else {
- for (let card of game.democrat_hand){
+ for (let card of game.democrat_hand) {
if (get_card_ops(card) >= 3) {
game.valid_cards.push(card)
}
@@ -4986,7 +5300,9 @@ function vm_kiss_of_death() {
}
function vm_klaus_and_komarek() {
- if (game.comInfl[S_PRAHA] > 0 ) {game.valid_spaces = [S_PRAHA]}
+ if (game.comInfl[S_PRAHA] > 0) {
+ game.valid_spaces = [ S_PRAHA ]
+ }
vm_next()
}
@@ -5040,7 +5356,7 @@ function vm_legacy_of_martial_law() {
function vm_legacy_of_1968() {
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
- if ((!check_com_control(i) && space.country === 'Czechoslovakia')) {
+ if (!check_com_control(i) && space.country === 'Czechoslovakia') {
game.valid_spaces.push(space.space_id)
}
}
@@ -5076,7 +5392,7 @@ function vm_modrow() {
game.state = 'vm_modrow'
}
-function vm_nagy_reburied(){
+function vm_nagy_reburied() {
if (game.comInfl[S_SZOMBATHELY] > 0) {
game.valid_spaces.push(S_SZOMBATHELY)
}
@@ -5102,8 +5418,12 @@ function vm_nomenklatura() {
}
function vm_normalization() {
- if (game.demInfl[S_PLZEN] >0) {game.valid_spaces.push(S_PLZEN)}
- if (game.demInfl[S_PRAHA] > 0) {game.valid_spaces.push(S_PRAHA)}
+ if (game.demInfl[S_PLZEN] > 0) {
+ game.valid_spaces.push(S_PLZEN)
+ }
+ if (game.demInfl[S_PRAHA] > 0) {
+ game.valid_spaces.push(S_PRAHA)
+ }
game.remove_opponent_infl = true
vm_next()
}
@@ -5157,31 +5477,38 @@ function vm_presidential_visit() {
function vm_prudence() {
if (!game.prudence) {
- game.prudence = {DEM: 0, COM: 0}
+ game.prudence = { DEM: 0, COM: 0 }
}
if (game.active === DEM) {
- game.prudence.COM --
+ game.prudence.COM--
log(`${game.prudence.COM} to Communist Ops this turn`)
} else {
- game.prudence.DEM --
- log(`${game.prudence.DEM} to Democrat Ops this turn`)}
+ game.prudence.DEM--
+ log(`${game.prudence.DEM} to Democrat Ops this turn`)
+ }
vm_next()
}
function vm_public_against_violence() {
game.valid_spaces = []
- if (game.comInfl[S_BRATISLAVA] > 0 ) {game.valid_spaces.push(S_BRATISLAVA)}
+ if (game.comInfl[S_BRATISLAVA] > 0) {
+ game.valid_spaces.push(S_BRATISLAVA)
+ }
vm_next()
}
-function vm_reformer_rehabilitated () {
+function vm_reformer_rehabilitated() {
permanently_remove(C_REFORMER_REHABILITATED)
game.discard = true
for (let card of game.strategy_discard) {
- if (!event_is_playable(card)) continue
- if (card === game.played_card) continue
- if (card === C_COMMON_EUROPEAN_HOME) continue
- if (scoring_cards.includes(card)) continue
+ if (!event_is_playable(card))
+ continue
+ if (card === game.played_card)
+ continue
+ if (card === C_COMMON_EUROPEAN_HOME)
+ continue
+ if (scoring_cards.includes(card))
+ continue
game.valid_cards.push(card)
}
@@ -5241,12 +5568,12 @@ function vm_solidarity_legalised() {
vm_next()
}
-function vm_solidarity_legalised_spaces(){
+function vm_solidarity_legalised_spaces() {
game.valid_spaces = vm_valid_spaces_solidarity_legalised()
vm_next()
}
-function vm_st_nicholas_church () {
+function vm_st_nicholas_church() {
add_to_persistent_events(C_ST_NICHOLAS_CHURCH)
logi(`Allows play of C${C_THE_MONDAY_DEMONSTRATIONS}`)
game.playable_cards.push(C_THE_MONDAY_DEMONSTRATIONS)
@@ -5266,7 +5593,8 @@ function vm_stand_fast() {
game.stand_fast = DEM
} else {
logi(`-1 Modifier to Support Checks in Communist controlled spaces for the rest of this turn`)
- game.stand_fast = COM}
+ game.stand_fast = COM
+ }
vm_next()
}
@@ -5288,20 +5616,17 @@ function vm_tank_column() {
game.vm_event = 203
goto_vm(game.vm_event)
return
- }
- else if (game.dem_tst_position === 4 && game.com_tst_position < 4) {
+ } else if (game.dem_tst_position === 4 && game.com_tst_position < 4) {
game.vm_event = 204
goto_vm(game.vm_event)
return
}
-
} else {
if (game.com_tst_position === 3 && game.dem_tst_position < 3) {
game.vm_event = 203
goto_vm(game.vm_event)
return
- }
- else if (game.com_tst_position === 4 && game.dem_tst_position < 4) {
+ } else if (game.com_tst_position === 4 && game.dem_tst_position < 4) {
game.vm_event = 204
goto_vm(game.vm_event)
return
@@ -5310,7 +5635,7 @@ function vm_tank_column() {
vm_next()
}
-function vm_tear_gas () {
+function vm_tear_gas() {
add_to_persistent_events(C_TEAR_GAS)
logi(`+1 modifier to the next Communist Support Check in a Student space`)
vm_next()
@@ -5329,8 +5654,12 @@ function vm_the_baltic_way_prep() {
}
function vm_the_baltic_way() {
- if (!check_dem_control(S_HARGHITA_COVASNA) && game.systematization !== S_HARGHITA_COVASNA) {game.valid_spaces.push(S_HARGHITA_COVASNA)}
- if (!check_dem_control(S_RAZGRAD) ) {game.valid_spaces.push(S_RAZGRAD)}
+ if (!check_dem_control(S_HARGHITA_COVASNA) && game.systematization !== S_HARGHITA_COVASNA) {
+ game.valid_spaces.push(S_HARGHITA_COVASNA)
+ }
+ if (!check_dem_control(S_RAZGRAD)) {
+ game.valid_spaces.push(S_RAZGRAD)
+ }
vm_next()
}
@@ -5346,8 +5675,12 @@ function vm_the_crowd_turns_against_ceausescu() {
}
function vm_the_monday_demonstrations() {
- if (!check_dem_control(S_LUTHERAN_CHURCH)) {game.valid_spaces.push(S_LUTHERAN_CHURCH)}
- if (!check_dem_control(S_LEIPZIG)) {game.valid_spaces.push(S_LEIPZIG)}
+ if (!check_dem_control(S_LUTHERAN_CHURCH)) {
+ game.valid_spaces.push(S_LUTHERAN_CHURCH)
+ }
+ if (!check_dem_control(S_LEIPZIG)) {
+ game.valid_spaces.push(S_LEIPZIG)
+ }
vm_next()
}
@@ -5373,7 +5706,9 @@ function vm_the_tyrant_is_gone() {
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
if (game.demInfl[i] === 0 && space.country === 'Romania') {
- if (space.space_id === game.systematization) {continue}
+ if (space.space_id === game.systematization) {
+ continue
+ }
game.valid_spaces.push(space.space_id)
}
}
@@ -5391,7 +5726,7 @@ function vm_tyrant_block() {
vm_next()
}
-function vm_the_wall () {
+function vm_the_wall() {
add_to_persistent_events(C_THE_WALL)
logi(`Cancels the modifier for any Democratic controlled spaces for the next Communist Support Check in East Germany`)
vm_next()
@@ -5411,7 +5746,9 @@ function vm_warsaw_pact_summit() {
}
function vm_we_are_the_people() {
- if (game.demInfl[S_LUTHERAN_CHURCH] > 0) {game.valid_spaces = [S_LUTHERAN_CHURCH]}
+ if (game.demInfl[S_LUTHERAN_CHURCH] > 0) {
+ game.valid_spaces = [ S_LUTHERAN_CHURCH ]
+ }
add_to_persistent_events(C_WE_ARE_THE_PEOPLE)
logi(`The Communist may no longer make Support Checks in Leipzig`)
if (!game.vm_influence_added) {
@@ -5447,7 +5784,7 @@ function vm_yakovlev_counsels_gorbachev() {
vm_next()
}
-function vm_permanently_remove () {
+function vm_permanently_remove() {
// Check if the event is being played as the result of another card, e.g. Dash for the West, is a card which should be removed, and which hasn't already been removed!
if (game.vm_event !== 0 && cards[game.vm_event].remove && !game.strategy_removed.includes(game.vm_event)) {
permanently_remove(game.vm_event)
@@ -5504,7 +5841,7 @@ function vm_support_falters() {
}
function vm_kremlin_coup_elite() {
- game.valid_spaces=[]
+ game.valid_spaces = []
elite_spaces.forEach(space => {
if (spaces[space].country === game.vm_active_country && !check_com_control(space)) {
game.valid_spaces.push(space)
@@ -5519,7 +5856,7 @@ states.vm_end_event = {
get inactive() {
return `resolve ${clean_name(cards[this_card()].name)}.`
},
- prompt () {
+ prompt() {
view.prompt = `${clean_name(cards[this_card()].name)}: done.`
if (game.vm_infl_to_do || game.return_state === 'vm_tst_8') {
gen_action('done')
@@ -5535,18 +5872,18 @@ states.vm_end_event = {
push_undo()
game.return_state = ''
vm_end_event()
- }
+ },
}
states.vm_take_control = {
get inactive() {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
- prompt () {
+ prompt() {
if (game.vm_available_ops > 0 && game.valid_spaces.length === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: all spaces controlled. Continue.`
gen_action('done')
- } else if (game.vm_available_ops > 0 ) {
+ } else if (game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: take control of ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
gen_action_space(space_id)
@@ -5576,17 +5913,16 @@ states.vm_take_control = {
end_round() {
push_undo()
vm_next()
- }
+ },
}
states.vm_add_infl = {
inactive: 'add Support Points.',
- prompt () {
- if (game.vm_available_ops > 0 && game.valid_spaces.length === 0 ) {
+ prompt() {
+ if (game.vm_available_ops > 0 && game.valid_spaces.length === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}. No available spaces remaining. Add SPs: done.`
gen_action('done')
- }
- else if (game.vm_available_ops > 0 ) {
+ } else if (game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: add ${pluralize(game.vm_available_ops,'SP')}${event_prompt()}.`
for (let space_id of game.valid_spaces) {
@@ -5605,7 +5941,7 @@ states.vm_add_infl = {
vm_next()
}
},
- done () {
+ done() {
push_undo()
do_log_summary()
game.vm_event_done = true
@@ -5616,18 +5952,18 @@ states.vm_add_infl = {
do_log_summary()
game.vm_event_done = true
vm_next()
- }
+ },
}
states.vm_add_infl_free = {
get inactive() {
return `resolve ${clean_name(cards[this_card()].name)}: add SPs.`
},
- prompt () {
- if (game.vm_available_ops > 0 && game.valid_spaces.length === 0 ) {
+ prompt() {
+ if (game.vm_available_ops > 0 && game.valid_spaces.length === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}. No available spaces remaining. Add SPs: done.`
gen_action('done')
- } else if (game.vm_available_ops > 0 ) {
+ } else if (game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_available_ops} SPs to ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
@@ -5646,32 +5982,31 @@ states.vm_add_infl_free = {
vm_next()
}
},
- done () {
+ done() {
push_undo()
game.valid_spaces = []
game.vm_event_done = true
do_log_summary()
vm_next()
},
- end_round () {
+ end_round() {
push_undo()
game.valid_spaces = []
game.vm_event_done = true
do_log_summary()
vm_next()
- }
+ },
}
states.vm_add_x_infl = {
get inactive() {
return `resolve ${clean_name(cards[this_card()].name)}: add Support Points.`
},
- prompt () {
+ prompt() {
if (game.vm_event === 101 && game.valid_spaces.length === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: the Romanian Elite space no longer exists.`
gen_action('done')
- }
- else if (game.vm_available_ops > 0 ) {
+ } else if (game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: Add ${game.vm_available_ops} SPs to ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
@@ -5687,18 +6022,18 @@ states.vm_add_x_infl = {
vm_next()
}
},
- done () {
+ done() {
push_undo()
game.vm_event_done = true
vm_next()
- }
+ },
}
states.vm_add_limited_infl = {
get inactive() {
return `resolve ${clean_name(cards[this_card()].name)}: add Support Points.`
},
- prompt () {
+ prompt() {
if (game.vm_available_ops > 0 && game.valid_spaces.length > 0) {
if (game.vm_max_infl === 1) {
view.prompt = `${clean_name(cards[this_card()].name)}: add ${pluralize(game.vm_max_infl,'SP')} ${event_prompt()}.`
@@ -5724,14 +6059,14 @@ states.vm_add_limited_infl = {
states.vm_remove_infl = {
inactive: 'remove Support Points.',
- prompt () {
+ prompt() {
// Keep this so that there is an undo option in, e.g., Scare Tactics
if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no further SPs to remove.`
gen_action('done')
return
}
- if (game.vm_available_ops === 0 ) {
+ if (game.vm_available_ops === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}. Remove SPs: done.`
gen_action('done')
return
@@ -5751,7 +6086,7 @@ states.vm_remove_infl = {
game.vm_active_country = spaces[space].country
let require_done = [C_INFLATIONARY_CURRENCY, C_THE_WALL_MUST_GO]
if (!require_done.includes(game.vm_event)) {
- if (game.vm_available_ops === 0 ) {
+ if (game.vm_available_ops === 0) {
do_log_summary()
vm_next()
}
@@ -5765,14 +6100,14 @@ states.vm_remove_infl = {
log('No influence to remove')
}
vm_next()
- }
+ },
}
states.vm_remove_x_infl = {
get inactive() {
return `resolve ${clean_name(cards[this_card()].name)}: remove SP from ${event_prompt()}.`
},
- prompt () {
+ prompt() {
if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no SPs to remove.`
gen_action('done')
@@ -5791,15 +6126,15 @@ states.vm_remove_x_infl = {
vm_next()
}
},
- done () {
+ done() {
game.vm_event_done = true
vm_next()
- }
+ },
}
states.vm_remove_limited_infl = {
inactive: 'remove SP.',
- prompt () {
+ prompt() {
if (game.vm_available_ops > 0 && game.valid_spaces.length > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: remove ${pluralize(game.vm_available_ops,'SP')}${event_prompt()}, no more than ${game.vm_max_infl} per space.`
@@ -5819,16 +6154,16 @@ states.vm_remove_limited_infl = {
vm_next()
}
},
- done () {
+ done() {
game.vm_event_done = true
do_log_summary()
vm_next()
- }
+ },
}
states.vm_remove_all_infl = {
inactive: 'remove Support Points',
- prompt () {
+ prompt() {
if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no SPs to remove.`
gen_action('pass')
@@ -5849,12 +6184,12 @@ states.vm_remove_all_infl = {
pass() {
push_undo()
vm_next()
- }
+ },
}
states.vm_support_check_prep = {
inactive: 'do support checks.',
- prompt () {
+ prompt() {
if (game.valid_spaces.length === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no valid targets for support check.`
gen_action('done')
@@ -5875,7 +6210,10 @@ 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.vm_event === C_THE_MONDAY_DEMONSTRATIONS && game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) {
+ if (
+ game.vm_event === C_THE_MONDAY_DEMONSTRATIONS &&
+ game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)
+ ) {
game.austria_hungary_border_reopened_tracker = true
game.state = 'vm_do_support_check'
return
@@ -5884,7 +6222,11 @@ states.vm_support_check_prep = {
// Then check Austria-Hungary Border Reopened normally
if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) {
if (game.active === DEM && game.vm_available_ops > 1) {
- if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) && game.active === DEM) {
+ if (
+ spaces[game.selected_space].country === 'East_Germany' &&
+ game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) &&
+ game.active === DEM
+ ) {
game.state = 'vm_austria_hungary_border_reopened_check'
return
}
@@ -5892,16 +6234,16 @@ states.vm_support_check_prep = {
}
game.state = 'vm_do_support_check'
},
- done () {
+ done() {
push_undo()
game.vm_available_ops = 0
- vm_next ()
- }
+ vm_next()
+ },
}
states.vm_ceh_support_check_prep = {
inactive: 'do support checks.',
- prompt () {
+ prompt() {
if (game.vm_available_ops > 0) {
view.prompt = `Select a space. ${pluralize(game.vm_available_ops, 'support check')} remaining.`
@@ -5917,7 +6259,11 @@ states.vm_ceh_support_check_prep = {
// Then check Austria-Hungary Border Reopened normally
if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) {
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) {
+ 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
}
@@ -5929,7 +6275,7 @@ states.vm_ceh_support_check_prep = {
states.vm_ceh_do_support_check = {
inactive: 'do support checks.',
- prompt () {
+ prompt() {
view.prompt = `Support check: ${spaces[game.selected_space].name_unique}. Roll a die.`
gen_action('roll')
},
@@ -5944,7 +6290,7 @@ states.vm_ceh_do_support_check = {
game.state = 'vm_ceh_support_check_prep'
return
}
- }
+ },
}
states.vm_austria_hungary_border_reopened_check = {
@@ -5960,12 +6306,12 @@ states.vm_austria_hungary_border_reopened_check = {
},
no() {
game.state = 'vm_do_support_check'
- }
+ },
}
states.vm_1_support_check_prep = {
inactive: 'do support checks.',
- prompt () {
+ prompt() {
if (game.valid_spaces.length === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no valid targets for support check.`
gen_action('done')
@@ -5981,16 +6327,16 @@ states.vm_1_support_check_prep = {
game.selected_space = space
game.state = 'vm_do_support_check'
},
- done () {
+ done() {
push_undo()
game.vm_available_ops = 0
- vm_next ()
- }
+ vm_next()
+ },
}
states.vm_do_support_check = {
inactive: 'do support checks.',
- prompt () {
+ prompt() {
view.prompt = `Support check: ${spaces[game.selected_space].name_unique}. Roll a die.`
gen_action('roll')
},
@@ -6008,18 +6354,18 @@ states.vm_do_support_check = {
game.state = 'vm_support_check_prep'
return
}
- }
+ },
}
states.vm_tiananmen_square_attempt = {
inactive: 'do Tiananmen Square',
- prompt () {
+ prompt() {
view.prompt = 'Tiananmen Square: roll a die'
gen_action('roll')
},
roll() {
clear_undo()
- do_tst_attempt ()
+ do_tst_attempt()
},
}
@@ -6051,7 +6397,7 @@ states.vm_adamec = {
log('Adamec fails: 3 or more required')
permanently_remove(C_ADAMEC)
vm_return()
- }
+ },
}
states.vm_brought_in_for_questioning = {
@@ -6072,7 +6418,7 @@ 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))) {
if (!game.vm_infl_to_do) {
- if(game.round_player === DEM) {
+ if (game.round_player === DEM) {
game.return = COM
} else {
game.return = DEM
@@ -6149,7 +6495,7 @@ states.vm_central_committee_reshuffle = {
game.valid_spaces = game.valid_spaces.filter(space => space !== game.systematization)
vm_next()
},
- bulgaria () {
+ bulgaria() {
push_undo()
game.vm_active_country = "Bulgaria"
log(`Chose ${country_name(game.vm_active_country)}`)
@@ -6159,7 +6505,7 @@ states.vm_central_committee_reshuffle = {
pass() {
log('Passed')
vm_return()
- }
+ },
}
states.vm_common_european_home_choose = {
@@ -6178,7 +6524,7 @@ states.vm_common_european_home_choose = {
silent_discard(card)
game.vm_event = card
game.state = 'vm_common_european_home_play'
- }
+ },
}
states.vm_common_european_home_play = {
@@ -6189,11 +6535,11 @@ states.vm_common_european_home_play = {
view.prompt = `Play ${clean_name(cards[this_card()].name)} for:`
gen_action('influence')
gen_action('support_check')
- if (game.active === DEM && game.vm_event === C_KOHL_PROPOSES_REUNIFICATION ) {
+ if (game.active === DEM && game.vm_event === C_KOHL_PROPOSES_REUNIFICATION) {
return /*Special condition if card is actually Kohl Proposes Reunification*/
}
},
- influence(){
+ influence() {
push_undo()
log_gap(`Played C${game.vm_event} to place SPs`)
game.vm_available_ops = get_card_ops(game.vm_event)
@@ -6215,7 +6561,7 @@ states.vm_common_european_home_play = {
push_undo()
log_gap(`Played C${game.vm_event} to the Tiananmen Square Track`)
game.state = 'vm_tiananmen_square_attempt'
- }
+ },
}
states.vm_dash_for_the_west = {
@@ -6271,14 +6617,16 @@ states.vm_play_event_from_discard = {
game.vm_event = card
game.vm_available_ops = cards[card].ops
game.discard = false
- if (switch_events.includes(card)) {next_player()}
+ if (switch_events.includes(card)) {
+ next_player()
+ }
goto_vm(card)
},
- pass(){
+ pass() {
push_undo()
if (game.valid_cards.length === 0) {
log('No valid cards to choose')
- } else{
+ } else {
log('Did not choose a card')
}
vm_next()
@@ -6309,7 +6657,7 @@ states.vm_deutsche_marks_prep = {
pass() {
push_undo()
vm_next()
- }
+ },
}
states.vm_deutsche_marks_confirm = {
@@ -6325,7 +6673,7 @@ states.vm_deutsche_marks_confirm = {
next_player()
game.state = 'vm_deutsche_marks'
}
- }
+ },
}
states.vm_deutsche_marks = {
@@ -6364,14 +6712,14 @@ states.vm_deutsche_marks = {
push_undo()
log_gap(`Played C${game.vm_event} for support checks`)
game.vm_available_ops = 2
- game.state='vm_support_check_prep'
+ game.state = 'vm_support_check_prep'
valid_spaces_sc()
},
tst() {
push_undo()
log_gap(`Played C${game.vm_event} to the Tiananmen Square Track`)
- game.state='vm_tiananmen_square_attempt'
- }
+ game.state = 'vm_tiananmen_square_attempt'
+ },
}
states.vm_exit_visas = {
@@ -6389,7 +6737,7 @@ states.vm_exit_visas = {
gen_action('done')
}
},
- card(card){
+ card(card) {
push_undo()
discard(card)
game.temp++
@@ -6402,7 +6750,7 @@ states.vm_exit_visas = {
done() {
push_undo()
game.state = 'vm_exit_visas_finish'
- }
+ },
}
states.vm_exit_visas_finish = {
@@ -6410,7 +6758,7 @@ states.vm_exit_visas_finish = {
return `resolve ${clean_name(cards[C_EXIT_VISAS].name)}.`
},
prompt() {
- if (game.temp > 0 ) {
+ if (game.temp > 0) {
view.prompt = 'Exit Visas: draw replacement cards.'
gen_action('draw')
} else {
@@ -6420,13 +6768,19 @@ states.vm_exit_visas_finish = {
},
draw() {
clear_undo()
- draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.democrat_hand.length + game.temp, game.communist_hand.length)
+ draw_cards(
+ game.strategy_deck,
+ game.democrat_hand,
+ game.communist_hand,
+ game.democrat_hand.length + game.temp,
+ game.communist_hand.length
+ )
game.temp = 0
vm_next()
},
done() {
vm_next()
- }
+ },
}
states.vm_foreign_currency_debt_burden = {
@@ -6470,7 +6824,7 @@ states.vm_foreign_currency_debt_burden = {
game.foreign_currency_debt_burden = 'Bulgaria'
log('Selected Bulgaria')
vm_next()
- }
+ },
}
states.vm_goodbye_lenin = {
@@ -6478,7 +6832,7 @@ states.vm_goodbye_lenin = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- if (game.valid_cards.length > 0 ) {
+ if (game.valid_cards.length > 0) {
view.prompt = `Play a red event from your opponent's hand, or play Goodbye Lenin for operations.`
for (let card of game.valid_cards) {
gen_action_card(card)
@@ -6507,7 +6861,7 @@ states.vm_goodbye_lenin = {
log('C46 played for operations')
game.view_opp_hand = false
game.state = 'vm_goodbye_lenin_ops'
- }
+ },
}
states.vm_goodbye_lenin_ops = {
@@ -6518,11 +6872,14 @@ states.vm_goodbye_lenin_ops = {
view.prompt = `Play ${clean_name(cards[this_card()].name)} for:`
gen_action('influence')
gen_action('support_check')
- 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)) {
+ 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('tst')
}
},
- influence(){
+ influence() {
push_undo()
game.vm_available_ops = get_card_ops(this_card())
valid_spaces_infl()
@@ -6542,7 +6899,7 @@ states.vm_goodbye_lenin_ops = {
tst() {
push_undo()
game.state = 'vm_tiananmen_square_attempt'
- }
+ },
}
states.vm_honecker = {
@@ -6553,13 +6910,13 @@ states.vm_honecker = {
if (game.valid_cards.length === 0 && game.temp === 0) {
view.prompt = 'Honecker: no valid cards to choose.'
gen_action('pass')
- } else
- if (game.temp === 0) {view.prompt = 'Honecker: choose a card to add to your hand.'
- for (let card of game.valid_cards) {
- gen_action_card(card)
- gen_action('pass')
- }
+ } else if (game.temp === 0) {
+ view.prompt = 'Honecker: choose a card to add to your hand.'
+ for (let card of game.valid_cards) {
+ gen_action_card(card)
+ gen_action('pass')
}
+ }
},
card(card) {
push_undo()
@@ -6571,7 +6928,7 @@ states.vm_honecker = {
game.communist_hand.push(card)
vm_next()
},
- pass(){
+ pass() {
log('Did not take a card')
game.discard = false
vm_next()
@@ -6635,7 +6992,7 @@ states.vm_inflationary_currency = {
log(`Chose ${country_name(game.vm_active_country)}`)
vm_next()
},
- bulgaria () {
+ bulgaria() {
push_undo()
game.vm_active_country = 'Bulgaria'
log(`Chose ${country_name(game.vm_active_country)}`)
@@ -6644,7 +7001,7 @@ states.vm_inflationary_currency = {
pass() {
log('Passed')
vm_return()
- }
+ },
}
states.vm_inflationary_currency_discard = {
@@ -6652,7 +7009,7 @@ states.vm_inflationary_currency_discard = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- if (game.valid_cards.length === 0 ) {
+ if (game.valid_cards.length === 0) {
view.prompt = 'Inflationary Currency: no valid cards to discard. You must pass.'
gen_action('pass')
} else {
@@ -6668,7 +7025,7 @@ states.vm_inflationary_currency_discard = {
discard(card)
game.temp = card
if (!game.vm_infl_to_do) {
- if(game.round_player === DEM) {
+ if (game.round_player === DEM) {
game.return = COM
} else {
game.return = DEM
@@ -6709,7 +7066,11 @@ states.vm_kiss_of_death = {
log_side()
log(`C${game.vm_event}:`)
game.state = 'vm_kiss_of_death_finish'
- } else if (cards[game.vm_event].side !== "C" && event_is_playable(game.vm_event) && game.vm_event !== C_COMMON_EUROPEAN_HOME) {
+ } else if (
+ cards[game.vm_event].side !== 'C' &&
+ event_is_playable(game.vm_event) &&
+ game.vm_event !== C_COMMON_EUROPEAN_HOME
+ ) {
if (is_auto_resolve(game.vm_event)) {
change_player()
game.state = 'vm_kiss_of_death_finish'
@@ -6727,7 +7088,7 @@ states.vm_kiss_of_death = {
pass() {
log('No card to discard')
vm_next()
- }
+ },
}
states.vm_kiss_of_death_finish = {
@@ -6795,7 +7156,7 @@ states.vm_kremlin_coup_choose_country = {
game.temp = game.temp.filter(country => country !== game.vm_active_country)
vm_kremlin_coup_elite()
},
- bulgaria () {
+ bulgaria() {
push_undo()
game.vm_active_country = 'Bulgaria'
log(`${country_name(game.vm_active_country)}:`)
@@ -6805,7 +7166,7 @@ states.vm_kremlin_coup_choose_country = {
done() {
game.temp = 0
vm_next()
- }
+ },
}
states.vm_kremlin_coup_take_control = {
@@ -6816,8 +7177,7 @@ states.vm_kremlin_coup_take_control = {
if (game.valid_spaces.includes(game.systematization)) {
view.prompt = `Kremlin Coup! ${country_name(game.vm_active_country)}'s Elite space no longer exists.`
gen_action('done')
- }
- else if (game.valid_spaces.length === 0){
+ } else if (game.valid_spaces.length === 0) {
view.prompt = `Kremlin Coup! ${country_name(game.vm_active_country)}'s Elite space is already controlled.`
gen_action('done')
} else {
@@ -6861,24 +7221,24 @@ states.vm_kremlin_coup_sc_prep = {
space(_space) {
push_undo()
game.state = 'vm_kremlin_coup_sc'
- }
+ },
}
states.vm_kremlin_coup_sc = {
inactive: 'do support checks',
- prompt () {
+ prompt() {
view.prompt = `Support check: ${spaces[game.selected_space].name_unique}. Roll a die.`
gen_action('roll')
},
roll() {
clear_undo()
do_sc(game.selected_space)
- if (game.temp.length > 0 ){
+ if (game.temp.length > 0) {
game.state = 'vm_kremlin_coup_choose_country'
} else {
vm_next()
}
- }
+ },
}
states.vm_laszlo_tokes = {
@@ -6890,7 +7250,7 @@ states.vm_laszlo_tokes = {
gen_action('influence')
gen_action('support_check')
},
- influence(){
+ influence() {
push_undo()
game.vm_available_ops = get_card_ops(C_LASZLO_TOKES)
valid_spaces_infl()
@@ -6985,7 +7345,7 @@ states.vm_modrow = {
view.prompt = `Modrow: roll a die.`
gen_action('roll')
},
- roll(){
+ roll() {
clear_undo()
let roll = roll_d6()
let dem_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_dem_control(space.space_id)).length
@@ -6999,7 +7359,7 @@ states.vm_modrow = {
permanently_remove(C_MODROW)
vm_return()
}
- }
+ },
}
states.vm_nepotism = {
@@ -7015,13 +7375,14 @@ states.vm_nepotism = {
let roll = roll_d6()
if (roll < 3) {
log(`Roll: D${roll} adds 4 SPs`)
- game.vm_available_ops = 4}
- else if (roll < 5 ) {
+ game.vm_available_ops = 4
+ } else if (roll < 5) {
log(`Roll: D${roll} adds 3 SPs`)
- game.vm_available_ops = 3}
- else {
+ game.vm_available_ops = 3
+ } else {
log(`Roll: D${roll} adds 1 SP`)
- game.vm_available_ops = 1}
+ game.vm_available_ops = 1
+ }
vm_next()
},
}
@@ -7057,7 +7418,7 @@ states.vm_new_years_eve_party = {
log('Chooses to continue')
permanently_remove(C_NEW_YEARS_EVE_PARTY)
vm_next()
- }
+ },
}
states.vm_nomenklatura = {
@@ -7094,7 +7455,7 @@ states.vm_nomenklatura = {
check_systematization()
game.vm_available_ops = 3
game.state = 'vm_nomenklatura_add'
- }
+ },
}
states.vm_nomenklatura_remove = {
@@ -7102,7 +7463,7 @@ states.vm_nomenklatura_remove = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- if (game.valid_spaces.length === 0 ) {
+ if (game.valid_spaces.length === 0) {
view.prompt = 'Nomenklatura. No SPs to remove: pass.'
gen_action('pass')
} else {
@@ -7123,7 +7484,7 @@ states.vm_nomenklatura_remove = {
pass() {
push_undo()
vm_next()
- }
+ },
}
states.vm_nomenklatura_add = {
@@ -7138,7 +7499,7 @@ states.vm_nomenklatura_add = {
},
space(space) {
vm_do_add_infl_free(space)
- if (game.vm_available_ops === 0 ) {
+ if (game.vm_available_ops === 0) {
game.valid_spaces = []
do_log_summary()
vm_next()
@@ -7168,7 +7529,7 @@ states.vm_samizdat = {
push_undo()
log('Did not set aside a card')
vm_next()
- }
+ },
}
states.vm_samizdat_finish = {
@@ -7195,7 +7556,7 @@ states.vm_shock_therapy = {
view.prompt = 'Shock Therapy: no countries to choose.'
gen_action('pass')
} else {
- if (!game.vm_active_country || game.vm_active_country === '' ) {
+ if (!game.vm_active_country || game.vm_active_country === '') {
view.prompt = 'Shock Therapy: choose a country where you hold Power:'
if (game.revolutions[0]) {gen_action('poland')}
if (game.revolutions[1]) {gen_action('hungary')}
@@ -7235,7 +7596,7 @@ states.vm_shock_therapy = {
game.vm_active_country = 'Romania'
log(`Chose ${country_name(game.vm_active_country)}`)
},
- bulgaria () {
+ bulgaria() {
push_undo()
game.vm_active_country = 'Bulgaria'
log(`Chose ${country_name(game.vm_active_country)}`)
@@ -7245,7 +7606,12 @@ states.vm_shock_therapy = {
let roll = roll_d6()
let worker_farmer = 0
for (let space of spaces) {
- if (space && space.country === game.vm_active_country && check_com_control(space.space_id) && (space.socio === 3 || space.socio === 4)) {
+ if (
+ space &&
+ space.country === game.vm_active_country &&
+ check_com_control(space.space_id) &&
+ (space.socio === 3 || space.socio === 4)
+ ) {
worker_farmer++
}
}
@@ -7268,7 +7634,7 @@ states.vm_shock_therapy = {
pass() {
log('Passed')
vm_return()
- }
+ },
}
states.vm_social_democratic_platform_adopted = {
@@ -7319,7 +7685,7 @@ states.vm_social_democratic_platform_adopted = {
log(`Selected ${country_name(game.vm_active_country)}`)
vm_next()
},
- bulgaria () {
+ bulgaria() {
push_undo()
game.vm_active_country = 'Bulgaria'
log(`Selected ${country_name(game.vm_active_country)}`)
@@ -7328,7 +7694,7 @@ states.vm_social_democratic_platform_adopted = {
pass() {
log('Passed')
vm_return()
- }
+ },
}
states.vm_systematization = {
@@ -7420,7 +7786,7 @@ states.vm_the_chinese_solution = {
}
vm_next()
},
- bulgaria () {
+ bulgaria() {
push_undo()
game.vm_active_country = 'Bulgaria'
log(`Chose ${country_name(game.vm_active_country)}`)
@@ -7436,7 +7802,7 @@ states.vm_the_chinese_solution = {
logi(`Chose not to conduct support checks`)
permanently_remove(C_THE_CHINESE_SOLUTION)
vm_return()
- }
+ },
}
states.vm_the_tyrant_is_gone = {
@@ -7447,7 +7813,8 @@ states.vm_the_tyrant_is_gone = {
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
+ if (!space_id)
+ continue
gen_action_space(space_id)
}
} else {
@@ -7461,9 +7828,9 @@ states.vm_the_tyrant_is_gone = {
game.the_tyrant_is_gone = space
game.valid_spaces = []
},
- done () {
+ done() {
vm_next()
- }
+ },
}
states.vm_the_wall_must_go = {
@@ -7471,7 +7838,7 @@ states.vm_the_wall_must_go = {
return `resolve ${clean_name(cards[this_card()].name)}.`
},
prompt() {
- view.prompt = ('The Wall Must Go! Roll a die.')
+ view.prompt = 'The Wall Must Go! Roll a die.'
gen_action('roll')
},
roll() {
@@ -7502,10 +7869,10 @@ states.vm_the_wall_must_go = {
}
if (game.the_wall_must_go['dem_roll'] > 0 && game.the_wall_must_go['com_roll'] > 0) {
- if (game.the_wall_must_go['dem_roll'] > game.the_wall_must_go['com_roll'] ) {
+ if (game.the_wall_must_go['dem_roll'] > game.the_wall_must_go['com_roll']) {
log('Democrat wins')
game.the_wall_must_go['dem_wins']++
- } else if (game.the_wall_must_go['dem_roll'] === game.the_wall_must_go['com_roll'] ) {
+ } else if (game.the_wall_must_go['dem_roll'] === game.the_wall_must_go['com_roll']) {
log('Tie. Re-roll')
} else {
log('Communist wins')
@@ -7542,7 +7909,7 @@ states.vm_warsaw_pact_summit = {
gen_action('influence')
gen_action('support_check')
},
- influence(){
+ influence() {
push_undo()
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
@@ -7554,7 +7921,7 @@ states.vm_warsaw_pact_summit = {
game.phase = 3
vm_next()
},
- support_check(){
+ support_check() {
push_undo()
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
@@ -7564,7 +7931,7 @@ states.vm_warsaw_pact_summit = {
}
game.vm_available_ops = 2
vm_next()
- }
+ },
}
states.vm_we_are_the_people_remove = {
@@ -7575,7 +7942,7 @@ states.vm_we_are_the_people_remove = {
if (game.demInfl[S_LUTHERAN_CHURCH] === 0 && game.vm_available_ops > 0) {
view.prompt = '"We are the People!": no SPs to remove.'
gen_action('done')
- } else if (game.vm_available_ops > 0 ) {
+ } else if (game.vm_available_ops > 0) {
view.prompt = '"We are the People!": remove up to 4 SPs from the Lutherian Church.'
gen_action('done')
for (let space_id of game.valid_spaces) {
@@ -7601,7 +7968,7 @@ states.vm_we_are_the_people_remove = {
} else {
finish_we_are_the_people()
}
- }
+ },
}
states.vm_we_are_the_people_add = {
get inactive() {
@@ -7614,8 +7981,8 @@ states.vm_we_are_the_people_add = {
}
},
space(space) {
- vm_do_add_limited_infl(space, game.vm_max_infl )
- if (game.vm_available_ops === 0 ) {
+ vm_do_add_limited_infl(space, game.vm_max_infl)
+ if (game.vm_available_ops === 0) {
game.valid_spaces = []
do_log_summary()
vm_next()
@@ -7628,7 +7995,7 @@ states.vm_workers_revolt = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- if (game.valid_spaces.length === 0 ) {
+ if (game.valid_spaces.length === 0) {
view.prompt = 'Workers Revolt: no valid spaces to select.'
gen_action('pass')
return
@@ -7647,7 +8014,7 @@ states.vm_workers_revolt = {
game.selected_space = space
log(`Chose %${game.selected_space}`)
game.state = 'vm_workers_revolt_finish'
- }
+ },
}
states.vm_workers_revolt_finish = {
@@ -7690,16 +8057,36 @@ states.vm_tst_3_prep = {
draw() {
if (game.active === DEM) {
game.temp = game.democrat_hand.length
- draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.democrat_hand.length + 3, game.communist_hand.length)
- game.valid_cards = [game.democrat_hand[game.temp], game.democrat_hand[game.temp + 1], game.democrat_hand[game.temp + 2]]
+ draw_cards(
+ game.strategy_deck,
+ game.democrat_hand,
+ game.communist_hand,
+ game.democrat_hand.length + 3,
+ game.communist_hand.length
+ )
+ game.valid_cards = [
+ game.democrat_hand[game.temp],
+ game.democrat_hand[game.temp + 1],
+ game.democrat_hand[game.temp + 2],
+ ]
} else {
game.temp = game.communist_hand.length
- draw_cards(game.strategy_deck, game.democrat_hand, game.communist_hand, game.democrat_hand.length, game.communist_hand.length + 3)
- game.valid_cards = [game.communist_hand[game.temp], game.communist_hand[game.temp + 1], game.communist_hand[game.temp + 2]]
+ draw_cards(
+ game.strategy_deck,
+ game.democrat_hand,
+ game.communist_hand,
+ game.democrat_hand.length,
+ game.communist_hand.length + 3
+ )
+ game.valid_cards = [
+ game.communist_hand[game.temp],
+ game.communist_hand[game.temp + 1],
+ game.communist_hand[game.temp + 2],
+ ]
}
game.temp = 0
game.state = 'vm_tst_3'
- }
+ },
}
states.vm_tst_3 = {
@@ -7725,7 +8112,7 @@ states.vm_tst_3 = {
states.vm_tst_4 = {
inactive: 'remove SPs',
- prompt () {
+ prompt() {
if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) {
view.prompt = 'Tiananmen Square Track award. Remove SPs: done.'
gen_action('done')
@@ -7747,7 +8134,7 @@ states.vm_tst_4 = {
done() {
do_log_summary()
vm_next()
- }
+ },
}
states.vm_tst_6 = {
@@ -7763,7 +8150,11 @@ states.vm_tst_6 = {
space(space) {
push_undo()
game.selected_space = space
- if (game.active === DEM && game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) && spaces[space].country === "East_Germany") {
+ if (
+ game.active === DEM &&
+ game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED) &&
+ spaces[space].country === 'East_Germany'
+ ) {
game.austria_hungary_border_reopened_tracker = true
}
game.state = 'vm_tst_6_sc'
@@ -7772,7 +8163,7 @@ states.vm_tst_6 = {
states.vm_tst_6_sc = {
inactive: 'do support check.',
- prompt () {
+ prompt() {
view.prompt = `Support check: ${spaces[game.selected_space].name_unique}. Roll a die`
gen_action('roll')
},
@@ -7784,7 +8175,7 @@ states.vm_tst_6_sc = {
game.state = 'vm_tst_6'
vm_next()
return
- }
+ },
}
states.vm_tst_8 = {
@@ -7830,7 +8221,7 @@ states.vm_tst_8 = {
push_undo()
game.tst_8 = true
end_round()
- }
+ },
}
states.vm_tst_8_ops = {
@@ -7839,11 +8230,14 @@ states.vm_tst_8_ops = {
view.prompt = `Play ${clean_name(cards[game.played_card].name)} for:`
gen_action('influence')
gen_action('support_check')
- if ((game.active === DEM && game.dem_tst_attempted_this_turn === 0 ) || (game.active === COM && game.com_tst_attempted_this_turn === 0 )) {
+ if (
+ (game.active === DEM && game.dem_tst_attempted_this_turn === 0) ||
+ (game.active === COM && game.com_tst_attempted_this_turn === 0)
+ ) {
gen_action('tst')
}
},
- influence(){
+ influence() {
push_undo()
game.vm_available_ops = cards[game.played_card].ops
valid_spaces_infl()
@@ -7861,20 +8255,20 @@ states.vm_tst_8_ops = {
tst() {
push_undo()
game.state = 'vm_tiananmen_square_attempt'
- }
+ },
}
// ========================= POWER STRUGGLE STATES ========================
states.vm_scare_tactics = {
inactive: 'remove a Support Point.',
- prompt () {
+ prompt() {
if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no SPs to remove.`
gen_action('done')
return
}
- if (game.vm_available_ops === 0 ) {
+ if (game.vm_available_ops === 0) {
view.prompt = `${clean_name(cards[this_card()].name)}. Remove SPs: done.`
gen_action('done')
return
@@ -7891,7 +8285,7 @@ states.vm_scare_tactics = {
done() {
do_log_summary()
vm_next()
- }
+ },
}
states.vm_support_surges_1 = {
@@ -7902,14 +8296,26 @@ states.vm_support_surges_1 = {
},
draw() {
if (game.active === DEM) {
- draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length+1, game.com_pwr_hand.length)
- game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length-1]
+ draw_cards(
+ game.power_struggle_deck,
+ game.dem_pwr_hand,
+ game.com_pwr_hand,
+ game.dem_pwr_hand.length + 1,
+ game.com_pwr_hand.length
+ )
+ game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length - 1]
} else {
- draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length, game.com_pwr_hand.length+1)
- game.temp = game.com_pwr_hand[game.com_pwr_hand.length-1]
+ draw_cards(
+ game.power_struggle_deck,
+ game.dem_pwr_hand,
+ game.com_pwr_hand,
+ game.dem_pwr_hand.length,
+ game.com_pwr_hand.length + 1
+ )
+ game.temp = game.com_pwr_hand[game.com_pwr_hand.length - 1]
}
game.state = 'vm_support_surges_2'
- }
+ },
}
states.vm_support_surges_2 = {
@@ -7930,14 +8336,26 @@ states.vm_support_surges_2 = {
},
draw() {
if (game.active === DEM) {
- draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length+1, game.com_pwr_hand.length)
+ draw_cards(
+ game.power_struggle_deck,
+ game.dem_pwr_hand,
+ game.com_pwr_hand,
+ game.dem_pwr_hand.length + 1,
+ game.com_pwr_hand.length
+ )
game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length - 1]
} else {
- draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length, game.com_pwr_hand.length+1)
+ draw_cards(
+ game.power_struggle_deck,
+ game.dem_pwr_hand,
+ game.com_pwr_hand,
+ game.dem_pwr_hand.length,
+ game.com_pwr_hand.length + 1
+ )
game.temp = game.com_pwr_hand[game.com_pwr_hand.length - 1]
}
game.state = 'vm_support_surges_3'
- }
+ },
}
states.vm_support_surges_3 = {
@@ -7962,13 +8380,16 @@ states.vm_support_surges_3 = {
log('Drew 2 cards')
log('Surrenders initiative')
vm_next()
- }
+ },
}
states.vm_support_falters = {
inactive: 'discard cards.',
prompt() {
- if ((game.active === DEM && game.dem_pwr_hand.length === 0) || (game.active === COM && game.com_pwr_hand.length === 0)) {
+ if (
+ (game.active === DEM && game.dem_pwr_hand.length === 0) ||
+ (game.active === COM && game.com_pwr_hand.length === 0)
+ ) {
view.prompt = 'Support Falters: no remaining cards to discard.'
gen_action('pass')
} else if (game.vm_available_ops > 0) {
@@ -7980,8 +8401,11 @@ states.vm_support_falters = {
}
},
discard() {
- if (game.active === DEM) {discard_card(game.dem_pwr_hand)}
- else {discard_card(game.com_pwr_hand)}
+ if (game.active === DEM) {
+ discard_card(game.dem_pwr_hand)
+ } else {
+ discard_card(game.com_pwr_hand)
+ }
game.vm_available_ops --
},
pass() {