summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--events.txt8
-rw-r--r--images/SV_blank.gifbin0 -> 1168 bytes
-rw-r--r--images/SVd_blank.gifbin0 -> 1814 bytes
-rw-r--r--images/USd_blank.gifbin0 -> 1810 bytes
-rw-r--r--play.css1
-rw-r--r--play.js50
-rw-r--r--rules.js185
7 files changed, 189 insertions, 55 deletions
diff --git a/events.txt b/events.txt
index e1274c1..6caf4ea 100644
--- a/events.txt
+++ b/events.txt
@@ -309,15 +309,19 @@ permanently_remove
if game.persistent_events.includes(THE_TYRANT_IS_GONE_OCCURRED)
tyrant_block
else
+if game.persistent_events.includes(C_CEAUSESCU)
+prompt 'you must remove 1 SP from Bucharesti'
+ceausescu
+return
+else
if !is_auto_resolve(C_CEAUSESCU)
+ceausescu_prep
valid_spaces_country_opp 'Romania'
prompt ' from Romania'
remove_opp_infl 3
valid_spaces_country_sc 'Romania'
prompt 'make a Support Check in Romania'
1_support_check
-prompt ' from Bucharesti'
-ceausescu
endif
diff --git a/images/SV_blank.gif b/images/SV_blank.gif
new file mode 100644
index 0000000..5b9190b
--- /dev/null
+++ b/images/SV_blank.gif
Binary files differ
diff --git a/images/SVd_blank.gif b/images/SVd_blank.gif
new file mode 100644
index 0000000..e202de3
--- /dev/null
+++ b/images/SVd_blank.gif
Binary files differ
diff --git a/images/USd_blank.gif b/images/USd_blank.gif
new file mode 100644
index 0000000..b999b18
--- /dev/null
+++ b/images/USd_blank.gif
Binary files differ
diff --git a/play.css b/play.css
index 59f65f2..728ac3a 100644
--- a/play.css
+++ b/play.css
@@ -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; }
diff --git a/play.js b/play.js
index b74fb1f..5dbf88d 100644
--- a/play.js
+++ b/play.js
@@ -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) {
@@ -898,6 +901,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])
@@ -922,7 +926,7 @@ function on_log(text, ix) {
text = text.replace(/£[CD][CU]\b/g, sub_icon)
text = text.replace(/\.cT(\d+)/g, sub_icon)
text = text.replace(/\.dT(\d+)/g, sub_icon)
- text = text.replace(/.to/g, sub_arrow)
+ text = text.replace(/\.to/g, sub_arrow)
if (text.match(/^\.h1/)) {
text = text.substring(4)
@@ -932,16 +936,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(/\.D$/)) {
- p.classList.add("dem")
- } */ else if (text.match(/^\.c/)) {
- text = "Communist Action Round"
+ } 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(/^\.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"
diff --git a/rules.js b/rules.js
index 267967c..bc68c47 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'
},
@@ -2014,43 +2024,43 @@ states.new_years_eve_party = {
},
east_germany() {
push_undo()
- log('Chose to score East Germany')
+ log('Chose to score East Germany.')
game.vm_event = C_POWER_STRUGGLE_EAST_GERMANY
goto_vm(C_POWER_STRUGGLE_EAST_GERMANY)
},
poland() {
push_undo()
- log('Chose to score Poland')
+ log('Chose to score Poland.')
game.vm_event = C_POWER_STRUGGLE_POLAND
goto_vm(C_POWER_STRUGGLE_POLAND)
},
czechoslovakia() {
push_undo()
- log('Chose to score Czechoslovakia')
+ log('Chose to score Czechoslovakia.')
game.vm_event = C_POWER_STRUGGLE_CZECHOSLOVAKIA
goto_vm(C_POWER_STRUGGLE_CZECHOSLOVAKIA)
},
hungary() {
push_undo()
- log('Chose to score Hungary')
+ log('Chose to score Hungary.')
game.vm_event = C_POWER_STRUGGLE_HUNGARY
goto_vm(C_POWER_STRUGGLE_HUNGARY)
},
romania() {
push_undo()
- log('Chose to score Romania')
+ log('Chose to score Romania.')
game.vm_event = C_POWER_STRUGGLE_ROMANIA
goto_vm(C_POWER_STRUGGLE_ROMANIA)
},
bulgaria() {
push_undo()
- log('Chose to score Bulgaria')
+ log('Chose to score Bulgaria.')
game.vm_event = C_POWER_STRUGGLE_BULGARIA
goto_vm(C_POWER_STRUGGLE_BULGARIA)
},
pass() {
push_undo()
- log('No final power struggle')
+ log('No final power struggle.')
if (game.vp > 0) {
goto_game_over(DEM, `New Year's Eve Party: ${DEM} wins on Victory Point Track!`)
} else if (game.vp < 0) {
@@ -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'
}
},
@@ -3216,7 +3226,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()
@@ -3241,7 +3251,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'
@@ -3254,7 +3264,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'
@@ -3295,10 +3305,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() {
@@ -3541,8 +3553,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'
) {
@@ -3552,8 +3564,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}.`)
@@ -3566,8 +3578,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.')
@@ -3577,8 +3589,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) {
@@ -3598,7 +3610,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) {
@@ -3726,6 +3738,14 @@ function end_round() {
return
}
+ console.log('in end_round, game.persistent_events.includes(C_CEAUSESCU)', game.persistent_events.includes(C_CEAUSESCU))
+ // Check if Ceausescu has been played and if so check end round condition
+ if (game.persistent_events.includes(C_CEAUSESCU)) {
+ console.log('in check ceausescu')
+ if (check_ceausescu())
+ return
+ }
+
// Check if the card needs to be discarded.
let discard_check = [...game.strategy_removed, ...game.persistent_events]
if (!discard_check.includes(game.played_card) && game.played_card > 0) {
@@ -3841,10 +3861,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
@@ -3864,7 +3884,7 @@ function end_round() {
if (game.active !== DEM) {
next_player()
} else {
- log_side()
+ //log_side()
}
game.state = 'choose_card'
return
@@ -3886,7 +3906,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'
@@ -3896,7 +3916,7 @@ function end_round() {
if (game.active !== COM) {
change_player()
}
- log_side()
+ //log_side()
}
}
}
@@ -3983,9 +4003,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'
@@ -4003,10 +4023,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()
}
}
@@ -4189,6 +4209,16 @@ function reset_power() {
}
}
+function check_ceausescu() {
+ game.return = game.active
+ game.return_state = 'ceausescu_check'
+ console.log('check_ceausescu, game.return', game.return)
+ game.vm_infl_to_do = false
+ game.vm_event = C_CEAUSESCU
+ goto_vm(game.vm_event)
+ return true
+}
+
function check_tyrant() {
if (game.the_tyrant_is_gone > 0 && check_dem_control(game.the_tyrant_is_gone)) {
log_summary('+2 VP from C' + C_THE_TYRANT_IS_GONE + '.')
@@ -4268,6 +4298,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")
@@ -4584,6 +4644,7 @@ function prompt_event(str) {
}
function event_prompt(str) {
+ console.log('game.vm.fp', game.vm.fp, 'game.vm.prompt', game.vm.prompt)
if (typeof str === "undefined")
str = CODE[game.vm.fp][game.vm.prompt][1]
if (typeof str === "function")
@@ -4613,7 +4674,7 @@ function vm_return() {
}
// Check if end event state is needed
- if (game.is_pwr_struggle || game.state === 'vm_tst_6' || game.return_state === 'tiananmen_square_attempt_done') {
+ if (game.is_pwr_struggle || game.state === 'vm_tst_6' || game.return_state === 'tiananmen_square_attempt_done' || game.return_state === 'ceausescu_check') {
vm_end_event()
}
// Check if auto-resolve opponent event
@@ -4629,18 +4690,29 @@ function vm_return() {
}
function vm_end_event() {
+ console.log('vm_end_event game.return', game.return, 'game.return_state', game.return_state, 'game.vm_infl_to_do', game.vm_infl_to_do)
+ if (game.return_state === 'ceausescu_check') {
+ console.log('1')
+ end_round()
+ return
+ }
if (game.return !== game.active) {
//next_player()
+ console.log('2')
change_player()
}
if (game.return_state === 'power_struggle') {
+ console.log('3')
do_valid_cards()
}
if (game.return_state && game.return_state !== '') {
+ console.log('4')
game.state = game.return_state
} else if (game.vm_infl_to_do) {
+ console.log('in game.vm_infl_to_do')
game.state = 'resolve_opponent_event'
} else {
+ console.log('end round called')
end_round()
}
}
@@ -5241,9 +5313,15 @@ function vm_bulgarian_turks_expelled() {
vm_next()
}
+function vm_ceausescu_prep() {
+ game.persistent_events.push(C_CEAUSESCU)
+ vm_next()
+}
+
function vm_ceausescu() {
+ game.persistent_events = game.persistent_events.filter(n => n!== C_CEAUSESCU)
let adj_cluj = false
-
+
if (game.demInfl[S_TIMISOARA] > 0) {
adj_cluj = true
}
@@ -5257,13 +5335,21 @@ function vm_ceausescu() {
adj_cluj = true
}
+ console.log('in vm_ceausescu, adj_cluj', adj_cluj)
if (adj_cluj && game.comInfl[S_BUCURESTI] > 0) {
+ if (game.active !== COM) {
+ change_player()
+ game.return = game.active
+ log_event(C_CEAUSESCU)
+ }
game.valid_spaces = [S_BUCURESTI]
game.vm_available_ops = 1
game.remove_opponent_infl = false
+ log(`Democrat has SP adjacent to ${S_CLUJ_NAPOCA}.`)
+ log('Removed SP:')
game.state = 'vm_remove_infl'
} else {
- vm_next()
+ vm_return()
}
}
@@ -5715,14 +5801,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'
}
@@ -6122,6 +6208,7 @@ function vm_kremlin_coup_elite() {
states.vm_end_event = {
prompt() {
prompt_event("Done.")
+ console.log('in vm_end_event')
if (game.vm_infl_to_do || game.return_state === 'vm_tst_8') {
gen_action('done')
} else {
@@ -6325,7 +6412,11 @@ states.vm_remove_infl = {
prompt_event(`Remove ${pluralize(game.vm_available_ops, 'opponent SP')}${event_prompt()}.`)
}
else {
- prompt_event(`Remove ${pluralize(game.vm_available_ops,'SP')}${event_prompt()}.`)
+ console.log('game.vm_event', game.vm_event)
+ if (game.vm_event === C_CEAUSESCU)
+ prompt_event(`${event_prompt()}.`)
+ else
+ prompt_event(`Remove ${pluralize(game.vm_available_ops,'SP')}${event_prompt()}.`)
}
for (let space_id of game.valid_spaces) {
gen_action_space(space_id)
@@ -8859,15 +8950,19 @@ CODE[41] = [ // Ceausescu*
[ vm_if, ()=>game.persistent_events.includes(THE_TYRANT_IS_GONE_OCCURRED) ],
[ vm_tyrant_block ],
[ vm_else ],
+ [ vm_if, ()=>game.persistent_events.includes(C_CEAUSESCU) ],
+ [ vm_prompt, 'you must remove 1 SP from Bucharesti' ],
+ [ vm_ceausescu ],
+ [ vm_return ],
+ [ vm_else ],
[ vm_if, ()=>!is_auto_resolve(C_CEAUSESCU) ],
+ [ vm_ceausescu_prep ],
[ vm_valid_spaces_country_opp, 'Romania' ],
[ vm_prompt, ' from Romania' ],
[ vm_remove_opp_infl, 3 ],
[ vm_valid_spaces_country_sc, 'Romania' ],
[ vm_prompt, 'make a Support Check in Romania' ],
[ vm_1_support_check ],
- [ vm_prompt, ' from Bucharesti' ],
- [ vm_ceausescu ],
[ vm_endif ],
[ vm_return ],
]