diff options
-rw-r--r-- | play.css | 1 | ||||
-rw-r--r-- | play.js | 48 | ||||
-rw-r--r-- | rules.js | 106 |
3 files changed, 116 insertions, 39 deletions
@@ -69,6 +69,7 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); } #log div.ii { padding-left: 44px; text-indent: -12px; } #log .card_name { font-style: italic; } +#log div.h2 .card_name { font-style: normal; } #log .card_name:hover { text-decoration: underline; } #log .space_tip:hover { cursor: pointer; text-decoration: underline; } @@ -837,7 +837,10 @@ let event_side = null function sub_card_name(_match, p1) { let x = p1 | 0 - return `<span class="card_name" onmouseenter="on_focus_card_tip(${x})" onmouseleave="on_blur_card_tip()">${cards[x].name.replace("*", "")}</span>` + if (scoring_cards.includes(x)) + return `<span class="scoring_card_name" onmouseenter="on_focus_card_tip(${x})" onmouseleave="on_blur_card_tip()">${cards[x].name.replace("*", "")}</span>` + else + return `<span class="card_name" onmouseenter="on_focus_card_tip(${x})" onmouseleave="on_blur_card_tip()">${cards[x].name.replace("*", "")}</span>` } function sub_power_card_name(_match, p1) { @@ -872,6 +875,7 @@ const die = { function on_log(text, ix) { let p = document.createElement("div") + console.log('text', text) let event_string = text.match(/^C(\d+)/) if (event_string) event_n = parseInt(event_string[1]) @@ -902,16 +906,46 @@ function on_log(text, ix) { text = text.substring(4) p.className = "h2" log_event = 0 - } else if (text.match(/^\.d/)) { - text = "Democrat Action Round" + } else if (text.match(/^\.O\.d/)) { + text = "operations" + p.className = "h2 dem" + log_event = 0 + } else if (text.match(/^\.V\.d/)) { + text = "event" + p.className = "h2 dem" + log_event = 0 + } else if (text.match(/^\.T\.d/)) { + text = "event and operations" p.className = "h2 dem" log_event = 0 - } /*else if (text.match(/\.D$/)) { - p.classList.add("dem") - } */ else if (text.match(/^\.c/)) { - text = "Communist Action Round" + } else if (text.match(/^\.S\.d/)) { + text = text.replace(".S.d", "") + p.className = "h2 dem" + log_event = 0 + } else if (text.match(/^\.O\.c/)) { + text = "operations" + p.className = "h2 com" + log_event = 0 + } else if (text.match(/^\.V\.c/)) { + text = "event" p.className = "h2 com" log_event = 0 + } else if (text.match(/^\.T\.c/)) { + text = "event and operations" + p.className = "h2 com" + log_event = 0 + } else if (text.match(/^\.S\.c/)) { + text = text.replace(".S.c", "") + p.className = "h2 com" + log_event = 0 + } else if (text.match(/\.c/)) { + text = text.replace(".c", "") + p.className = "h2 com" + log_event = 0 + } else if (text.match(/\.d/)) { + text = text.replace(".d", "") + p.className = "h2 dem" + log_event = 0 } else if (text.match(/^\.h3/)) { text = text.substring(4) p.className = "h3" @@ -708,8 +708,12 @@ states.play_card = { push_undo() check_ligachev_event(game.played_card) //log_gap(`Played C${game.played_card} for the event`) - if (!scoring_cards.includes(game.played_card)) + if (scoring_cards.includes(game.played_card)) + log_struggle_banner(game.played_card) + else { + log_event_banner() log_event(game.played_card) + } game.vm_infl_to_do = false game.return = game.active if (switch_events.includes(game.played_card)) { @@ -721,6 +725,7 @@ states.play_card = { }, opp_event() { push_undo() + log_ops_banner() check_ligachev_event(game.played_card) //log_gap(`Resolved opponent event C${game.played_card}`) log_event(game.played_card) @@ -738,6 +743,7 @@ states.play_card = { }, influence() { push_undo() + log_ops_banner() check_ligachev_non_event() //log_gap(`Played C${game.played_card} to place SPs`) log('Placed SP:') @@ -752,6 +758,7 @@ states.play_card = { }, tst() { push_undo() + log_ops_banner() check_ligachev_non_event() //log_gap(`Played C${game.played_card} to the Tiananmen Square Track`) log('Tiananmen Square Attempt:') @@ -760,6 +767,7 @@ states.play_card = { }, support_check() { push_undo() + log_ops_banner() check_ligachev_non_event() //log_gap(`Played C${game.played_card} for Support Checks`) log('Support Checks:') @@ -771,6 +779,7 @@ states.play_card = { tst_7() { /* Cancel opponent event */ push_undo() + log_ops_banner() check_ligachev_non_event() log(`Event cancelled using TST Award.`) game.tst_7 = true @@ -780,10 +789,11 @@ states.play_card = { tst_8() { /* Play card for ops and event */ push_undo() + log_tst_8_banner() game.vm_event_to_do = true game.vm_infl_to_do = true game.tst_8 = true - log(`Uses TST Award: event and operations.`) + //log(`Uses TST Award: event and operations.`) game.state = 'vm_tst_8' }, end_round() { @@ -1061,7 +1071,7 @@ states.support_check_prep = { if (game.return !== game.active) { next_player() } - log_h2('Raise the Stakes') + log_h3('Raise the Stakes') log(`${game.active}:`) game.state = 'raise_stakes_1' return @@ -1210,7 +1220,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_h2('Raise the Stakes') + log_h3('Raise the Stakes') log(`${game.active}:`) game.state = 'raise_stakes_1' } @@ -1286,7 +1296,7 @@ states.the_crowd_turns_against_ceausescu_infl = { if (game.return !== game.active) { change_player() } - log_h2('Raise the Stakes') + log_h3('Raise the Stakes') log(`${game.active}:`) game.state = 'raise_stakes_1' }, @@ -2159,7 +2169,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}.`) + //log(`Played C${card}.`) game.state = 'play_card' } }, @@ -3147,7 +3157,7 @@ function goto_game_over(result, victory) { function goto_struggle() { game.raised_stakes_discard = 0 game.valid_cards = [] - log_h2('Play Cards') + log_h3('Play Cards') change_player() game.state = 'power_struggle' do_valid_cards() @@ -3172,7 +3182,7 @@ function end_stasi() { next_player() game.valid_spaces = [] if (game.persistent_events.includes(C_GENERAL_STRIKE)) { - log_h3('C' + C_GENERAL_STRIKE) + log('.cC' + C_GENERAL_STRIKE) game.state = 'general_strike' } else { game.state = 'choose_card' @@ -3185,7 +3195,7 @@ function end_goddess() { if (game.active === DEM) { next_player() } else { - log_side() + //log_side() } if (game.persistent_events.includes(C_GENERAL_STRIKE)) { game.state = 'general_strike' @@ -3226,10 +3236,12 @@ function select_card(card) { find_card = game.democrat_hand.indexOf(card) game.democrat_hand.splice(find_card, 1) } - game.available_ops = get_card_ops(card) game.state = 'play_card' - if (!scoring_cards.includes(card)) - log(`Played C${card}.`) +} +function finish_select_card() { + if (!scoring_cards.includes(game.played_card)) + game.available_ops = get_card_ops(game.played_card) + log(`Played C${game.played_card}.`) } function check_ligachev_non_event() { @@ -3472,8 +3484,8 @@ function get_card_ops(card) { let ops = cards[card].ops if (game.persistent_events.includes(C_PERESTROIKA) && game.active === COM) { if ( - game.state === 'choose_card' || - game.state === 'stasi_play_card' || + game.state === 'play_card' || + //game.state === 'stasi_play_card' || game.state === 'general_strike' || game.state === 'vm_deutsche_marks' ) { @@ -3483,8 +3495,8 @@ function get_card_ops(card) { } if (game.persistent_events.includes(C_THE_SINATRA_DOCTRINE) && game.active === DEM) { if ( - game.state === 'choose_card' || - game.state === 'stasi_play_card' || + game.state === 'play_card' || + //game.state === 'stasi_play_card' || game.state === 'vm_laszlo_tokes' ) { log(`+1 op from C${C_THE_SINATRA_DOCTRINE}.`) @@ -3497,8 +3509,8 @@ function get_card_ops(card) { (game.active === COM && game.com_tst_position >= 2 && game.dem_tst_position <= 1 && cards[card].ops === 1) ) { if ( - game.state === 'choose_card' || - game.state === 'stasi_play_card' || + game.state === 'play_card' || + //game.state === 'stasi_play_card' || game.state === 'general_strike' ) { log('+1 op from Tiananmen Square Track.') @@ -3508,8 +3520,8 @@ function get_card_ops(card) { if (game.active === DEM && game.prudence && game.prudence.DEM !== 0) { if ( - game.state === 'choose_card' || - game.state === 'stasi_play_card' || + game.state === 'play_card' || + //game.state === 'stasi_play_card' || game.state === 'vm_laszlo_tokes' ) { if (ops > 2) { @@ -3529,7 +3541,7 @@ function get_card_ops(card) { if (game.active === COM && game.prudence && game.prudence.COM < 0) { if ( - game.state === 'choose_card' || + game.state === 'play_card' || game.state === 'general_strike' ) { if (ops > 2) { @@ -3772,10 +3784,10 @@ function end_round() { if (game.active !== DEM) { next_player() } else { - log_side() + //log_side() } if (game.democrat_hand.includes(game.stasi_card)) { - log_h3('C' + C_STASI) + //log('.dC' + C_STASI) game.state = 'stasi_play_card' } else { game.stasi_card = 0 @@ -3795,7 +3807,7 @@ function end_round() { if (game.active !== DEM) { next_player() } else { - log_side() + //log_side() } game.state = 'choose_card' return @@ -3817,7 +3829,7 @@ function end_round() { if (game.active !== COM) { next_player() } - log_h3('C' + C_GENERAL_STRIKE) + log('.cC' + C_GENERAL_STRIKE) return } else { game.state = 'choose_card' @@ -3827,7 +3839,7 @@ function end_round() { if (game.active !== COM) { change_player() } - log_side() + //log_side() } } } @@ -3914,9 +3926,9 @@ function new_turn() { game.state = 'tst_goddess' } else { log_h2("Action Round " + game.round) - log_side() + //log_side() if (game.persistent_events.includes(C_GENERAL_STRIKE)) { - log_h3('C' + C_GENERAL_STRIKE) + log('.cC' + C_GENERAL_STRIKE) game.state = 'general_strike' } else { game.state = 'choose_card' @@ -3934,10 +3946,10 @@ function next_player() { clear_undo() if (game.active === DEM) { game.active = COM - log_side() + //log_side() } else { game.active = DEM - log_side() + //log_side() } } @@ -4199,6 +4211,36 @@ function log(msg) { game.log.push(msg) } +function log_ops_banner() { + if (game.active === DEM) + log('.O.d') + else + log('.O.c') + finish_select_card() +} + +function log_event_banner() { + if (game.active === DEM) + log('.V.d') + else + log('.V.c') +} + +function log_struggle_banner(n) { + if (game.active === DEM) + log('.S.dC' + n) + else + log('.S.cC' + n) +} + +function log_tst_8_banner() { + if (game.active === DEM) + log('.T.d') + else + log('.T.c') + finish_select_card() +} + function log_event(n) { log_br() if (cards[n].side === "C") @@ -5598,14 +5640,14 @@ function vm_power_struggle() { game.raised_stakes_round = 0 game.raised_stakes_discard = 0 game.pwr_struggle_in = countries[scoring_cards.indexOf(game.vm_event)] - log_h2(`C${game.vm_event}`) + //log_h2(`C${game.vm_event}`) // Check for Securitate if (game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(C_SECURITATE)) { log(`C${C_SECURITATE}: Democrat reveals Power Struggle cards.`) game.opp_power_hand = true } - log_h2('Deal Cards') + log_h3('Deal Cards') game.state = 'draw_power_cards' } |