diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 202 |
1 files changed, 140 insertions, 62 deletions
@@ -1071,7 +1071,7 @@ states.support_check_prep = { if (game.return !== game.active) { next_player() } - log_h3('Raise the Stakes') + log_h5('Raise the Stakes') log(`${game.active}:`) game.state = 'raise_stakes_1' return @@ -1091,6 +1091,8 @@ states.do_support_check = { clear_undo() do_sc(game.selected_space) game.available_ops-- + if (game.available_ops > 0) + log_br() if (game.available_ops === 0) { game.valid_spaces = [] } @@ -1220,7 +1222,7 @@ states.draw_power_cards = { game.persistent_events.push(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED) game.state = 'the_crowd_turns_against_ceausescu_prep' } else { - log_h3('Raise the Stakes') + log_h5('Raise the Stakes') log(`${game.active}:`) game.state = 'raise_stakes_1' } @@ -1296,7 +1298,7 @@ states.the_crowd_turns_against_ceausescu_infl = { if (game.return !== game.active) { change_player() } - log_h3('Raise the Stakes') + log_h5('Raise the Stakes') log(`${game.active}:`) game.state = 'raise_stakes_1' }, @@ -1349,7 +1351,7 @@ states.raise_stakes_1 = { } else { game.valid_cards = [...game.com_pwr_hand] } - game.state = 'raise_stakes_2' + end_raise_stakes() }, done() { logi(`Raised the stakes.`) @@ -1361,7 +1363,7 @@ states.raise_stakes_1 = { } else { game.valid_cards = [...game.com_pwr_hand] } - game.state = 'raise_stakes_2' + end_raise_stakes() }, } @@ -1559,8 +1561,8 @@ states.power_struggle = { delete game.power_card_1 delete game.power_card_2 log(`${game.active} conceded.`) - log_h2('Aftermath') - log_h3('Support Loss') + log_h4('Aftermath') + log_h5('Support Loss') if (game.phase === 0) { game.played_power_card = 0 game.proxy_power_card = 0 /* If conceded when held the initiative but had no playable cards, ignore the last played card */ @@ -1637,7 +1639,7 @@ states.support_loss = { done() { do_log_summary() change_player() - log_h3('Victory Point') + log_h5('Victory Point') game.phase = 0 game.state = 'vp_roll' }, @@ -1937,8 +1939,9 @@ states.general_strike = { silent_discard(card) game.available_ops = get_card_ops(card) if (scoring_cards.includes(card)) { + game.played_card = card game.vm_event = card - log(`Played C${card} for the event`) + log(`Played C${card} for the event.`) game.return_state = 'end_round' goto_vm(game.vm_event) } else { @@ -1960,7 +1963,7 @@ states.general_strike_roll = { log(`Roll: D${roll}`) logi(`+${game.available_ops} ops`) let total = roll + game.available_ops - log(`Modified roll: ${total}`) + //log(`Modified roll: ${total}`) if (total > 5) { log(`Success: ${total} > 5.`) log('The strike is over.') @@ -2196,19 +2199,53 @@ states.stasi_resolve_common_european_home = { }, yes() { push_undo() - log(`Played C${game.played_card} with C${C_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 - game.state = 'resolve_opponent_event' + game.state = 'stasi_play_ceh' }, no() { push_undo() - log(`Played C${game.played_card}.`) + //log(`Played C${game.played_card}.`) game.state = 'play_card' }, } +states.stasi_play_ceh = { + get inactive() { + return `play ${quoted_card_name[game.played_card]}.` + }, + prompt() { + view.prompt = "Play " + quoted_card_name[game.played_card] + gen_action('influence') + gen_action('support_check') + }, + influence() { + push_undo() + log_ops_banner() + log(`Played C${game.played_card} with C${C_COMMON_EUROPEAN_HOME}.`) + check_ligachev_non_event() + log('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 + } + game.state = 'add_influence' + valid_spaces_infl() + }, + support_check() { + push_undo() + log_ops_banner() + log(`Played C${game.played_card} with C${C_COMMON_EUROPEAN_HOME}.`) + check_ligachev_non_event() + log('Support Checks:') + game.available_ops = 2 + game.state = 'support_check_prep' + valid_spaces_sc() + }, +} + // ==================== SUPPORTING STATE FUNCTIONS ============================= function add_infl(space, ops) { @@ -2349,7 +2386,7 @@ 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(`Support Check, %${space}:`) + logi(`%${space}:`) let starting_control = check_control(space) let roll = roll_d6() @@ -2771,35 +2808,44 @@ function check_control(space) { } function get_icons(starting_control, end_control) { - console.log('starting_control', starting_control, 'end_control', end_control) - if (starting_control !== end_control) { - console.log('in long bit') - if (starting_control === DEM && end_control === COM) - return ' (£DC .to £CC)' - else if (starting_control === COM && end_control === COM) - return ' (£CC .to £DC)' - else if (starting_control === 'd_ahead' && end_control === DEM) - return ' (£DU .to £DC)' - else if (starting_control === 'd_ahead' && end_control === COM) - return ' (£DU .to £DC)' - else if (starting_control === 'c_ahead' && end_control === DEM) - return ' (£CU .to £DC)' - else if (starting_control === 'c_ahead' && end_control === COM) - return ' (£CU .to £CC)' - else if (starting_control === DEM && (end_control === 'd_ahead' || 'none')) - return ' (£DC .to £DU)' - else if (starting_control === DEM && end_control === 'c_ahead') - return ' (£DC .to £CU)' - else if (starting_control === COM && (end_control === 'c_ahead' || 'none')) - return ' (£CC .to £CU)' - else if (starting_control === COM && end_control === 'd_ahead') - return ' (£CC .to £DU)' - else if (starting_control === 'none' && end_control === DEM) - return ' (£DU .to £DC)' - else if (starting_control === 'none' && end_control === COM) - return ' (£CU .to £CC)' - else - return '' + if (game.state !== 'place_starting_infl') { + if (starting_control !== end_control) { + console.log('in long bit') + if (starting_control === DEM && end_control === COM) + return ' (£DC .to £CC)' + else if (starting_control === COM && end_control === COM) + return ' (£CC .to £DC)' + else if (starting_control === 'd_ahead' && end_control === DEM) + return ' (£DU .to £DC)' + else if (starting_control === 'd_ahead' && end_control === COM) + return ' (£DU .to £DC)' + else if (starting_control === 'c_ahead' && end_control === DEM) + return ' (£CU .to £DC)' + else if (starting_control === 'c_ahead' && end_control === COM) + return ' (£CU .to £CC)' + else if (starting_control === DEM && end_control === 'd_ahead') + return ' (£DC .to £DU)' + else if (starting_control === DEM && end_control === 'none') + return ' (£DC .to £UU)' + else if (starting_control === DEM && end_control === 'c_ahead') + return ' (£DC .to £CU)' + else if (starting_control === COM && end_control === 'c_ahead') + return ' (£CC .to £CU)' + else if (starting_control === COM && end_control === 'none') + return ' (£CC .to £UU)' + else if (starting_control === COM && end_control === 'd_ahead') + return ' (£CC .to £DU)' + else if (starting_control === 'none' && end_control === DEM) + return ' (£UU .to £DC)' + else if (starting_control === 'none' && end_control === COM) + return ' (£UU .to £CC)' + /*else if (starting_control === 'none' && end_control === 'd_ahead') + return ' (£UU .to £DU)' + else if (starting_control === 'none' && end_control === 'c_ahead') + return ' (£UU .to £CU)'*/ + else + return '' + } } else return '' } @@ -3001,7 +3047,7 @@ function retain_power(country) { } function score_country(country) { - log_h3(`Scoring: ${country}`) + log_h4(`Scoring: ${country}`) // Get scoring values let value_presence = get_value(country) @@ -3222,7 +3268,7 @@ function goto_game_over(result, victory) { function goto_struggle() { game.raised_stakes_discard = 0 game.valid_cards = [] - log_h3('Play Cards') + log_h5('Play Cards') change_player() game.state = 'power_struggle' do_valid_cards() @@ -3269,6 +3315,24 @@ function end_goddess() { } } +function end_raise_stakes(){ + if (game.active === DEM){ + if (game.dem_pwr_hand.length >= 3) + game.state = 'raise_stakes_2' + else { + logi('Could not raise the stakes.') + goto_struggle() + } + } else { + if (game.com_pwr_hand.length >= 3) + game.state = 'raise_stakes_2' + else { + logi('Could not raise the stakes.') + goto_struggle() + } + } +} + function check_reformer() { /* Is this function still used? */ if (game.dem_tst_position !== game.com_tst_position) { @@ -3304,9 +3368,11 @@ function select_card(card) { game.state = 'play_card' } function finish_select_card() { - if (!scoring_cards.includes(game.played_card)) + if (!scoring_cards.includes(game.played_card)) { game.available_ops = get_card_ops(game.played_card) - log(`Played C${game.played_card}.`) + if (game.state !== 'stasi_play_ceh') + log(`Played C${game.played_card}.`) + } } function check_ligachev_non_event() { @@ -4360,6 +4426,16 @@ function log_h3(msg) { log(".h3 " + msg) } +function log_h4(msg) { + log_br() + log(".h4 " + msg) +} + +function log_h5(msg) { + log_br() + log(".h5 " + msg) +} + function log_gap(msg) { log_br() game.log.push(msg) @@ -5187,7 +5263,7 @@ function vm_replace_all_infl(space_id) { function vm_1_support_check() { game.vm_available_ops = 1 - //log('Support Check:') + log('Support Check:') if (game.valid_spaces.length === 0) logi('None') game.state = 'vm_1_support_check_prep' @@ -5195,20 +5271,20 @@ function vm_1_support_check() { function vm_support_check() { game.vm_available_ops = vm_operand(1) - /*if (game.vm_available_ops > 1) + if (game.vm_available_ops > 1) log('Support Checks:') else - log('Support Check:')*/ + 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) + if (game.vm_available_ops > 1) log('Support Checks:') else - log('Support Check:')*/ + log('Support Check:') game.state = 'vm_support_check_prep' } @@ -5808,7 +5884,7 @@ function vm_power_struggle() { log(`C${C_SECURITATE}: Democrat reveals Power Struggle cards.`) game.opp_power_hand = true } - log_h3('Deal Cards') + log_h5('Deal Cards') game.state = 'draw_power_cards' } @@ -6615,6 +6691,8 @@ states.vm_ceh_do_support_check = { clear_undo() do_sc(game.selected_space) game.vm_available_ops-- + if (check_vp()) + return if (game.vm_available_ops === 0) { game.valid_spaces = [] vm_next() @@ -6707,13 +6785,13 @@ states.vm_adamec = { roll() { clear_undo() let roll = roll_d6() - log(`Roll: D${roll}`) + logi(`D${roll} from roll`) let worker_spaces = spaces.filter(space => space && space.country === 'Czechoslovakia' && space.socio === SOCIO_WORKER && check_dem_control(space.space_id)).length if (worker_spaces > 0) { logi(`-${worker_spaces} from Democrat controlled worker spaces`) roll -= worker_spaces } - log(`Modified roll: ${Math.max(roll, 0)}`) + //log(`Modified roll: ${Math.max(roll, 0)}`) if (roll > 2) { log(`Success: ${roll} >= 3`) vm_next() @@ -7487,7 +7565,7 @@ states.vm_kremlin_coup_sc_prep = { }, space(_space) { push_undo() - //log('Support check:') + log('Support check:') game.state = 'vm_kremlin_coup_sc' }, } @@ -7567,10 +7645,10 @@ states.vm_malta_summit = { roll() { clear_undo() let roll = roll_d6() - log(`Roll: D${roll}`) + logi(`D${roll} from roll`) if (game.stability > 0) { logi(`+${Math.min(game.stability, 3)} from USSR Stability Track`) - log(`Modified roll: ${roll + Math.min(game.stability, 3)}`) + //log(`Modified roll: ${roll + Math.min(game.stability, 3)}`) } if (roll + game.stability > 3) { log(`Success: ${roll + game.stability} >= 4`) @@ -7854,9 +7932,9 @@ states.vm_shock_therapy = { worker_farmer++ } } - log(`Roll: D${roll}`) + logi(`D${roll} from roll`) logi(`-${worker_farmer} from Communist controlled Worker and Farmer spaces`) - log(`Modified roll: ${Math.max(roll - worker_farmer, 0)}`) + //log(`Modified roll: ${Math.max(roll - worker_farmer, 0)}`) if ((roll - worker_farmer) > 2) { log(`Success: ${roll - worker_farmer} >= 3`) log('+3 VP') @@ -8241,7 +8319,7 @@ states.vm_workers_revolt_finish = { roll() { clear_undo() let roll = roll_d6() - log(`Roll: D${roll}`) + logi(`D${roll} from roll`) let adj = count_adj(game.selected_space) if (game.active === DEM) { logi(`-${adj.com_adj} from opponent controlled spaces`) @@ -8250,7 +8328,7 @@ states.vm_workers_revolt_finish = { logi(`-${adj.dem_adj} from opponent controlled spaces`) roll -= adj.dem_adj } - log(`Modified roll: ${Math.max(roll, 0)}`) + //log(`Modified roll: ${Math.max(roll, 0)}`) if (roll >= 4) { log(`Success: ${roll} >= 4`) vm_replace_all_infl(game.selected_space) |