summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-12-06 21:37:49 +0000
committeriainp5 <iain.pearce.ip@gmail.com>2024-12-06 21:37:49 +0000
commit1ad1a6ddfbc94b649b1f629aed4f12fee414c6f2 (patch)
tree1f48c87c7d59d335a77bcb54136aa5eed0df0330 /rules.js
parent992e03dcbf2e17cf1f20e7237d3eb21d64a5cb19 (diff)
download1989-dawn-of-freedom-1ad1a6ddfbc94b649b1f629aed4f12fee414c6f2.tar.gz
Event and Operation banners in log
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js106
1 files changed, 74 insertions, 32 deletions
diff --git a/rules.js b/rules.js
index cb4e5db..f85c8bd 100644
--- a/rules.js
+++ b/rules.js
@@ -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'
}