diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 910 |
1 files changed, 512 insertions, 398 deletions
@@ -360,7 +360,7 @@ function start_game() { valid_spaces_setup() game.available_ops = 2 log_h2("Starting Support Points") - log_side() + log('Communist SP:') } function standard_setup() { @@ -548,7 +548,8 @@ states.place_starting_infl = { do_log_summary() game.temp ++ game.available_ops = game.starting_infl[game.temp] - next_player() + change_player() + log(`${game.active} SP:`) valid_spaces_setup() }, start() { @@ -599,7 +600,7 @@ states.choose_card = { select_card(card) }, pass() { - log("Passed") + log("Passed.") game.state = 'end_round' }, } @@ -706,33 +707,40 @@ states.play_card = { event() { push_undo() check_ligachev_event(game.played_card) - log_gap(`Played C${game.played_card} for the event`) + //log_gap(`Played C${game.played_card} for the event`) + if (!scoring_cards.includes(game.played_card)) + log_event(game.played_card) game.vm_infl_to_do = false game.return = game.active if (switch_events.includes(game.played_card)) { - next_player() + //next_player() + change_player() } game.vm_event = game.played_card goto_vm(game.vm_event) }, opp_event() { push_undo() - log_gap(`Resolved opponent event C${game.played_card}`) + check_ligachev_event(game.played_card) + //log_gap(`Resolved opponent event C${game.played_card}`) + log_event(game.played_card) game.vm_infl_to_do = true 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 { - next_player() - log(`C${game.vm_event}:`) + change_player() + /*next_player() + log(`C${game.vm_event}:`) */ goto_vm(game.vm_event) } }, influence() { push_undo() check_ligachev_non_event() - log_gap(`Played C${game.played_card} to place SPs`) + //log_gap(`Played C${game.played_card} to place SPs`) + log('Placed SP:') finish_play_card() // If ABHR - Set AHBR tracker to true @@ -745,14 +753,16 @@ states.play_card = { tst() { push_undo() check_ligachev_non_event() - log_gap(`Played C${game.played_card} to the Tiananmen Square Track`) + //log_gap(`Played C${game.played_card} to the Tiananmen Square Track`) + log('Tiananmen Square Attempt:') finish_play_card() game.state = 'tiananmen_square_attempt' }, support_check() { push_undo() check_ligachev_non_event() - log_gap(`Played C${game.played_card} for Support Checks`) + //log_gap(`Played C${game.played_card} for Support Checks`) + log('Support Checks:') finish_play_card() game.available_ops = 2 game.state = 'support_check_prep' @@ -762,7 +772,7 @@ states.play_card = { /* Cancel opponent event */ push_undo() check_ligachev_non_event() - log(`Played C${game.played_card}. Event cancelled using TST Award`) + log(`Event cancelled using TST Award.`) game.tst_7 = true game.vm_infl_to_do = true game.state = 'resolve_opponent_event' @@ -773,7 +783,7 @@ states.play_card = { game.vm_event_to_do = true game.vm_infl_to_do = true game.tst_8 = true - log(`Played C${game.played_card} for event and operations`) + log(`Uses TST Award: event and operations.`) game.state = 'vm_tst_8' }, end_round() { @@ -808,8 +818,9 @@ states.resolve_opponent_event = { }, influence() { push_undo() - check_ligachev_non_event() - log_gap(`Played C${game.played_card} to place SPs`) + //check_ligachev_non_event() + //log_gap(`Played C${game.played_card} to place SPs`) + log_gap('Placed SP:') // If ABHR - Set AHBR tracker to true if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) { game.austria_hungary_border_reopened_tracker = true @@ -819,8 +830,9 @@ states.resolve_opponent_event = { }, support_check() { push_undo() - check_ligachev_non_event() - log_gap(`Played C${game.played_card} for Support Checks`) + //check_ligachev_non_event() + //log_gap(`Played C${game.played_card} for Support Checks`) + log_gap('Support Checks:') game.available_ops = 2 game.state = 'support_check_prep' valid_spaces_sc() @@ -829,7 +841,8 @@ states.resolve_opponent_event = { game.vm_event_to_do = false game.return_state = 'resolve_opponent_event' game.vm_event = game.played_card - log(`Resolved opponent event C${game.played_card}`) + //log(`Resolved opponent event C${game.played_card}`) + log_event(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) @@ -839,14 +852,15 @@ states.resolve_opponent_event = { } else { game.return = DEM } - next_player() - log(`C${game.played_card}:`) + //next_player() + change_player() + //log(`C${game.played_card}:`) goto_vm(game.vm_event) } }, tst_7() { push_undo() - log('Event cancelled using TST Award') + log('Event cancelled using TST Award.') game.tst_7 = true game.vm_event_to_do = false }, @@ -1048,6 +1062,7 @@ states.support_check_prep = { next_player() } log_h2('Raise the Stakes') + log(`${game.active}:`) game.state = 'raise_stakes_1' return } @@ -1130,7 +1145,7 @@ states.draw_power_cards = { } // Events which affect cards drawn if (game.persistent_events.includes(C_ROUNDTABLE_TALKS) && game.com_pwr_hand_limit >= 2) { - log(`Democrat receives 2 cards from Communist due to C${C_ROUNDTABLE_TALKS}`) + log(`Democrat receives 2 cards from Communist due to C${C_ROUNDTABLE_TALKS}.`) game.dem_pwr_hand_limit += 2 game.com_pwr_hand_limit -= 2 game.persistent_events = game.persistent_events.filter(n => n !== C_ROUNDTABLE_TALKS) @@ -1145,7 +1160,7 @@ states.draw_power_cards = { } } if (farmer_check && game.com_pwr_hand_limit > 0) { - log(`Democrat receives 1 cards from Communist due to C${C_PEASANT_PARTIES_REVOLT}`) + log(`Democrat receives 1 cards from Communist due to C${C_PEASANT_PARTIES_REVOLT}.`) game.dem_pwr_hand_limit += 1 game.com_pwr_hand_limit -= 1 permanently_remove(C_PEASANT_PARTIES_REVOLT) @@ -1157,7 +1172,7 @@ states.draw_power_cards = { 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}`) + 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 permanently_remove(C_NATIONAL_SALVATION_FRONT) @@ -1196,6 +1211,7 @@ states.draw_power_cards = { game.state = 'the_crowd_turns_against_ceausescu_prep' } else { log_h2('Raise the Stakes') + log(`${game.active}:`) game.state = 'raise_stakes_1' } } @@ -1215,7 +1231,7 @@ states.the_crowd_turns_against_ceausescu_prep = { game.temp = game.ceausescu_cards.filter(card => rallies.includes(card)).length log(`Drew ${pluralize(game.temp, 'Rally in the Square')}`) game.vm_available_ops = game.temp * 3 - log(`Democrat takes a ${game.vm_available_ops} Op Action Round`) + log(`Democrat takes a ${game.vm_available_ops} Op Action Round.`) game.state = 'vm_the_crowd_turns_against_ceausescu' } } @@ -1234,6 +1250,7 @@ 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') + log('Placed SP:') game.state = 'the_crowd_turns_against_ceausescu_infl' /* Send this to add_infl. Add check at end of add_infl similar to valid_spaces */ }, @@ -1242,6 +1259,7 @@ states.vm_the_crowd_turns_against_ceausescu = { delete game.ceausescu_cards valid_spaces_sc() game.available_ops = 2 + log('Support Checks:') game.state = 'support_check_prep' } } @@ -1266,9 +1284,10 @@ states.the_crowd_turns_against_ceausescu_infl = { done() { do_log_summary() if (game.return !== game.active) { - next_player() + change_player() } log_h2('Raise the Stakes') + log(`${game.active}:`) game.state = 'raise_stakes_1' }, } @@ -1298,9 +1317,9 @@ states.raise_stakes_1 = { power_card(card) { push_undo() if (numberless_cards.includes(card)) { - log(`Discarded: P${card}`) + logi(`Discarded P${card}`) } else { - log(`Discarded: P${card} V${power_cards[card].value}`) + logi(`Discarded P${card} V${power_cards[card].value}`) } discard(card) @@ -1311,9 +1330,10 @@ states.raise_stakes_1 = { } }, pass() { - log('Did not raise the stakes') + logi(`Did not raise the stakes.`) game.raised_stakes_discard = 0 - next_player() + change_player() + log(`${game.active}:`) if (game.active === DEM) { game.valid_cards = [...game.dem_pwr_hand] } else { @@ -1322,9 +1342,10 @@ states.raise_stakes_1 = { game.state = 'raise_stakes_2' }, done() { - log_gap('Raised the stakes') + logi(`Raised the stakes.`) game.raised_stakes_discard = 0 - next_player() + change_player() + log(`${game.active}:`) if (game.active === DEM) { game.valid_cards = [...game.dem_pwr_hand] } else { @@ -1361,9 +1382,9 @@ states.raise_stakes_2 = { power_card(card) { push_undo() if (numberless_cards.includes(card)) { - log(`Discarded: P${card}`) + logi(`Discarded P${card}`) } else { - log(`Discarded: P${card} V${power_cards[card].value}`) + logi(`Discarded P${card} V${power_cards[card].value}`) } discard(card) @@ -1374,11 +1395,11 @@ states.raise_stakes_2 = { } }, pass() { - log('Did not raise the stakes') + logi(`Did not raise the stakes.`) goto_struggle() }, done() { - log_gap('Raised the stakes') + logi(`Raised the stakes.`) goto_struggle() }, } @@ -1444,18 +1465,19 @@ states.power_struggle = { 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`) + log_msg_gap(`${game.active}: P${PC_TACTIC_FAILS}`) + /*if (game.proxy_power_card) { + log_msg_gap(`P${PC_TACTIC_FAILS}: ${game.proxy_power_card} no longer playable.`) } else { - log_gap(`Played P${PC_TACTIC_FAILS}: P${game.played_power_card} no longer playable`) - } + log_msg_gap(`P${PC_TACTIC_FAILS}: P${game.played_power_card} no longer playable.`) + }*/ } else { if (game.phase === 0 && leader_cards.includes(card)) { /* Log nothing. Probably a better way to do this */ } else if (numberless_cards.includes(card)) { - log_gap(`Played: P${card}`) + log(`${game.active}: P${card}`) } else { - log_gap(`Played: P${card} V${power_cards[card].value}`) + log(`${game.active}: P${card} V${power_cards[card].value}`) } } @@ -1477,12 +1499,12 @@ states.power_struggle = { goto_vm(350) } else if (game.phase === 0 && card === PC_SUPPORT_FALTERS) { /* Support Falters */ - next_player() + change_player() goto_vm(349) } else { game.played_power_card = card game.phase = 1 - next_player() + change_player() do_valid_cards() } } else if (game.phase === 1) { @@ -1493,10 +1515,10 @@ states.power_struggle = { game.tactics_fails = power_cards[game.played_power_card].name } game.phase = 0 - next_player() + change_player() do_valid_cards() } else if (power_cards[game.played_power_card].value === 1) { - log('Takes initiative') + log_msg_gap('Takes initiative.') game.phase = 0 do_valid_cards() } else { @@ -1507,15 +1529,17 @@ states.power_struggle = { roll() { clear_undo() let roll = roll_d6() - log(`Roll: D${roll}`) + log(`Counterattack: D${roll}`) if (roll >= power_cards[game.played_power_card].value) { - log('Initiative roll successful') + log(`Success: ${roll} >= ${power_cards[game.played_power_card].value}`) + log_msg_gap(`${game.active} takes initiative.`) game.phase = 0 do_valid_cards() } else { - log(`Initiative roll failed. Required ${power_cards[game.played_power_card].value} or more`) + log(`Fail: ${roll} < ${power_cards[game.played_power_card].value}`) + log_msg_gap('No change initiative.') game.phase = 0 - next_player() + change_player() do_valid_cards() } }, @@ -1524,7 +1548,7 @@ states.power_struggle = { game.valid_cards = [] delete game.power_card_1 delete game.power_card_2 - log('Conceded') + log(`${game.active} conceded.`) log_h2('Aftermath') log_h3('Support Loss') if (game.phase === 0) { @@ -1535,31 +1559,31 @@ states.power_struggle = { game.state = 'support_loss' }, strike() { - log(`Played: P${game.played_power_card} as a Strike`) + log(`${game.active}: P${game.played_power_card} as Strike.`) game.proxy_power_card = 'Strike' game.phase = 1 - next_player() + change_player() do_valid_cards() }, march() { - log(`Played: P${game.played_power_card} as a March`) + log(`${game.active}: P${game.played_power_card} as March`) game.proxy_power_card = 'March' game.phase = 1 - next_player() + change_player() do_valid_cards() }, rally() { - log(`Played: P${game.played_power_card} as a Rally in the Square`) + log(`${game.active}: P${game.played_power_card} as Rally in the Square`) game.proxy_power_card = 'Rally in the Square' game.phase = 1 - next_player() + change_player() do_valid_cards() }, petition() { - log(`Played: P${game.played_power_card} as a Petition`) + log(`${game.active}: P${game.played_power_card} as Petition`) game.proxy_power_card = 'Petition' game.phase = 1 - next_player() + change_player() do_valid_cards() }, } @@ -1588,11 +1612,12 @@ states.support_loss = { roll() { game.available_ops = support_loss_roll[get_aftermath_roll()] if (game.available_ops === 0) { - log('Does not remove SPs') + log('Does not remove SPs.') } game.phase++ if (game.available_ops > 0) { valid_spaces_support_loss() + log('Removed SP:') } }, space(space) { @@ -1601,7 +1626,7 @@ states.support_loss = { }, done() { do_log_summary() - next_player() + change_player() log_h3('Victory Point') game.phase = 0 game.state = 'vp_roll' @@ -1627,9 +1652,9 @@ states.vp_roll = { let roll = get_aftermath_roll() let vp_change = vp_roll[roll] if (game.active === DEM) { - log(`+${vp_change} VP`) + logi(`+${vp_change} VP`) } else { - log(`-${vp_change} VP`) + logi(`-${vp_change} VP`) } if (game.active === DEM) { game.vp += vp_change @@ -1641,7 +1666,7 @@ states.vp_roll = { } else { game.phase = 0 if (game.active === DEM) { - next_player() + change_player() } game.state = 'choose_power' } @@ -1650,6 +1675,7 @@ states.vp_roll = { push_undo() let scoring_card = scoring_cards[countries.indexOf(game.pwr_struggle_in)] permanently_remove(scoring_card) + log(`Democrat takes power in ${game.pwr_struggle_in}.`) take_power(game.pwr_struggle_in) game.phase = 2 }, @@ -1680,7 +1706,7 @@ states.choose_power = { }, surrender() { push_undo() - log(`Communist voluntarily surrenders power`) + log(`Communist voluntarily surrenders power.`) take_power(game.pwr_struggle_in) permanently_remove(game.played_card) game.phase = 1 @@ -1699,10 +1725,8 @@ states.the_tyrant_is_gone = { gen_action('event') }, event() { - if (game.active !== DEM) { - next_player() - } log_h3(`C${C_THE_TYRANT_IS_GONE}`) + log('Democrat:') game.vm_event = C_THE_TYRANT_IS_GONE goto_vm(game.vm_event) }, @@ -1715,7 +1739,7 @@ states.finish_scoring = { gen_action('done') }, done() { - log_msg_gap('Power Struggle resolved') /* At this point log card dicarded or permanently removed? */ + //log_msg_gap('Power Struggle resolved.') /* At this point log card dicarded or permanently removed? */ if (game.persistent_events.includes(MAGIC_NEW_YEARS_EVE_PARTY)) { game.state = 'new_years_eve_party' return @@ -1737,11 +1761,12 @@ states.end_turn_4_5_4 = { gen_action('check') }, check() { + log_br() log_h2('Verify held cards') const dem_has_scoring_card = game.democrat_hand.some(card => scoring_cards.includes(card)) const com_has_scoring_card = game.communist_hand.some(card => scoring_cards.includes(card)) if (!dem_has_scoring_card && !com_has_scoring_card) { - log('No held scoring cards') + log('No held scoring cards.') } if (dem_has_scoring_card && com_has_scoring_card) { @@ -1759,7 +1784,7 @@ states.end_turn_4_5_4 = { // Check if the Communist receives VP from The Tyrant is Gone if (game.the_tyrant_is_gone && game.the_tyrant_is_gone > 0) { game.vp -= 2 - log(`Communist receives 2 VP from C` + C_THE_TYRANT_IS_GONE) + log(`Communist receives 2 VP from C` + C_THE_TYRANT_IS_GONE + `.`) } game.persistent_events.push(MAGIC_NEW_YEARS_EVE_PARTY) if (game.active !== DEM) { @@ -1792,7 +1817,7 @@ states.final_scoring_held = { push_undo() const held_countries = game.revolutions.filter(value => value === false).length let vp_gain = 4 * held_countries - log(`Communist holds power in ${pluralize(held_countries, 'country', 's')}: -${vp_gain} VP`) + log(`Communist holds power in ${pluralize(held_countries, 'country', 's')}: -${vp_gain} VP.`) game.vp -= 4 * held_countries game.temp = { East_Germany: false, @@ -1907,7 +1932,7 @@ states.general_strike = { game.return_state = 'end_round' goto_vm(game.vm_event) } else { - log(`Discarded C${card}`) + log(`Discarded C${card}.`) game.state = 'general_strike_roll' } }, @@ -1927,11 +1952,13 @@ states.general_strike_roll = { let total = roll + game.available_ops log(`Modified roll: ${total}`) if (total > 5) { - log('The strike is over') + log(`Success: ${total} > 5.`) + log('The strike is over.') permanently_remove(C_GENERAL_STRIKE) game.persistent_events = game.persistent_events.filter(n => n !== 5) } else { - log('The strike continues. Required 6 or more') + log(`Fail: ${total} <= 5.`) + log('The strike continues.') } game.state = 'end_round' }, @@ -1949,7 +1976,7 @@ states.honecker = { push_undo() game.round++ log(`Communist chooses to take an extra Action Round due to C${C_HONECKER}`) - log_h2(`Action Round ${game.round}`) + log_round() game.round_player = COM permanently_remove(C_HONECKER) if (game.persistent_events.includes(C_GENERAL_STRIKE)) { @@ -2059,7 +2086,7 @@ states.stasi_end_round = { }, card(card) { push_undo() - log_gap(`Democrat selected C${card} as next card`) + log(`Democrat selected C${card} as next card.`) game.stasi_card = card if (!scoring_cards.includes(card) && count_scoring_cards() >= (7-game.round)){ game.temp = card @@ -2069,7 +2096,7 @@ states.stasi_end_round = { game.state = 'stasi_finish' }, pass() { - log('Stasi: Democrat has no remaining cards') + log('Stasi: Democrat has no remaining cards.') game.stasi_card = 0 end_stasi_choose_card() }, @@ -2132,6 +2159,7 @@ states.stasi_play_card = { if (game.democrat_hand.includes(C_COMMON_EUROPEAN_HOME) && cards[card].side === "C") { game.state = 'stasi_resolve_common_european_home' } else { + log(`Played C${card}.`) game.state = 'play_card' } }, @@ -2158,7 +2186,7 @@ states.stasi_resolve_common_european_home = { }, yes() { push_undo() - log(`Played C${game.played_card} with Common European Home`) + log(`Played C${game.played_card} with C${C_COMMON_EUROPEAN_HOME}.`) silent_discard(C_COMMON_EUROPEAN_HOME) game.vm_infl_to_do = true game.vm_event_to_do = false @@ -2166,6 +2194,7 @@ states.stasi_resolve_common_european_home = { }, no() { push_undo() + log(`Played C${game.played_card}.`) game.state = 'play_card' }, } @@ -2174,7 +2203,7 @@ states.stasi_resolve_common_european_home = { function add_infl(space, ops) { push_undo() - log_summary(`Added £ SP in %${space}`) + log_summary(`£ - %${space}`) // If AHBR - check AHBR conditions if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)) { @@ -2218,7 +2247,7 @@ function add_infl(space, ops) { game.austria_hungary_border_reopened_tracker ) { game[ops] ++ - log('+1 op from C' + C_AUSTRIA_HUNGARY_BORDER_REOPENED) + log('+1 op from C' + C_AUSTRIA_HUNGARY_BORDER_REOPENED + '.') game.austria_hungary_border_reopened_tracker = false game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country === 'East_Germany') } @@ -2247,7 +2276,7 @@ function add_infl(space, ops) { function remove_infl(space, ops) { push_undo() - log_summary(`Removed £ SP from %${space}`) + log_summary(`£ - %${space}`) if (game.remove_opponent_infl === true) { if (game.active === COM) { @@ -2290,46 +2319,46 @@ function do_sc(space) { clear_undo() let tear_gas_start = game.persistent_events.includes(C_TEAR_GAS) let the_wall_start = game.persistent_events.includes(C_THE_WALL) - log_gap(`Support Check: %${space}`) + log(`%${space}:`) let roll = roll_d6() // Check for The Wall if (game.active === COM && game.persistent_events.includes(C_THE_WALL) && spaces[space].country === 'East_Germany') { logi(`No adjacency for Democrats due to C${C_THE_WALL}`) - log_gap(`Roll: D${roll}`) + logi(`Roll: D${roll}`) } // Continue with Support Check Logic else { - log(`Roll: D${roll}`) + logi(`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`) + logii(`+${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') + logii('+2 TST award') } else { let card_ops = get_card_ops(this_card()) roll += card_ops - logi(`+${card_ops} from card ops`) + logii(`+${card_ops} from card ops`) } if (game.support_check_modifier > 0) { roll += game.support_check_modifier - logi(`+${game.support_check_modifier} from event`) + logii(`+${game.support_check_modifier} from event`) } // Events which modify SC rolls if (game.active === COM && game.persistent_events.includes(C_TEAR_GAS) && spaces[space].socio === SOCIO_STUDENT) { roll ++ - logi(`+1 from C${C_TEAR_GAS}`) + logii(`+1 from C${C_TEAR_GAS}`) permanently_remove(C_TEAR_GAS) game.persistent_events = game.persistent_events.filter(n => n !== C_TEAR_GAS) } @@ -2339,7 +2368,7 @@ function do_sc(space) { game.persistent_events.includes(C_FRG_EMBASSIES) ) { roll++ - logi(`+1 from C${C_FRG_EMBASSIES}`) + logii(`+1 from C${C_FRG_EMBASSIES}`) } if ( game.active === DEM && @@ -2347,18 +2376,18 @@ function do_sc(space) { game.persistent_events.includes(C_GRENZTRUPPEN) ) { roll-- - logi(`-1 from C${C_GRENZTRUPPEN}`) + logii(`-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)) ) { roll-- - logi(`-1 from C${C_STAND_FAST}`) + logii(`-1 from C${C_STAND_FAST}`) } if (game.active === DEM && game.persistent_events.includes(C_ELENA) && spaces[space].country === 'Romania') { roll-- - logi(`-1 from C${C_ELENA}`) + logii(`-1 from C${C_ELENA}`) } if ( game.active === DEM && @@ -2366,7 +2395,7 @@ function do_sc(space) { game.austria_hungary_border_reopened_tracker ) { roll++ - logi(`+1 from C${C_AUSTRIA_HUNGARY_BORDER_REOPENED}`) + logii(`+1 from C${C_AUSTRIA_HUNGARY_BORDER_REOPENED}`) } // Continue with logic - check for adjacency @@ -2377,7 +2406,7 @@ function do_sc(space) { if (game.active === COM && game.persistent_events.includes(C_THE_WALL) && spaces[space].country === 'East_Germany') { roll += adj.com_adj if (adj.com_adj > 0) { - logi(`+${adj.com_adj} adjacency`) + logii(`+${adj.com_adj} adjacency`) } permanently_remove(C_THE_WALL) @@ -2388,31 +2417,31 @@ function do_sc(space) { roll += adj.dem_adj roll -= adj.com_adj if (adj.dem_adj > 0) { - logi(`+${adj.dem_adj} from adjacency`) + logii(`+${adj.dem_adj} from adjacency`) } if (adj.com_adj > 0) { - logi(`-${adj.com_adj} from opponent adjacency`) + logii(`-${adj.com_adj} from opponent adjacency`) } } else { roll += adj.com_adj roll -= adj.dem_adj if (adj.com_adj > 0) { - logi(`+${adj.com_adj} from adjacency`) + logii(`+${adj.com_adj} from adjacency`) } if (adj.dem_adj > 0) { - logi(`-${adj.dem_adj} from opponent adjacency`) + logii(`-${adj.dem_adj} from opponent adjacency`) } } } } // Support Check calcs - log(`Modified roll: ${roll}`) + logi(`Modified roll: ${roll}`) const stability = spaces[space].stability - logi(`-${stability*2} (stability * 2)`) + logii(`-${stability*2} (stability * 2)`) const change_infl = Math.max(0, roll - stability*2) if (change_infl > 0) { - log_msg_gap(`Change influence: ${change_infl} SP`) + logi(`Change: ${change_infl} SP`) if (game.active === DEM) { if (change_infl > game.comInfl[space]) { const residual = change_infl - game.comInfl[space] @@ -2436,10 +2465,10 @@ function do_sc(space) { game.valid_spaces = game.valid_spaces.filter(id => id !== space) } } - check_tyrant() + check_tyrant_sc() } else { - log_msg_gap('Change influence: 0 SP') + logi('Change: 0 SP') } // Check VP awards if ( @@ -2447,11 +2476,11 @@ function do_sc(space) { game.persistent_events.includes(C_HELSINKI_FINAL_ACT) && (spaces[space].socio === SOCIO_INTELLECTUAL || spaces[space].socio === SOCIO_STUDENT) ) { - log('+1 VP from C' + C_HELSINKI_FINAL_ACT) + logi('+1 VP from C' + C_HELSINKI_FINAL_ACT) game.vp ++ } if (game.active === COM && game.persistent_events.includes(C_ECO_GLASNOST) && spaces[space].space_id === S_RUSE) { - log('+1 VP from C' + C_ECO_GLASNOST) + logi('+1 VP from C' + C_ECO_GLASNOST) game.vp++ } @@ -2459,10 +2488,10 @@ function do_sc(space) { let tear_gas_end = game.persistent_events.includes(C_TEAR_GAS) let the_wall_end = game.persistent_events.includes(C_THE_WALL) if (tear_gas_start && !tear_gas_end) { - log(`C${C_TEAR_GAS} no longer in effect`) + logi(`C${C_TEAR_GAS} no longer in effect`) } if (the_wall_start && !the_wall_end) { - log(`C${C_THE_WALL} no longer in effect`) + logi(`C${C_THE_WALL} no longer in effect`) } // If Austria-Hungary Border Reopened used, all future Support Checks must be in East Germany @@ -2740,7 +2769,7 @@ function do_tst_attempt() { if (game.active === DEM) { game.dem_tst_attempted_this_turn = 1 if (roll >= dem_tst_req[game.dem_tst_position]) { - log(`${dem_tst_req[game.dem_tst_position]} required: success`) + log(`Success: ${roll} >= ${dem_tst_req[game.dem_tst_position]}`) game.dem_tst_position++ game.dem_tst_attempted = 0 @@ -2768,14 +2797,14 @@ function do_tst_attempt() { } game.state = 'tiananmen_square_attempt_success' } else { - log(`${dem_tst_req[game.dem_tst_position]} required: fail`) + log(`Fail: ${roll} < ${dem_tst_req[game.dem_tst_position]}`) game.dem_tst_attempted = 1 game.state = 'tiananmen_square_attempt_fail' } } 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`) + log(`Success: ${roll} >= ${com_tst_req[game.com_tst_position]}`) game.com_tst_position++ game.com_tst_attempted = 0 @@ -2807,7 +2836,7 @@ function do_tst_attempt() { } game.state = 'tiananmen_square_attempt_success' } else { - log(`${com_tst_req[game.com_tst_position]} required: fail`) + log(`Fail: ${roll} < ${com_tst_req[game.com_tst_position]}`) game.com_tst_attempted = 1 game.state = 'tiananmen_square_attempt_fail' } @@ -2884,7 +2913,6 @@ function battlegrounds(country) { } function take_power(country) { - log(`Democrat takes power in ${game.pwr_struggle_in}`) game.revolutions[find_country_index(country)] = true game.times_held[find_country_index(country)] = 1 } @@ -2892,8 +2920,8 @@ function take_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)] - log(`Chooses to retain power`) - log(`-${vp_gain} VP`) + log(`Communist retains power.`) + logi(`-${vp_gain} VP`) game.vp -= vp_gain } @@ -2919,95 +2947,96 @@ function score_country(country) { if (presence.dem_control || presence.dem_domination) { log(`Democrat:`) if (presence.dem_control) { - logi(`Control: +${value_control} VP`) + logi(`${value_control} VP for Control`) dem_vp += value_control } else { - logi(`Domination: +${value_domination} VP`) + logi(`${value_domination} VP for Domination`) dem_vp += value_domination } - logi(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + logi(`${presence.dem_battlegrounds} VP for Battlegrounds`) dem_vp += presence.dem_battlegrounds - log(`Total: +${dem_vp} VP`) + //log(`Total: +${dem_vp} VP`) log_gap('Communist:') if (presence.com_spaces > 0) { - logi(`Presence: -${value_presence} VP`) + logi(`${value_presence} VP for Presence`) com_vp -= value_presence if (presence.com_battlegrounds > 0) { - logi(`Battlegrounds: -${presence.com_battlegrounds} VP`) + logi(`${presence.com_battlegrounds} VP for Battlegrounds`) com_vp -= presence.com_battlegrounds } - log(`Total: ${com_vp} VP`) + //log(`Total: ${com_vp} VP`) } else { - log('No presence: 0 VP') + logi('0 VP') } } else if (presence.com_control || presence.com_domination) { log('Communist:') if (presence.com_control) { - logi(`Control: -${value_control} VP`) + logi(`${value_control} VP for Control`) com_vp -= value_control } else { - logi(`Domination: -${value_domination} VP`) + logi(`${value_domination} VP for Domination`) com_vp -= value_domination } - logi(`Battlegrounds: -${presence.com_battlegrounds} VP`) + logi(`${presence.com_battlegrounds} VP for Battlegrounds`) com_vp -= presence.com_battlegrounds - log(`Total: ${com_vp} VP`) + //log(`Total: ${com_vp} VP`) log_gap('Democrat:') if (presence.dem_spaces > 0) { - logi(`Presence: +${value_presence} VP`) + logi(`${value_presence} VP for Presence`) dem_vp += value_presence if (presence.dem_battlegrounds > 0) { - logi(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + logi(`${presence.dem_battlegrounds} VP for Battlegrounds`) dem_vp += presence.dem_battlegrounds } - log(`Total: +${dem_vp} VP`) + //log(`Total: +${dem_vp} VP`) } else { - log('No presence: 0 VP') + logi('0 VP') } } // Otherwise, presence and battlegrounds else { - log("No domination or control") + log("No domination or control.") log_gap(`Communist:`) if (presence.com_spaces > 0) { - logi(`Presence: -${value_presence} VP`) + logi(`${value_presence} VP for Presence`) com_vp -= value_presence if (presence.com_battlegrounds > 0) { - logi(`Battlegrounds: -${presence.com_battlegrounds} VP`) + logi(`${presence.com_battlegrounds} VP for Battlegrounds`) com_vp -= presence.com_battlegrounds - } else { + } /*else { logi('No battlegrounds') } - logi(`Total: ${com_vp} VP`) + logi(`Total: ${com_vp} VP`)*/ } else { - logi('No presence: 0 VP') + logi('0 VP') } log_gap('Democrat:') if (presence.dem_spaces > 0) { - logi(`Presence: +${value_presence} VP`) + logi(`${value_presence} VP for Presence`) dem_vp += value_presence if (presence.dem_battlegrounds > 0) { - logi(`Battlegrounds: +${presence.dem_battlegrounds} VP`) + logi(`${presence.dem_battlegrounds} VP for Battlegrounds`) dem_vp += presence.dem_battlegrounds - } else { + } /*else { logi('No battlegrounds') } - logi(`Total: +${dem_vp} VP`) + logi(`Total: +${dem_vp} VP`) */ } else { - logi('No presence: 0 VP') + logi('0 VP') } } // Calculate change VP let change_vp = dem_vp + com_vp game.vp += change_vp + log_gap('Total:') if (change_vp > 0) { - log_gap(`Scoring: +${change_vp} VP`) + logi(`${change_vp} VP for Democrat`) } else { - log_gap(`Scoring: ${change_vp} VP`) + logi(`${Math.abs(change_vp)} VP for Communist`) } } @@ -3081,9 +3110,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)) { + /*if (is_auto_resolve(card)) { log_gap(`C${card}:`) - } + } */ } function permanently_remove(card) { @@ -3119,7 +3148,7 @@ function goto_struggle() { game.raised_stakes_discard = 0 game.valid_cards = [] log_h2('Play Cards') - next_player() + change_player() game.state = 'power_struggle' do_valid_cards() } @@ -3139,7 +3168,7 @@ function end_stasi_choose_card() { function end_stasi() { game.round_player = COM game.round ++ - log_h2(`Action Round ${game.round}`) + log_round() next_player() game.valid_spaces = [] if (game.persistent_events.includes(C_GENERAL_STRIKE)) { @@ -3199,6 +3228,8 @@ function select_card(card) { } game.available_ops = get_card_ops(card) game.state = 'play_card' + if (!scoring_cards.includes(card)) + log(`Played C${card}.`) } function check_ligachev_non_event() { @@ -3241,21 +3272,21 @@ function is_auto_resolve(card) { } 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') + log('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') + log('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') + log('Communist has no cards to discard.') } return true } @@ -3263,7 +3294,7 @@ function is_auto_resolve(card) { let dem_intellectual_infl = spaces.filter((space) => space.socio === SOCIO_INTELLECTUAL && game.demInfl[space.space_id] > 0).length if (dem_intellectual_infl === 0) { if (!game.state.startsWith('vm')) { - logi('No influence to remove') + log('No influence to remove.') } return true } @@ -3271,13 +3302,13 @@ function is_auto_resolve(card) { if (game.systematization && game.systematization === S_HARGHITA_COVASNA) { if (check_dem_control(S_RAZGRAD)) { if (!game.state.startsWith('vm')) { - logi('Minorities spaces already controlled') + log('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') + log('Minorities spaces already controlled.') } return true } @@ -3285,53 +3316,53 @@ function is_auto_resolve(card) { 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') + log('No influence to remove.') } return true } } 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') + log('No influence to remove.') } return true } } 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') } + if (!game.state.startsWith('vm')) { log('No influence to remove.') } return true } } else if (game.demInfl[S_ORTHODOX_CHURCH_BULGARIA] === 0 && game.demInfl[S_ORTHODOX_CHURCH_ROMANIA] === 0) { - if (!game.state.startsWith('vm')) { logi('No influence to remove') } + if (!game.state.startsWith('vm')) { log('No influence to remove.') } return true } } else if (card === C_GOVERNMENT_RESIGNS && game.active === COM) { let uncontrolled_elites = spaces.filter(space => spaces[space.space_id].socio === SOCIO_ELITE && 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') + log('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') + log('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') + log('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') + log('No influence to remove.') } return true } @@ -3345,21 +3376,21 @@ function is_auto_resolve(card) { 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') + log('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') + log('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') + log('Democrat has no cards to set aside.') } return true } @@ -3367,7 +3398,7 @@ function is_auto_resolve(card) { 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') + log('No influence to remove.') } return true } @@ -3375,7 +3406,7 @@ function is_auto_resolve(card) { 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') + log('No influence to remove.') } return true } @@ -3383,7 +3414,7 @@ function is_auto_resolve(card) { 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') + log('No influence to remove.') } return true } @@ -3391,7 +3422,7 @@ function is_auto_resolve(card) { 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') + log('No uncontrolled Worker or Farmer spaces in Poland.') } return true } @@ -3420,10 +3451,12 @@ function event_is_playable(card) { } } } - // Check for Gorbachev Charms the West after Breakaway Baltic Republics else if (card === C_GORBACHEV_CHARMS_THE_WEST && !game.playable_cards.includes(C_GORBACHEV_CHARMS_THE_WEST)) { return false + } //Democrat must have cards to set aside to play Samizdat + else if (card === C_SAMIZDAT && game.democrat_hand.length === 0) { + return false } // Then check normally else if (game.playable_cards.includes(card)) { @@ -3441,10 +3474,10 @@ function get_card_ops(card) { if ( game.state === 'choose_card' || game.state === 'stasi_play_card' || - game.state === 'vm_common_european_home_play' || - game.state === 'general_strike' + game.state === 'general_strike' || + game.state === 'vm_deutsche_marks' ) { - log(`+1 op from C${C_PERESTROIKA}`) + log(`+1 op from C${C_PERESTROIKA}.`) } ops ++ } @@ -3452,10 +3485,9 @@ function get_card_ops(card) { 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}`) + log(`+1 op from C${C_THE_SINATRA_DOCTRINE}.`) } ops ++ } @@ -3467,10 +3499,9 @@ function get_card_ops(card) { 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 Tiananmen Square Track') + log('+1 op from Tiananmen Square Track.') } ops ++ } @@ -3479,14 +3510,13 @@ function get_card_ops(card) { 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}`) + log(`${pluralize(game.prudence.DEM,'op')} from C${C_PRUDENCE}.`) } else { if (ops > 1) { - log(`-1 op from C${C_PRUDENCE}`) + log(`-1 op from C${C_PRUDENCE}.`) } } } @@ -3500,13 +3530,12 @@ 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' + game.state === 'general_strike' ) { if (ops > 2) { - log(`${pluralize(game.prudence.COM,'op')} from C${C_PRUDENCE}`) + log(`${pluralize(game.prudence.COM,'op')} from C${C_PRUDENCE}.`) } else if (ops > 1) { - log(`-1 op from C${C_PRUDENCE}`) + log(`-1 op from C${C_PRUDENCE}.`) } } ops += game.prudence.COM @@ -3520,18 +3549,18 @@ function get_card_ops(card) { function get_tst_6_ops() { let ops = 0 if (game.persistent_events.includes(C_PERESTROIKA) && game.active === COM) { - logi(`+1 op from C${C_PERESTROIKA}`) + logi(`+1 op from C${C_PERESTROIKA}.`) ops ++ } if (game.persistent_events.includes(C_THE_SINATRA_DOCTRINE) && game.active === DEM) { - logi(`+1 op from C${C_THE_SINATRA_DOCTRINE}`) + logi(`+1 op from C${C_THE_SINATRA_DOCTRINE}.`) ops ++ } if (game.active === DEM && game.prudence && game.prudence.DEM !== 0) { if (ops > 0) { - log(`${pluralize(game.prudence.DEM,'op')} from C${C_PRUDENCE}`) + log(`${pluralize(game.prudence.DEM,'op')} from C${C_PRUDENCE}.`) } else { - logi(`-1 op from C${C_PRUDENCE}`) + logi(`-1 op from C${C_PRUDENCE}.`) } ops += game.prudence.DEM if (ops < -1) { @@ -3541,9 +3570,9 @@ function get_tst_6_ops() { if (game.active === COM && game.prudence && game.prudence.COM < 0) { if (ops > 0) { - logi(`${pluralize(game.prudence.COM,'op')} from C${C_PRUDENCE}`) + logi(`${pluralize(game.prudence.COM,'op')} from C${C_PRUDENCE}.`) } else { - logi(`-1 op from C${C_PRUDENCE}`) + logi(`-1 op from C${C_PRUDENCE}.`) } ops += game.prudence.COM if (ops < -1) { @@ -3558,10 +3587,10 @@ function finish_play_card() { if (game.played_card === C_COMMON_EUROPEAN_HOME) { if (game.active === DEM) { game.vp -- - logi(`-1 VP for playing C${C_COMMON_EUROPEAN_HOME} for operations`) + logi(`-1 VP for playing C${C_COMMON_EUROPEAN_HOME} for operations.`) } else { game.vp ++ - logi(`+1 VP for playing C${C_COMMON_EUROPEAN_HOME} for operations`) + logi(`+1 VP for playing C${C_COMMON_EUROPEAN_HOME} for operations.`) } if (check_vp()) { return @@ -3595,9 +3624,10 @@ function finish_the_wall() { } } if (game.active === DEM) { - next_player() + change_player() } game.return = COM + log('Communist removed SP:') vm_next() } else { permanently_remove(C_THE_WALL_MUST_GO) @@ -3615,6 +3645,7 @@ function finish_we_are_the_people() { game.valid_spaces = [...S_EAST_GERMANY] game.vm_max_infl = 2 game.vm_available_ops = game.vm_influence_added[S_LUTHERAN_CHURCH] + log('Placed SP:') game.state = 'vm_we_are_the_people_add' } @@ -3741,7 +3772,7 @@ function end_round() { if (game.active !== DEM) { next_player() } else { - log_h3('Democratic Action Round') + log_side() } if (game.democrat_hand.includes(game.stasi_card)) { log_h3('C' + C_STASI) @@ -3764,7 +3795,7 @@ function end_round() { if (game.active !== DEM) { next_player() } else { - log_h3('Democratic Action Round') + log_side() } game.state = 'choose_card' return @@ -3781,7 +3812,7 @@ function end_round() { } 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}`) + log_round() game.round_player = COM if (game.active !== COM) { next_player() @@ -3792,10 +3823,11 @@ function end_round() { game.state = 'choose_card' game.round_player = COM game.round ++ - log_h2(`Action Round ${game.round}`) + log_round() if (game.active !== COM) { - next_player() + change_player() } + log_side() } } } @@ -3852,7 +3884,7 @@ function new_turn() { if (game.turn > 1) { if (game.persistent_events.includes(C_PRESIDENTIAL_VISIT)) { game.com_hand_limit = 7 - log('Communist draws 7 cards due to C' + C_PRESIDENTIAL_VISIT) + log('Communist draws 7 cards due to C' + C_PRESIDENTIAL_VISIT + '.') permanently_remove(C_PRESIDENTIAL_VISIT) game.persistent_events = game.persistent_events.filter(card => card !== C_PRESIDENTIAL_VISIT) } @@ -3900,11 +3932,13 @@ function end_one_turn_event(event) { function next_player() { clear_undo() - if (game.active === DEM) + if (game.active === DEM) { game.active = COM - else + log_side() + } else { game.active = DEM - log_side() + log_side() + } } function change_player() { @@ -3980,7 +4014,10 @@ function discard(card) { } if (!game.strategy_discard.includes(card)) { game.strategy_discard.push(card) - log(`Discarded C${card}`) + if (game.state === 'vm_tst_3') + logi(`Discarded C${card}.`) + else + log(`Discarded C${card}.`) } } else if (game.is_pwr_struggle) { if (game.active === COM) { @@ -4031,13 +4068,14 @@ function discard_card(hand) { let discarded_card = hand.splice(card, 1)[0] if (game.is_pwr_struggle) { if (numberless_cards.includes(discarded_card)) { - logi(`Discarded: P${discarded_card}`) + logi(`Discarded P${discarded_card}`) } else { - logi(`Discarded: P${discarded_card} V${power_cards[discarded_card].value}`) + logi(`Discarded P${discarded_card} V${power_cards[discarded_card].value}`) } game.power_struggle_discard.push(discarded_card) } else { - log(`Discarded C${discarded_card}`) + if (game.state !== 'vm_brought_in_for_questioning') + log(`Discarded C${discarded_card}.`) game.strategy_discard.push(discarded_card) } return discarded_card @@ -4084,7 +4122,19 @@ function reset_power() { function check_tyrant() { if (game.the_tyrant_is_gone > 0 && check_dem_control(game.the_tyrant_is_gone)) { - log('+2 VP from C' + C_THE_TYRANT_IS_GONE) + log_summary('+2 VP from C' + C_THE_TYRANT_IS_GONE + '.') + game.vp += 2 + if (check_vp()) { + do_log_summary() + return + } + delete game.the_tyrant_is_gone + } +} + +function check_tyrant_sc() { + if (game.the_tyrant_is_gone > 0 && check_dem_control(game.the_tyrant_is_gone)) { + logi('+2 VP from C' + C_THE_TYRANT_IS_GONE + '.') game.vp += 2 if (check_vp()) { return @@ -4101,7 +4151,7 @@ function resolve_tyrant() { ) { game.return_state = 'finish_scoring' if (game.active !== DEM) { - next_player() + change_player() } game.state = 'the_tyrant_is_gone' } else { @@ -4149,15 +4199,32 @@ function log(msg) { game.log.push(msg) } +function log_event(n) { + log_br() + if (cards[n].side === "C") + game.log.push(".E:C" + n + ".C") + else if (cards[n].side === "D") + game.log.push(".E:C" + n + ".D") + else + game.log.push(".E:C" + n + ".N") +} + function log_br() { - if (game.log.length > 0 && game.log[game.log.length - 1] !== "") + console.log('log_br_called') + if (game.log.length > 0 && game.log[game.log.length - 1] !== "") { game.log.push("") + console.log('space added') + } } function logi(msg) { game.log.push(">" + msg) } +function logii(msg) { + game.log.push(">>" + msg) +} + function log_h1(msg) { log(".h1 " + msg) } @@ -4183,6 +4250,10 @@ function log_msg_gap(msg) { function logi_msg_gap(msg) { game.log.push(">" + msg) log_br() +} + +function log_round() { + log_h2(`Action Round ${game.round}`) } function log_side() { @@ -4202,7 +4273,7 @@ function push_summary() { function log_summary(msg) { - if (msg.startsWith('Added') || msg.startsWith('Removed')) { + if (msg.startsWith('Added') || msg.startsWith('£')) { for (let item of game.summary) { if (item[1] === msg) { item[0]++ @@ -4217,9 +4288,9 @@ function pop_summary() { if (game.summary.length > 0) { for (let [n, msg] of game.summary) { if (n > 1) { - log(msg.replace("£ SP", `${n} SPs`)) + log(msg.replace("£ SP", `${n}`)) } else { - log(msg.replace("£ SP", `${n} SP`)) + log(msg.replace("£ SP", `${n}`)) } } } @@ -4229,11 +4300,7 @@ function pop_summary() { function pop_summary_i() { if (game.summary.length > 0) { for (let [n, msg] of game.summary) { - if (n > 1) { - logi(msg.replace("£ SP", `${n} SPs`)) - } else { - logi(msg.replace("£ SP", `${n} SP`)) - } + logi(msg.replace("£", `${n}`)) } } game.summary = [] @@ -4241,7 +4308,7 @@ function pop_summary_i() { function do_log_summary() { if (game.summary.length > 0) { - pop_summary() + pop_summary_i() } } @@ -4334,6 +4401,11 @@ function vm_next() { vm_exec() } +function vm_log() { + log(vm_operand(1)) + vm_next() +} + function vm_logi() { logi(vm_operand(1)) vm_next() @@ -4453,7 +4525,8 @@ function vm_return() { function vm_end_event() { if (game.return !== game.active) { - next_player() + //next_player() + change_player() } if (game.return_state === 'power_struggle') { do_valid_cards() @@ -4676,12 +4749,15 @@ function vm_take_control(space) { } } game.valid_spaces = game.valid_spaces.filter(id => id !== space) - log(`Took control of %${space}`) + if (game.state === 'vm_kremlin_coup_take_control') + logi(`Took control of %${space}.`) + else + log(`Took control of %${space}.`) } function vm_do_add_infl_free(space) { push_undo() - log_summary(`Added £ SP in %${space}`) + log_summary(`£ - %${space}`) // Update influence values if (game.active === COM) { @@ -4704,17 +4780,22 @@ function vm_add_infl_free() { if (vm_operand(1)) { game.vm_available_ops = vm_operand(1) } + log('Placed SP:') game.state = 'vm_add_infl_free' } function vm_add_x_infl() { game.vm_available_ops = vm_operand(1) + console.log('game.vm_event', game.vm_event, 'game.vm.prompt',game.vm.prompt, event_prompt()) + if (!(game.vm_event === C_PUBLIC_AGAINST_VIOLENCE && + event_prompt() === 'Presov')) + log('Placed SP:') game.state = 'vm_add_x_infl' } function vm_do_add_x_infl(space) { push_undo() - log(`Added ${game.vm_available_ops} SPs in %${space}`) + logi(`${game.vm_available_ops} - %${space}`) if (game.active === COM) { game.comInfl[space] += game.vm_available_ops } else { @@ -4728,12 +4809,13 @@ function vm_do_add_x_infl(space) { function vm_add_limited_infl() { game.vm_available_ops = vm_operand(1) game.vm_max_infl = vm_operand(2) + log('Placed SP:') game.state = 'vm_add_limited_infl' } function vm_do_add_limited_infl(space, max_infl) { push_undo() - log_summary(`Added £ SP in %${space}`) + log_summary(`£ - %${space}`) game.vm_available_ops -- if (!game.vm_influence_added) { @@ -4772,6 +4854,7 @@ function vm_remove_opp_infl() { if (game.is_pwr_struggle) { game.state = 'vm_scare_tactics' } else { + log('Removed SP:') game.state = 'vm_remove_infl' } } @@ -4779,6 +4862,7 @@ function vm_remove_opp_infl() { function vm_remove_x_opp_infl() { game.vm_available_ops = vm_operand(1) game.remove_opponent_infl = true + log('Removed SP:') game.state = 'vm_remove_x_infl' } @@ -4819,7 +4903,7 @@ function vm_do_remove_x_infl(space) { } } - log(`Removed ${game.vm_available_ops} SPs from %${space}`) + logi(`${game.vm_available_ops} - %${space}`) check_tyrant() game.vm_available_ops = 0 game.valid_spaces = [] @@ -4829,12 +4913,13 @@ function vm_remove_limited_opp_infl() { game.vm_available_ops = vm_operand(1) game.vm_max_infl = vm_operand(2) game.remove_opponent_infl = true + log('Removed SP:') game.state = 'vm_remove_limited_infl' } function vm_do_remove_limited_infl(space, max_infl) { push_undo() - log_summary(`Removed £ SP from %${space}`) + log_summary(`£ - %${space}`) game.vm_available_ops -- if (!game.vm_influence_added) { @@ -4879,20 +4964,20 @@ function vm_do_remove_all_infl(space) { if (game.remove_opponent_infl === true) { if (game.active === COM) { - log(`Removed all Democratic SP from %${space}`) + log(`Removed all Democratic SP from %${space}.`) game.demInfl[space] = 0 } else { - log(`Removed all Communist SP from %${space}`) + log(`Removed all Communist SP from %${space}.`) game.comInfl[space] = 0 } check_tyrant() } else { if (game.active === COM) { - log(`Removed all Communist SP from %${space}`) + log(`Removed all Communist SP from %${space}.`) game.comInfl[space] = 0 } else { - log(`Removed all Democratic SP from %${space}`) + log(`Removed all Democratic SP from %${space}.`) game.demInfl[space] = 0 } check_tyrant() @@ -4904,11 +4989,11 @@ function vm_do_remove_all_infl(space) { function vm_replace_all_infl(space_id) { if (game.active === DEM) { game.demInfl[space_id] += game.comInfl[space_id] - log(`Replaced ${game.comInfl[space_id]} Communist SP in %${space_id} with Democratic SP`) + log(`Replaced ${game.comInfl[space_id]} Communist SP in %${space_id} with Democratic SP.`) game.comInfl[space_id] = 0 } else { game.comInfl[space_id] += game.demInfl[space_id] - log(`Replaced ${game.demInfl[space_id]} Democrat SP in %${space_id} with Communist SP`) + log(`Replaced ${game.demInfl[space_id]} Democrat SP in %${space_id} with Communist SP.`) game.demInfl[space_id] = 0 } check_tyrant() @@ -4916,17 +5001,28 @@ function vm_replace_all_infl(space_id) { function vm_1_support_check() { game.vm_available_ops = 1 + log('Support Check:') + if (game.valid_spaces.length === 0) + logi('None') game.state = 'vm_1_support_check_prep' } function vm_support_check() { game.vm_available_ops = vm_operand(1) + if (game.vm_available_ops > 1) + log('Support Checks:') + else + log('Support Check:') game.state = 'vm_support_check_prep' } function vm_support_check_modified() { game.vm_available_ops = vm_operand(1) game.support_check_modifier = vm_operand(2) + if (game.vm_available_ops > 1) + log('Support Checks:') + else + log('Support Check:') game.state = 'vm_support_check_prep' } @@ -4934,7 +5030,7 @@ function vm_switch_infl(id) { push_undo() game.demInfl[id] -= game.vm_available_ops game.comInfl[id] += game.vm_available_ops - log(`Replaced ${pluralize(game.vm_available_ops,'SP')} in %${id}`) + log(`Replaced ${pluralize(game.vm_available_ops,'SP')} in %${id}.`) game.vm_available_ops = 0 check_tyrant() } @@ -4952,7 +5048,7 @@ function vm_40th_anniversary_celebration() { function vm_40th_anniversary_celebration_vp() { game.vp -- - log('-1VP') + log('-1 VP') if (check_vp()) { return } @@ -4968,19 +5064,19 @@ function vm_army_backs_revolution() { permanently_remove(C_SECURITATE) } add_to_persistent_events(C_ARMY_BACKS_REVOLUTION) - logi_msg_gap(`C${C_SECURITATE} no longer has any effect`) + log(`C${C_SECURITATE} no longer has any effect.`) vm_next() } function vm_army_block() { permanently_remove(C_SECURITATE) - logi_msg_gap(`Has no effect after C${C_ARMY_BACKS_REVOLUTION}`) + log(`Has no effect after C${C_ARMY_BACKS_REVOLUTION}.`) vm_next() } function vm_austria_hungary_border_reopened() { add_to_persistent_events(C_AUSTRIA_HUNGARY_BORDER_REOPENED) - logi_msg_gap(`For the remainder of the turn, cards played by the Democrat have +1 Ops value if all Operations Points are used in East Germany`) + log(`For the remainder of the turn, cards played by the Democrat have +1 Ops value if all Operations Points are used in East Germany.`) game.austria_hungary_border_reopened_tracker = false vm_next() } @@ -5024,7 +5120,7 @@ function vm_brought_in_for_questioning() { function vm_bulgarian_turks_expelled() { game.remove_opponent_infl = true game.vp -= 2 - log('-2VP') + log('-2 VP') if (check_vp()) { return } @@ -5148,28 +5244,28 @@ function vm_domino_theory() { function vm_domino_theory_pass() { if (game.revolutions.filter(value => value === true).length < 2) { - logi_msg_gap('Democrat holds power in fewer than 2 countries') + log('Democrat holds power in fewer than 2 countries.') } else if (!scoring_cards.some(card => game.strategy_discard.includes(card))) { - logi_msg_gap('No scoring cards in discard') + log('No scoring cards in discard.') } vm_next() } function vm_eco_glasnost() { add_to_persistent_events(C_ECO_GLASNOST) - logi_msg_gap(`+1 VP for Communist Support Checks in Ruse for the rest of the game`) + log(`+1 VP for Communist Support Checks in Ruse for the rest of the game.`) vm_next() } function vm_elena() { add_to_persistent_events(C_ELENA) - logi_msg_gap(`-1 modifier to Democratic Support Checks in Romania for the rest of this turn`) + log(`-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 - log(`Eliminated %${space_id}`) + log(`Eliminated %${space_id}.`) if (space_id === S_BUCURESTI) { game.demInfl[space_id] = 0 game.comInfl[space_id] = 0 @@ -5177,7 +5273,7 @@ function vm_eliminate(space_id) { game.demInfl[space_id] = 0 game.comInfl[S_BUCURESTI] += game.comInfl[space_id] if (game.comInfl[space_id] > 0 ) { - log(`${pluralize(game.comInfl[space_id],'Communist SP')} relocated to %${S_BUCURESTI}`) + log(`${pluralize(game.comInfl[space_id],'Communist SP')} relocated to %${S_BUCURESTI}.`) } game.comInfl[space_id] = 0 } @@ -5203,7 +5299,7 @@ function vm_exit_visas() { } function vm_foreign_currency_debt_burden() { - log('+1VP') + log('+1 VP') game.vp++ if (check_vp()) { return @@ -5226,19 +5322,19 @@ function vm_foreign_television() { } function vm_frg_embassies() { add_to_persistent_events(C_FRG_EMBASSIES) - logi_msg_gap(`+1 modifier for Democratic Support Checks in Eastern Europe for the rest of this turn`) + log(`+1 modifier for Democratic Support Checks in Eastern Europe for the rest of this turn.`) vm_next() } function vm_general_strike() { add_to_persistent_events(C_GENERAL_STRIKE) - logi_msg_gap(`Each Action Round the Communist must instead discard a card and roll a die until the modified die roll exceeds 5`) + log(`Each Action Round the Communist must instead discard a card and roll a die until the modified die roll exceeds 5.`) vm_next() } function vm_genscher() { add_to_persistent_events(C_GENSCHER) - logi_msg_gap(`Cancels +1 Ops cost to place Democratic SPs in Communist controlled spaces in East Germany for the rest of the turn`) + log(`Cancels +1 Ops cost to place Democratic SPs in Communist controlled spaces in East Germany for the rest of the turn.`) vm_next() } @@ -5273,7 +5369,7 @@ function vm_government_resigns() { function vm_grenztruppen() { add_to_persistent_events(C_GRENZTRUPPEN) - logi_msg_gap(`-1 modifier for Democratic Support Checks in East Germany for the rest of this turn`) + log(`-1 modifier for Democratic Support Checks in East Germany for the rest of this turn`) vm_next() } @@ -5299,13 +5395,13 @@ function vm_heal_our_bleeding_wounds() { function vm_helsinki_final_act() { add_to_persistent_events(C_HELSINKI_FINAL_ACT) - logi_msg_gap(`+1 VP for every Support Check by the Communist Player in Student or Intellectual spaces for the rest of the game`) + log(`+1 VP for every Support Check by the Communist Player in Student or Intellectual spaces for the rest of the game.`) vm_next() } function vm_honecker() { add_to_persistent_events(C_HONECKER) - logi_msg_gap(`The Communist may take one extra Action Round this turn`) + log(`The Communist may take one extra Action Round this turn.`) game.valid_cards = [] for (let c of game.strategy_discard) { if (scoring_cards.includes(c)) { @@ -5325,7 +5421,7 @@ function vm_inflationary_currency() { function vm_inflationary_currency_discard() { // This function starts with the player who is playing Inflationary Currency for the Event // Switch player and check the hand of their opponent to see if the have cards with ops > 3 to discard - next_player() + change_player() if (game.active === COM) { for (let card of game.communist_hand) { if (get_card_ops(card) >= 3) { @@ -5386,7 +5482,7 @@ function vm_kremlin_coup() { function vm_laszlo_tokes_prep() { add_to_persistent_events(C_LASZLO_TOKES) - logi_msg_gap(`Allows play of C${C_MASSACRE_IN_TIMISOARA}`) + log(`Allows play of C${C_MASSACRE_IN_TIMISOARA}.`) game.playable_cards.push(C_MASSACRE_IN_TIMISOARA) vm_next() } @@ -5412,13 +5508,13 @@ function vm_legacy_of_1968() { function vm_li_peng() { add_to_persistent_events(C_LI_PENG) - logi_msg_gap(`+1 modifier to all Communist Tiananmen Square Attempts for the rest of the game`) + log(`+1 modifier to all Communist Tiananmen Square Attempts for the rest of the game.`) vm_next() } function vm_ligachev() { add_to_persistent_events(C_LIGACHEV) - logi_msg_gap(`-3VPs if the Democrat does not play C${C_GORBACHEV_CHARMS_THE_WEST} next Action Round`) + log(`-3 VPs if the Democrat does not play C${C_GORBACHEV_CHARMS_THE_WEST} next Action Round.`) vm_next() } @@ -5435,7 +5531,7 @@ function vm_massacre_in_timisoara() { function vm_modrow() { game.playable_cards = game.playable_cards.filter(n => n !== C_HONECKER) add_to_persistent_events(C_MODROW) - logi_msg_gap(`Prevents play of C${C_HONECKER} for the event`) + log(`Prevents play of C${C_HONECKER} for the event.`) game.state = 'vm_modrow' } @@ -5448,7 +5544,7 @@ function vm_nagy_reburied() { function vm_national_salvation_front() { add_to_persistent_events(C_NATIONAL_SALVATION_FRONT) - logi_msg_gap(`In the next Power Struggle in the Balkans, the Communist draws 2 random Power Struggle cards from the Democrat hand`) + log(`In the next Power Struggle in the Balkans, the Communist draws 2 random Power Struggle cards from the Democrat hand.`) vm_next() } @@ -5477,13 +5573,13 @@ function vm_normalization() { function vm_peasant_parties_revolt() { add_to_persistent_events(C_PEASANT_PARTIES_REVOLT) - logi_msg_gap(`In the next Power Stuggle, if the Democrat controls a Farmer space draw 1 Power Struggle card at random from the Communist hand`) + log(`In the next Power Stuggle, if the Democrat controls a Farmer space draw 1 Power Struggle card at random from the Communist hand.`) vm_next() } function vm_perestroika() { add_to_persistent_events(C_PERESTROIKA) - logi_msg_gap(`+1 Ops value for cards played by the Communist for the rest of this turn`) + log(`+1 Ops value for cards played by the Communist for the rest of this turn.`) vm_next() } @@ -5509,7 +5605,7 @@ function vm_power_struggle() { // Check for Securitate if (game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(C_SECURITATE)) { - log(`C${C_SECURITATE}: Democrat reveals Power Struggle cards`) + log(`C${C_SECURITATE}: Democrat reveals Power Struggle cards.`) game.opp_power_hand = true } log_h2('Deal Cards') @@ -5518,7 +5614,7 @@ function vm_power_struggle() { function vm_presidential_visit() { add_to_persistent_events(C_PRESIDENTIAL_VISIT) - logi_msg_gap(`Communist hand size is reduced to 7 next turn`) + log(`Communist hand size is reduced to 7 next turn.`) vm_next() } @@ -5528,10 +5624,10 @@ function vm_prudence() { } if (game.active === DEM) { game.prudence.COM-- - log(`${game.prudence.COM} to Communist Ops this turn`) + log(`${game.prudence.COM} to Communist Ops this turn.`) } else { game.prudence.DEM-- - log(`${game.prudence.DEM} to Democrat Ops this turn`) + log(`${game.prudence.DEM} to Democrat Ops this turn.`) } vm_next() } @@ -5564,7 +5660,7 @@ function vm_reformer_rehabilitated() { function vm_roundtable_talks() { add_to_persistent_events(C_ROUNDTABLE_TALKS) - logi_msg_gap(`In the next Power Struggle the Democrat draws 2 random Power Struggle cards from the Communist hand`) + log(`In the next Power Struggle the Democrat draws 2 random Power Struggle cards from the Communist hand.`) vm_next() } @@ -5586,7 +5682,7 @@ function vm_sajudis() { if (check_vp()) { return } - log(`Allows play of C${C_THE_BALTIC_WAY}`) + log(`Allows play of C${C_THE_BALTIC_WAY}.`) vm_next() } @@ -5596,7 +5692,7 @@ function vm_samizdat() { function vm_securitate() { add_to_persistent_events(C_SECURITATE) - logi_msg_gap(`The Democrat must reveal their Power Struggle cards at the start of Power Struggles in Romania`) + log(`The Democrat must reveal their Power Struggle cards at the start of Power Struggles in Romania.`) vm_next() } @@ -5611,7 +5707,7 @@ function vm_social_democratic_platform_adopted() { function vm_solidarity_legalised() { game.playable_cards.push(C_WALESA) add_to_persistent_events(C_SOLIDARITY_LEGALIZED) - logi_msg_gap(`Allows play of C${C_WALESA}`) + log(`Allows play of C${C_WALESA}.`) vm_next() } @@ -5622,24 +5718,24 @@ function vm_solidarity_legalised_spaces() { function vm_st_nicholas_church() { add_to_persistent_events(C_ST_NICHOLAS_CHURCH) - logi_msg_gap(`Allows play of C${C_THE_MONDAY_DEMONSTRATIONS}`) + log(`Allows play of C${C_THE_MONDAY_DEMONSTRATIONS}.`) game.playable_cards.push(C_THE_MONDAY_DEMONSTRATIONS) vm_next() } function vm_stasi() { add_to_persistent_events(C_STASI) - logi_msg_gap(`For the rest of this turn the Democrat must reveal the card they will play this Action Round before the Communist player plays a card`) + log(`For the rest of this turn the Democrat must reveal the card they will play this Action Round before the Communist player plays a card`) vm_next() } function vm_stand_fast() { add_to_persistent_events(C_STAND_FAST) if (game.active === DEM) { - logi_msg_gap(`-1 Modifier to Support Checks in Democratic controlled spaces for the rest of this turn`) + log(`-1 Modifier to Support Checks in Democratic controlled spaces for the rest of this turn`) game.stand_fast = DEM } else { - logi_msg_gap(`-1 Modifier to Support Checks in Communist controlled spaces for the rest of this turn`) + log(`-1 Modifier to Support Checks in Communist controlled spaces for the rest of this turn`) game.stand_fast = COM } vm_next() @@ -5650,6 +5746,7 @@ function vm_systematization() { } function vm_tank_column() { + log('Advances 1 space on Tiananmen Square Track.') if (game.active === DEM) { game.dem_tst_position++ game.dem_tst_attempted = 0 @@ -5689,7 +5786,7 @@ function vm_tank_column() { function vm_tear_gas() { add_to_persistent_events(C_TEAR_GAS) - logi_msg_gap(`+1 modifier to the next Communist Support Check in a Student space`) + log(`+1 modifier to the next Communist Support Check in a Student space`) vm_next() } @@ -5701,7 +5798,7 @@ function vm_the_baltic_way_prep() { if (check_vp()) { return } - log(`Allows play of C${C_BREAKAWAY_BALTIC_REPUBLICS}`) + log(`Allows play of C${C_BREAKAWAY_BALTIC_REPUBLICS}.`) vm_next() } @@ -5721,7 +5818,7 @@ function vm_the_chinese_solution() { function vm_the_crowd_turns_against_ceausescu() { add_to_persistent_events(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU) - logi_msg_gap(`Power Struggle: Romania. Democrat draws 15 Power Struggle cards and takes 1 Action Round using Ops 3 times the number of Rallies. Allows play of C${C_THE_TYRANT_IS_GONE}.`) + log(`Power Struggle: Romania. Democrat draws 15 Power Struggle cards and takes 1 Action Round using Ops 3 times the number of Rallies. Allows play of C${C_THE_TYRANT_IS_GONE}.`) game.playable_cards.push(C_THE_TYRANT_IS_GONE) vm_next() } @@ -5738,12 +5835,12 @@ function vm_the_monday_demonstrations() { function vm_the_sinatra_doctrine() { add_to_persistent_events(C_THE_SINATRA_DOCTRINE) - logi_msg_gap(`+1 Ops value for cards played by the Democrat for the rest of this turn`) + log(`+1 Ops value for cards played by the Democrat for the rest of this turn.`) vm_next() } function vm_the_third_way() { - log('-2VP') + log('-2 VP') game.vp -= 2 if (check_vp()) { return @@ -5769,18 +5866,18 @@ function vm_the_tyrant_is_gone() { function vm_the_tyrant_is_gone_prep() { add_to_persistent_events(C_THE_TYRANT_IS_GONE) - logi_msg_gap(`After C${C_THE_CROWD_TURNS_AGAINST_CEAUSESCU} occurs, remove 4 Commuist SPs from the Romanian Elite space. The Democrats choose where the Ceausescus flee to`) + log(`After C${C_THE_CROWD_TURNS_AGAINST_CEAUSESCU} occurs, remove 4 Commuist SPs from the Romanian Elite space. The Democrats choose where the Ceausescus flee to.`) vm_next() } function vm_tyrant_block() { - logi_msg_gap(`Has no effect after C${C_THE_TYRANT_IS_GONE}`) + log(`Has no effect after C${C_THE_TYRANT_IS_GONE}.`) vm_next() } function vm_the_wall() { add_to_persistent_events(C_THE_WALL) - logi_msg_gap(`Cancels the modifier for any Democratic controlled spaces for the next Communist Support Check in East Germany`) + log(`Cancels the modifier for any Democratic controlled spaces for the next Communist Support Check in East Germany.`) vm_next() } @@ -5802,7 +5899,8 @@ function vm_we_are_the_people() { game.valid_spaces = [ S_LUTHERAN_CHURCH ] } add_to_persistent_events(C_WE_ARE_THE_PEOPLE) - logi_msg_gap(`The Communist may no longer make Support Checks in Leipzig`) + log(`The Communist may no longer make Support Checks in Leipzig.`) + log('Removed SP:') if (!game.vm_influence_added) { game.vm_influence_added = {} } @@ -5832,7 +5930,7 @@ function vm_workers_revolt() { function vm_yakovlev_counsels_gorbachev() { add_to_persistent_events(C_YAKOVLEV_COUNSELS_GORBACHEV) - logi_msg_gap(`The Democrat receives a +1 modifier to the Support Loss and Victory Point die rolls if they wins the next Power Struggle`) + log(`The Democrat receives a +1 modifier to the Support Loss and Victory Point die rolls if they wins the next Power Struggle.`) vm_next() } @@ -5854,14 +5952,15 @@ function discarded_card() { // =================== TIANANMEN SQUARE TRACK FUNCTIONS ==================== function vm_tst_3() { - log_gap('Tiananmen Square Track Award') + log('Tiananmen Square Track Award:') game.state = 'vm_tst_3_prep' } function vm_tst_4() { - log_gap('Tiananmen Square Track Award') + log('Tiananmen Square Track Award:') game.vm_available_ops = 2 game.remove_opponent_infl = true + log('Removed SP:') game.state = 'vm_tst_4' } function vm_tst_6() { @@ -5888,7 +5987,7 @@ function vm_support_surges() { function vm_support_falters() { game.vm_available_ops = 2 game.return === game.active - log(`P${PC_SUPPORT_FALTERS}:`) + log(`${game.active}:`) game.state = 'vm_support_falters' } @@ -5899,6 +5998,8 @@ function vm_kremlin_coup_elite() { game.valid_spaces.push(space) } }) + if (game.valid_spaces.length === 0) + logi(`Elite space already controlled.`) game.state = 'vm_kremlin_coup_take_control' } @@ -6129,7 +6230,7 @@ states.vm_remove_infl = { }, done() { if (game.summary.length > 0) { - pop_summary() + pop_summary_i() } else { log('No influence to remove') } @@ -6409,11 +6510,11 @@ states.vm_adamec = { } log(`Modified roll: ${Math.max(roll, 0)}`) if (roll > 2) { - log_msg_gap('Adamec succeeds') + log(`Success: ${roll} >= 3`) vm_next() return } - log('Adamec fails: 3 or more required') + log(`Fail: ${roll} < 3`) permanently_remove(C_ADAMEC) vm_return() }, @@ -6431,8 +6532,9 @@ states.vm_brought_in_for_questioning = { }, discard() { clear_undo() - log(`C${C_BROUGHT_IN_FOR_QUESTIONING}:`) + //log(`C${C_BROUGHT_IN_FOR_QUESTIONING}:`) game.vm_event = discard_card(game.democrat_hand) + log(`Democrat discarded C${game.vm_event}.`) 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) { @@ -6443,18 +6545,19 @@ states.vm_brought_in_for_questioning = { } } if (!is_auto_resolve(game.vm_event) && !switch_events.includes(game.vm_event)) { - next_player() + //next_player() + change_player() } - log(`C${game.vm_event}:`) + log_event(game.vm_event) goto_vm(game.vm_event) } else { - logi_msg_gap('Event does not occur') + log('Event does not occur.') game.return = DEM vm_return() } }, pass() { - log('No cards to discard') + log('No cards to discard.') vm_return() }, } @@ -6477,35 +6580,35 @@ states.vm_central_committee_reshuffle = { east_germany() { push_undo() game.vm_active_country = "East_Germany" - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) game.valid_spaces = [...S_EAST_GERMANY] vm_next() }, poland() { push_undo() game.vm_active_country = "Poland" - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) game.valid_spaces = [...S_POLAND] vm_next() }, czechoslovakia() { push_undo() game.vm_active_country = "Czechoslovakia" - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) game.valid_spaces = [...S_CZECHOSLOVAKIA] vm_next() }, hungary() { push_undo() game.vm_active_country = "Hungary" - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) game.valid_spaces = [...S_HUNGARY] vm_next() }, romania() { push_undo() game.vm_active_country = "Romania" - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) game.valid_spaces = [...S_ROMANIA] game.valid_spaces = game.valid_spaces.filter(space => space !== game.systematization) vm_next() @@ -6513,12 +6616,12 @@ states.vm_central_committee_reshuffle = { bulgaria() { push_undo() game.vm_active_country = "Bulgaria" - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) game.valid_spaces = [...S_BULGARIA] vm_next() }, pass() { - log('Passed') + log('Passed.') vm_return() }, } @@ -6535,6 +6638,7 @@ states.vm_common_european_home_choose = { game.valid_cards = [] silent_discard(card) game.vm_event = card + log(`Played C${game.vm_event}.`) game.state = 'vm_common_european_home_play' }, } @@ -6550,7 +6654,7 @@ states.vm_common_european_home_play = { }, influence() { push_undo() - log_gap(`Played C${game.vm_event} to place SPs`) + log('Placed SP:') game.vm_available_ops = get_card_ops(game.vm_event) valid_spaces_infl() // If ABHR - Set AHBR tracker to true @@ -6561,12 +6665,12 @@ states.vm_common_european_home_play = { }, support_check() { push_undo() - log_gap(`Played C${game.vm_event} for Support Checks`) + log('Support Checks:') game.vm_available_ops = 2 game.state = 'vm_ceh_support_check_prep' valid_spaces_sc() }, - tst() { + tst() { /*Should this be an option? */ push_undo() log_gap(`Played C${game.vm_event} to the Tiananmen Square Track`) game.state = 'vm_tiananmen_square_attempt' @@ -6584,7 +6688,7 @@ states.vm_dash_for_the_west = { log(`Roll: D${roll}`) let com_control = check_presence('East_Germany').com_spaces if (roll > com_control) { - log(`Success. More than the ${com_control} Communist controlled spaces in East Germany`) + log(`Success: ${roll} > ${com_control} Communist controlled spaces in East Germany.`) log('+1 VP') game.vp++ if (check_vp()) { @@ -6593,7 +6697,7 @@ states.vm_dash_for_the_west = { game.discard = true game.state = 'vm_play_event_from_discard' } else { - log(`Fail: more than a ${com_control} required`) + log(`Fail: ${roll} <= ${com_control} Communist controlled spaces in East Germany.`) vm_next() } }, @@ -6614,22 +6718,24 @@ states.vm_play_event_from_discard = { }, card(card) { push_undo() - log(`C${this_card()}:`) - log(`Chose C${card}`) + //log(`C${this_card()}:`) + log(`Chose C${card}.`) game.vm_event = card game.vm_available_ops = cards[card].ops game.discard = false if (switch_events.includes(card)) { - next_player() + change_player() } + if (!scoring_cards.includes(card)) + log_event(card) goto_vm(card) }, pass() { push_undo() if (game.valid_cards.length === 0) { - log('No valid cards to choose') + log('No valid cards to choose.') } else { - log('Did not choose a card') + log('Did not choose a card.') } vm_next() }, @@ -6649,7 +6755,7 @@ states.vm_deutsche_marks_prep = { }, card(card) { push_undo() - log(`Gave C${card}`) + log(`Democrat gave C${card}.`) game.valid_cards = [] silent_discard(card) game.state = 'vm_deutsche_marks_confirm' @@ -6670,7 +6776,8 @@ states.vm_deutsche_marks_confirm = { if (cards[game.vm_event].side === "C" && (is_auto_resolve(game.vm_event) || switch_events.includes(game.vm_event))) { goto_vm(game.vm_event) } else { - next_player() + //next_player() + change_player() game.state = 'vm_deutsche_marks' } }, @@ -6691,7 +6798,8 @@ states.vm_deutsche_marks = { }, event() { push_undo() - log(`Played C${game.vm_event} for the event`) + //log(`Played C${game.vm_event} for the event`) + log_event(game.vm_event) if (!game.vm_infl_to_do) { game.return = game.active } @@ -6699,21 +6807,21 @@ states.vm_deutsche_marks = { }, influence() { push_undo() - log(`Played C${game.vm_event} to place SPs`) game.vm_available_ops = get_card_ops(game.vm_event) + log(`Placed SP:`) valid_spaces_infl() game.state = 'vm_add_infl' }, support_check() { push_undo() - log_gap(`Played C${game.vm_event} for Support Checks`) + log(`Support Checks:`) game.vm_available_ops = 2 game.state = 'vm_support_check_prep' valid_spaces_sc() }, tst() { push_undo() - log_gap(`Played C${game.vm_event} to the Tiananmen Square Track`) + log_gap(`Tiananmen Square Track`) game.state = 'vm_tiananmen_square_attempt' }, } @@ -6785,31 +6893,31 @@ states.vm_foreign_currency_debt_burden = { east_germany() { push_undo() game.foreign_currency_debt_burden = 'East_Germany' - log('Selected East Germany') + //log('Chose East Germany.') vm_next() }, poland() { push_undo() game.foreign_currency_debt_burden = 'Poland' - log('Selected Poland') + //log('Chose Poland.') vm_next() }, czechoslovakia() { push_undo() game.foreign_currency_debt_burden = 'Czechoslovakia' - log('Selected Czechoslovakia') + //log('Chose Czechoslovakia.') vm_next() }, hungary() { push_undo() game.foreign_currency_debt_burden = 'Hungary' - log('Selected Hungary') + //log('Chose Hungary.') vm_next() }, bulgaria() { push_undo() game.foreign_currency_debt_burden = 'Bulgaria' - log('Selected Bulgaria') + //log('Chose Bulgaria.') vm_next() }, } @@ -6840,9 +6948,9 @@ states.vm_goodbye_lenin = { ops() { push_undo() if (game.valid_cards.length === 0) { - logi('No red events') + log('No red events.') } - log("C" + C_GOODBYE_LENIN + " played for operations") + log("C" + C_GOODBYE_LENIN + " played for operations.") game.view_opp_hand = false game.state = 'vm_goodbye_lenin_ops' }, @@ -6900,14 +7008,14 @@ states.vm_honecker = { card(card) { push_undo() game.valid_cards = [] - log(`Took C${card} into hand`) + log(`Took C${card} into hand.`) let card_index = game.strategy_discard.indexOf(card) game.strategy_discard.splice(card_index, 1) game.communist_hand.push(card) vm_next() }, pass() { - log('Did not take a card') + log('Did not take a card.') game.discard = false vm_next() }, @@ -6940,41 +7048,41 @@ states.vm_inflationary_currency = { east_germany() { push_undo() game.vm_active_country = 'East_Germany' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) vm_next() }, poland() { push_undo() game.vm_active_country = 'Poland' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) vm_next() }, czechoslovakia() { push_undo() game.vm_active_country = 'Czechoslovakia' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) vm_next() }, hungary() { push_undo() game.vm_active_country = 'Hungary' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) vm_next() }, romania() { push_undo() game.vm_active_country = 'Romania' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) vm_next() }, bulgaria() { push_undo() game.vm_active_country = 'Bulgaria' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) vm_next() }, pass() { - log('Passed') + log('Passed.') vm_return() }, } @@ -7007,8 +7115,8 @@ states.vm_inflationary_currency_discard = { }, pass() { push_undo() - log('Did not discard') - next_player() + log(`${game.active} did not discard.`) + change_player() game.vm_available_ops = 1 vm_next() }, @@ -7026,14 +7134,12 @@ states.vm_kiss_of_death = { }, discard() { clear_undo() - log(`C${C_KISS_OF_DEATH}:`) game.vm_event = discard_card(game.communist_hand) // Change player before checking if event is playable. Common European Home is not playable here change_player() // Special check for the Reformer Rehabilitated if (game.vm_event === C_REFORMER_REHABILITATED && game.dem_tst_position > game.com_tst_position) { - log_side() - log(`C${game.vm_event}:`) + log_event(game.vm_event) game.state = 'vm_kiss_of_death_finish' } else if ( cards[game.vm_event].side !== 'C' && @@ -7044,18 +7150,17 @@ states.vm_kiss_of_death = { change_player() game.state = 'vm_kiss_of_death_finish' } else { - log_side() - log(`C${game.vm_event}:`) + log_event(game.vm_event) game.state = 'vm_kiss_of_death_finish' } } else { change_player() - logi('Event does not occur') + logi('Event does not occur.') vm_next() } }, pass() { - log('No card to discard') + log('No card to discard.') vm_next() }, } @@ -7177,6 +7282,7 @@ states.vm_kremlin_coup_sc_prep = { }, space(_space) { push_undo() + log('Support check:') game.state = 'vm_kremlin_coup_sc' }, } @@ -7262,7 +7368,7 @@ states.vm_malta_summit = { log(`Modified roll: ${roll + Math.min(game.stability, 3)}`) } if (roll + game.stability > 3) { - log('Summit successful') + log(`Success: ${roll + game.stability} >= 4`) game.vp += 3 log('+3 VP') if (check_vp()) { @@ -7278,7 +7384,7 @@ states.vm_malta_summit = { vm_next() } else { - log('Summit failed. Required 4 or more') + log(`Fail: ${roll + game.stability} < 4`) vm_return() } }, @@ -7295,11 +7401,11 @@ states.vm_modrow = { let dem_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_dem_control(space.space_id)).length if (roll > dem_spaces) { log(`Roll: D${roll}`) - log(`Success. More than the ${dem_spaces} Democratically controlled spaces`) + log(`Success: ${roll} > ${dem_spaces} Democratic spaces`) vm_next() } else { log(`Roll: D${roll}`) - log(`Fail. More than ${dem_spaces} required`) + log(`Fail: ${roll} <= ${dem_spaces} Democratic spaces`) permanently_remove(C_MODROW) vm_return() } @@ -7337,13 +7443,15 @@ states.vm_new_years_eve_party = { end() { push_undo() game.persistent_events.push(C_NEW_YEARS_EVE_PARTY) - log('Chooses to end the game. There will be no final scoring') + log('Choses to end the game. There will be no final scoring.') let power = game.revolutions.filter(value => value === false).length if (power > 3) { - log(`Communist holds power in ${pluralize(power, 'country', 's')}. -3 VP`) + log(`Communist holds power in ${pluralize(power, 'country', 's')}.`) + log(`-3 VP`) game.vp -= 3 } else { - log(`Communist holds power in ${pluralize(power, 'country', 's')}. +3 VP`) + log(`Communist holds power in ${pluralize(power, 'country', 's')}.`) + log(`+3 VP`) game.vp += 3 } if (check_vp()) { @@ -7353,7 +7461,7 @@ states.vm_new_years_eve_party = { }, continue() { push_undo() - log('Chooses to continue') + log('Choses to continue.') permanently_remove(C_NEW_YEARS_EVE_PARTY) vm_next() }, @@ -7381,6 +7489,7 @@ states.vm_nomenklatura = { } game.vm_available_ops = game.valid_spaces.length game.remove_opponent_infl = true + log('Removed SP:') game.state = 'vm_nomenklatura_remove' }, add() { @@ -7393,6 +7502,7 @@ states.vm_nomenklatura = { } check_systematization() game.vm_available_ops = 3 + log('Placed SP:') game.state = 'vm_nomenklatura_add' }, } @@ -7452,12 +7562,12 @@ states.vm_samizdat = { push_undo() game.samizdat_card = card game.democrat_hand = game.democrat_hand.filter(c => c !== card) - log('Set aside a card') + log('Set aside a card.') game.state = 'vm_samizdat_finish' }, pass() { push_undo() - log('Did not set aside a card') + log('Did not set aside a card.') vm_next() }, } @@ -7498,32 +7608,32 @@ states.vm_shock_therapy = { east_germany() { push_undo() game.vm_active_country = 'East_Germany' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) }, poland() { push_undo() game.vm_active_country = 'Poland' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) }, czechoslovakia() { push_undo() game.vm_active_country = 'Czechoslovakia' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) }, hungary() { push_undo() game.vm_active_country = 'Hungary' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) }, romania() { push_undo() game.vm_active_country = 'Romania' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) }, bulgaria() { push_undo() game.vm_active_country = 'Bulgaria' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) }, roll() { clear_undo() @@ -7543,20 +7653,21 @@ states.vm_shock_therapy = { logi(`-${worker_farmer} from Communist controlled Worker and Farmer spaces`) log(`Modified roll: ${Math.max(roll - worker_farmer, 0)}`) if ((roll - worker_farmer) > 2) { - log(`C${C_SHOCK_THERAPY} is successful. +3 VP`) + log(`Success: ${roll - worker_farmer} >= 3`) + log('+3 VP') game.vp += 3 if (check_vp()) { return } vm_next() } else { - log('C' + C_SHOCK_THERAPY + ' is unsuccessful. Required 3 or more') + log(`Fail: ${roll - worker_farmer} < 3`) permanently_remove(C_SHOCK_THERAPY) vm_return() } }, pass() { - log('Passed') + log('Passed.') vm_return() }, } @@ -7613,7 +7724,7 @@ states.vm_social_democratic_platform_adopted = { vm_next() }, pass() { - log('Passed') + log('Passed.') vm_return() }, } @@ -7649,7 +7760,7 @@ states.vm_the_chinese_solution = { east_germany() { push_undo() game.vm_active_country = 'East_Germany' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) log('+3 VP') game.vp += 3 if (check_vp()) { @@ -7660,7 +7771,7 @@ states.vm_the_chinese_solution = { poland() { push_undo() game.vm_active_country = 'Poland' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) log('+3 VP') game.vp += 3 if (check_vp()) { @@ -7671,7 +7782,7 @@ states.vm_the_chinese_solution = { czechoslovakia() { push_undo() game.vm_active_country = 'Czechoslovakia' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) log('+3 VP') game.vp += 3 if (check_vp()) { @@ -7682,7 +7793,7 @@ states.vm_the_chinese_solution = { hungary() { push_undo() game.vm_active_country = 'Hungary' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) log('+3 VP') game.vp += 3 if (check_vp()) { @@ -7693,7 +7804,7 @@ states.vm_the_chinese_solution = { romania() { push_undo() game.vm_active_country = 'Romania' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) log('+3 VP') game.vp += 3 if (check_vp()) { @@ -7704,7 +7815,7 @@ states.vm_the_chinese_solution = { bulgaria() { push_undo() game.vm_active_country = 'Bulgaria' - log(`Chose ${country_name(game.vm_active_country)}`) + log(`Chose ${country_name(game.vm_active_country)}.`) log('+3 VP') game.vp += 3 if (check_vp()) { @@ -7714,7 +7825,7 @@ states.vm_the_chinese_solution = { }, pass() { push_undo() - logi_msg_gap(`Chose not to conduct Support Checks`) + log(`Chose not to conduct Support Checks`) permanently_remove(C_THE_CHINESE_SOLUTION) vm_return() }, @@ -7736,7 +7847,7 @@ states.vm_the_tyrant_is_gone = { }, space(space) { push_undo() - log(`The Ceausescus flee to %${space}`) + log(`The Ceausescus flee to %${space}.`) game.the_tyrant_is_gone = space game.valid_spaces = [] }, @@ -7754,24 +7865,24 @@ states.vm_the_wall_must_go = { clear_undo() let attempt = game.the_wall_must_go['dem_wins'] + game.the_wall_must_go['com_wins'] if (game.the_wall_must_go['dem_roll'] === 0 && game.the_wall_must_go['com_roll'] === 0) { - log_h3(`Round ${attempt+1}`) + log(`Round ${attempt+1}`) } let roll = roll_d6() - log(`Roll: D${roll}`) + logi(`${game.active}: D${roll}`) if (game.active === DEM) { let controlled_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_dem_control(space.space_id)).length if (controlled_spaces > 0) { - logi(`+${controlled_spaces} from controlled spaces in East Germany`) - log(`Modified roll: ${roll + controlled_spaces}`) + logii(`+${controlled_spaces} from spaces`) + logii(`Modified roll: ${roll + controlled_spaces}`) roll += controlled_spaces } game.the_wall_must_go['dem_roll'] = roll } else { let controlled_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_com_control(space.space_id)).length if (controlled_spaces > 0) { - logi(`+${controlled_spaces} from controlled spaces in East Germany`) - log(`Modified roll: ${roll + controlled_spaces}`) + logii(`+${controlled_spaces} from spaces`) + logii(`Modified roll: ${roll + controlled_spaces}`) roll += controlled_spaces } game.the_wall_must_go['com_roll'] = roll @@ -7779,29 +7890,29 @@ 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']) { - log('Democrat wins') + logi('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']) { - log('Tie. Re-roll') + logi('Tie. Re-roll') } else { - log('Communist wins') + logi('Communist wins') game.the_wall_must_go['com_wins']++ } - log(`Democrat: ${game.the_wall_must_go['dem_wins']}, Communist: ${game.the_wall_must_go['com_wins']}`) + logi(`Democrat: ${game.the_wall_must_go['dem_wins']}, Communist: ${game.the_wall_must_go['com_wins']}`) } if (game.the_wall_must_go['dem_wins'] === 2) { - log('The Democrat wins C' + C_THE_WALL_MUST_GO) + log('Democrat wins C' + C_THE_WALL_MUST_GO) finish_the_wall() return } if (game.the_wall_must_go['com_wins'] === 2) { - log('The Communist wins C' + C_THE_WALL_MUST_GO) + log('Communist wins C' + C_THE_WALL_MUST_GO) finish_the_wall() return } if (game.the_wall_must_go['dem_roll'] === 0 || game.the_wall_must_go['com_roll'] === 0) { - next_player() + change_player() } else { game.the_wall_must_go['dem_roll'] = 0 game.the_wall_must_go['com_roll'] = 0 @@ -7858,7 +7969,10 @@ states.vm_we_are_the_people_remove = { }, space(space) { remove_infl(space, 'vm_available_ops') - if (game.vm_influence_added[S_LUTHERAN_CHURCH] === 4) { + if (game.vm_influence_added[S_LUTHERAN_CHURCH] === 4 || + game.valid_spaces.length === 0 + ) { + do_log_summary() finish_we_are_the_people() } }, @@ -7866,7 +7980,7 @@ states.vm_we_are_the_people_remove = { push_undo() do_log_summary() if (!game.vm_influence_added[S_LUTHERAN_CHURCH]) { - log('No SPs removed') + logi('None') vm_next() } else { finish_we_are_the_people() @@ -7909,7 +8023,7 @@ states.vm_workers_revolt = { space(space) { push_undo() game.selected_space = space - log(`Chose %${game.selected_space}`) + log(`Chose %${game.selected_space}.`) game.state = 'vm_workers_revolt_finish' }, } @@ -7933,9 +8047,9 @@ states.vm_workers_revolt_finish = { } log(`Modified roll: ${Math.max(roll, 0)}`) if (roll >= 4) { - log('Workers Revolt successful') + log(`Success: ${roll} >= 4`) vm_replace_all_infl(game.selected_space) - } else {log('Workers Revolt fails. Required 4 or more')} + } else {log(`Fail: ${roll} < 4`)} delete game.selected_space vm_next() }, @@ -7950,6 +8064,7 @@ states.vm_tst_3_prep = { gen_action('draw') }, draw() { + logi('Drew 3 cards.') if (game.active === DEM) { game.temp = game.democrat_hand.length draw_cards( @@ -8098,7 +8213,7 @@ states.vm_tst_8 = { event() { push_undo() check_ligachev_event(game.played_card) - log(`C${game.played_card}:`) + log_event(game.played_card) game.vm_event_to_do = false game.return_state = 'vm_tst_8' game.return = game.active @@ -8107,7 +8222,7 @@ states.vm_tst_8 = { }, ops() { push_undo() - log('Operations') + log('Operations:') game.vm_infl_to_do = false game.return = game.active game.return_state = 'vm_tst_8' @@ -8180,6 +8295,7 @@ states.vm_scare_tactics = { }, done() { do_log_summary() + log_msg_gap('Loses initiative.') vm_next() }, } @@ -8273,8 +8389,8 @@ states.vm_support_surges_3 = { done() { game.phase = 0 delete game.temp - log('Drew 2 cards') - log('Surrenders initiative') + log('Drew 2 cards.') + log_msg_gap('Surrenders initiative.') vm_next() }, } @@ -8305,12 +8421,12 @@ states.vm_support_falters = { game.vm_available_ops -- }, pass() { - log_msg_gap('Takes initiative') + log_msg_gap('Takes initiative.') game.return = game.active vm_next() }, done() { - log_gap('Takes initiative') + log_msg_gap('Takes initiative.') game.return = game.active vm_next() } @@ -8319,7 +8435,6 @@ states.vm_support_falters = { /* =================== EVENTS ================================ */ // #region GENERATED EVENT CODE -// BEGIN EVENTS {{{ const CODE = [] CODE[1] = [ // Legacy of Martial Law* @@ -8515,7 +8630,7 @@ CODE[27] = [ // Consumerism [ vm_remove_opp_infl, 1 ], [ vm_valid_spaces_opponent_socio, 4 ], [ vm_active_country ], - [ vm_prompt, ()=>`make a Support Check in a Worker space in ${country_name(game.vm_active_country)}` ], + [ vm_prompt, ()=>`make a Support Check in a Worker space in ${country_name(game.vm_active_country)}.` ], [ vm_1_support_check ], [ vm_return ], ] @@ -8702,7 +8817,7 @@ CODE[48] = [ // We are the People!* CODE[49] = [ // Foreign Currency Debt Burden* [ vm_foreign_currency_debt_burden ], - [ vm_logi_msg_gap, ()=>`Communist cannot make Support Checks in ${country_name(game.foreign_currency_debt_burden)} for the rest of the turn` ], + [ vm_log, ()=>`Communist cannot make Support Checks in ${country_name(game.foreign_currency_debt_burden)} for the rest of the turn` ], [ vm_return ], ] @@ -8822,7 +8937,7 @@ CODE[66] = [ // New Forum ] CODE[67] = [ // Reformer Rehabilitated* - [ vm_prompt, 'Reformer Rehabilitated: Choose any non-scoring card in the discard pile. Event takes place immediately.' ], + [ vm_prompt, 'Reformer Rehabilitated: Choose any non-scoring card in the discard pile. Event takes place immediately' ], [ vm_reformer_rehabilitated ], [ vm_return ], ] @@ -9001,7 +9116,7 @@ CODE[87] = [ // Kohl Proposes Reunification* [ vm_if, ()=>!is_auto_resolve(C_KOHL_PROPOSES_REUNIFICATION) ], [ vm_kohl_proposes_reunification ], [ vm_else ], - [ vm_logi_msg_gap, ()=>`C${C_THE_WALL_MUST_GO} has not been successfully played for the event.` ], + [ vm_log, ()=>`C${C_THE_WALL_MUST_GO} has not been successfully played for the event.` ], [ vm_endif ], [ vm_return ], ] @@ -9262,5 +9377,4 @@ CODE[351] = [ // Scare Tactics [ vm_remove_opp_infl, 1 ], [ vm_return ], ] -// END EVENTS }}} // #endregion |