summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js233
1 files changed, 157 insertions, 76 deletions
diff --git a/rules.js b/rules.js
index c3a603b..6ea9327 100644
--- a/rules.js
+++ b/rules.js
@@ -619,6 +619,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`)
game.state = 'vm_tst_8'
},
end_round () {
@@ -893,9 +894,9 @@ states.tiananmen_square_attempt_done = {
inactive: 'do Tiananmen Square Attempt.',
prompt () {
view.prompt = 'Tiananmen Square Track attempt: done.'
- gen_action('done')
+ gen_action('end_round')
},
- done () {
+ end_round () {
end_round()
//game.state = 'end_round'
}
@@ -991,7 +992,10 @@ states.support_check_prep = {
inactive: 'do support checks',
prompt () {
if (game.available_ops === 0) { /*Needs another check for Support Checks done during Crowd Turns against Ceausescu*/
- if (!game.vm_event_to_do) {
+ if (game.is_pwr_struggle) {
+ view.prompt = 'The Crowd Turns Against Ceausescu. Support checks: done.'
+ gen_action('done')
+ } else if (!game.vm_event_to_do) {
view.prompt = 'Support checks: done.'
gen_action('end_round')
} else {
@@ -1153,7 +1157,12 @@ states.draw_power_cards = {
game.is_pwr_struggle = true
console.log('game.dem_pwr_hand_limit', game.dem_pwr_hand_limit, 'game.com_pwr_hand_limit', game.com_pwr_hand_limit)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand_limit, game.com_pwr_hand_limit)
- game.valid_cards = all_power_cards
+ if (game.active === DEM) {
+ game.valid_cards = [...game.dem_pwr_hand]
+ } else {
+ game.valid_cards = [...game.com_pwr_hand]
+ }
+ //game.valid_cards = all_power_cards
log(`Communist: ${game.com_pwr_hand.length} cards`)
log(`Democrat: ${game.dem_pwr_hand.length} cards`)
@@ -1253,16 +1262,16 @@ states.the_crowd_turns_against_ceausescu_infl = {
}
states.raise_stakes_1 = {
- inactive: 'raise the stakes',
+ inactive: 'raise the stakes.',
prompt () {
+ console.log('raise stakes 1 - valid cards', game.valid_cards)
console.log('raise the stakes: game.played_power_card', game.played_power_card, 'game.active', game.active, 'game.view_opp_hand', game.view_opp_hand)
if ((game.active === DEM && game.dem_pwr_hand < 3) || (game.active === COM && game.com_pwr_hand < 3)) {
view.prompt = 'Raise the stakes: you must pass.'
gen_action('pass')
- return
}
- if (game.raised_stakes_discard === 3) {
+ else if (game.raised_stakes_discard === 3) {
view.prompt = 'Raise the stakes: done.'
gen_action('done')
} else {
@@ -1289,26 +1298,35 @@ states.raise_stakes_1 = {
game.raised_stakes++
game.valid_cards = []
}
-
-
},
pass(){
log('Did not raise the stakes')
game.raised_stakes_discard = 0
next_player()
+ if (game.active === DEM) {
+ game.valid_cards = [...game.dem_pwr_hand]
+ } else {
+ game.valid_cards = [...game.com_pwr_hand]
+ }
game.state = 'raise_stakes_2'
},
done () {
log_gap('Raised the stakes')
game.raised_stakes_discard = 0
next_player()
- game.valid_cards = [...all_power_cards]
+ console.log('game.active', game.active)
+ if (game.active === DEM) {
+ game.valid_cards = [...game.dem_pwr_hand]
+ } else {
+ game.valid_cards = [...game.com_pwr_hand]
+ }
+ console.log('game.valid_cards', game.valid_cards)
game.state = 'raise_stakes_2'
}
}
states.raise_stakes_2 = {
- inactive: 'raise the stakes',
+ inactive: 'raise the stakes.',
prompt () {
if ((game.active === DEM && game.dem_pwr_hand < 3) || (game.active === COM && game.com_pwr_hand < 3)) {
@@ -1484,6 +1502,7 @@ states.power_struggle = {
},
concede () {
push_undo()
+ game.valid_cards = []
log('Conceded')
log_h2('Aftermath')
log_h3('Support Loss')
@@ -1739,6 +1758,9 @@ states.choose_power = {
//Check if The Tyrant is Gone occurs
if (game.table_cards.includes(97) && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(54)) {
game.return_state = 'finish_scoring'
+ if (game.active !== DEM) {
+ next_player()
+ }
game.state = 'the_tyrant_is_gone'
} else {
game.state = 'finish_scoring'
@@ -1840,6 +1862,9 @@ states.end_turn_4_5_4 = {
log(`Communist receives 2 VP from C97`)
}
game.persistent_events.push(111)
+ if (game.active !== DEM) {
+ next_player()
+ }
game.state = 'new_years_eve_party'
}
else if(game.turn === 10) {
@@ -1892,10 +1917,10 @@ states.final_scoring = {
inactive: 'score countries.',
prompt() {
if (game.temp['East_Germany'] && game.temp['Poland'] && game.temp['Czechoslovakia'] && game.temp['Hungary'] && game.temp['Romania'] && game.temp['Bulgaria']) {
- view.prompt = 'Country scoring: done.'
- gen_action('done')
+ view.prompt = 'Final scoring: done.'
+ gen_action('end')
} else {
- view.prompt = 'Choose a country to score'
+ view.prompt = 'Choose a country to score:'
if (!game.temp['East_Germany']) {gen_action('east_germany')}
if (!game.temp['Poland']) {gen_action('poland')}
if (!game.temp['Czechoslovakia']) {gen_action('czechoslovakia')}
@@ -1928,7 +1953,7 @@ states.final_scoring = {
score_country('Bulgaria')
game.temp['Bulgaria'] = true
},
- done() {
+ end() {
delete game.temp
if (game.vp > 0) {
goto_game_over(DEM, `${DEM} wins on Victory Point Track!`)
@@ -1960,10 +1985,10 @@ states.general_strike = {
for (let card of available_cards) {
gen_action_card(card)
}
- } else if (game.phase >= 1) {
+ } /*else if (game.phase >= 1) {
view.prompt = 'General Strike: done.'
gen_action('done')
- } else if (game.played_card > 0 ) {
+ } */ else if (game.played_card > 0 ) {
view.prompt = 'General Strike: roll a die.'
gen_action('roll')
}
@@ -2001,12 +2026,13 @@ states.general_strike = {
} else {
log('The strike continues. Required 6 or more')
}
- game.phase = 1
- },
+ //game.phase = 1
+ game.state = 'end_round'
+ }, /*
done () {
//end_round()
game.state = 'end_round'
- }
+ }*/
}
states.honecker ={
@@ -2090,20 +2116,20 @@ states.new_years_eve_party = {
push_undo()
log('No final power struggle')
if (game.vp > 0) {
- goto_game_over(DEM, `C104: ${DEM} wins on Victory Point Track!`)
+ goto_game_over(DEM, `New Year's Eve Party: ${DEM} wins on Victory Point Track!`)
} else if (game.vp < 0) {
- goto_game_over(COM, `C104: ${COM} wins on Victory Point Track!`)
+ goto_game_over(COM, `New Year's Eve Party: ${COM} wins on Victory Point Track!`)
} else if (game.vp === 0) {
- goto_game_over('', `C104: The game is tied!`) /*Not sure what to pass for result */
+ goto_game_over('', `New Year's Eve Party: The game is tied!`) /*Not sure what to pass for result */
}
},
end() {
if (game.vp > 0) {
- goto_game_over(DEM, `C104: ${DEM} wins on Victory Point Track!`)
+ goto_game_over(DEM, `New Year's Eve Party: ${DEM} wins on Victory Point Track!`)
} else if (game.vp < 0) {
- goto_game_over(COM, `C104: ${COM} wins on Victory Point Track!`)
+ goto_game_over(COM, `New Year's Eve Party: ${COM} wins on Victory Point Track!`)
} else if (game.vp === 0) {
- goto_game_over('', `C104: The game is tied!`) /*Not sure what to pass for result */
+ goto_game_over('', `CNew Year's Eve Party: The game is tied!`) /*Not sure what to pass for result */
}
}
}
@@ -2264,7 +2290,7 @@ function add_infl(space) {
}
// Check Genscher
- if (game.persistent_events.includes(63) && game.active === DEM && spaces[space].country === 'East_Germany') {
+ if (game.persistent_events.includes(63) && game.active === DEM && spaces[space].country === 'East_Germany' && check_com_control(space)) {
game.available_ops--
log_summary(`(-1 op due to C63)`)
} else if (check_opp_control(space)) {
@@ -3192,7 +3218,7 @@ function get_end_infl_prompt() {
function permanently_remove(card) {
console.log('permanently removing card:', card)
if (game.strategy_removed.includes(card)) {return}
- log_msg_gap(`C${cards[card].number} permanently removed`)
+ //log_msg_gap(`C${cards[card].number} permanently removed`)
remove_from_discard(card)
card_index = game.table_cards.indexOf(card)
@@ -4942,7 +4968,11 @@ function vm_remove_infl() {
function vm_remove_opp_infl() {
game.vm_available_ops = vm_operand(1)
game.remove_opponent_infl = true
- game.state = 'vm_remove_infl'
+ if (game.is_pwr_struggle) {
+ game.state = 'vm_scare_tactics'
+ } else {
+ game.state = 'vm_remove_infl'
+ }
}
function vm_remove_x_opp_infl() {
@@ -5337,13 +5367,17 @@ function vm_eliminate(space_id) {
//console.log('adjacency before: Iasi', game.pieces[53].adjacent, 'Ploesti:', game.pieces[59].adjacent, 'Bucharesti:', game.pieces[61].adjacent)
// Eliminate the democrat influence and move the communist influence to Bucuresti
- game.demInfl[space_id] = 0
- game.comInfl[61] += game.comInfl[space_id]
- if (game.comInfl[space_id] > 0 ) {
- log(`${pluralize(game.comInfl[space_id],'Communist SP')} relocated to %61`)
+ if (space_id === 61) {
+ game.demInfl[space_id] = 0
+ game.comInfl[space_id] = 0
+ } else {
+ game.demInfl[space_id] = 0
+ game.comInfl[61] += game.comInfl[space_id]
+ if (game.comInfl[space_id] > 0 ) {
+ log(`${pluralize(game.comInfl[space_id],'Communist SP')} relocated to %61`)
+ }
+ game.comInfl[space_id] = 0
}
- game.comInfl[space_id] = 0
-
//Update control in the eliminated space and in Bucuresti
check_control_change(space_id)
check_control_change(61)
@@ -5550,6 +5584,7 @@ function vm_kohl_proposes_reunification() {
function vm_kremlin_coup() {
log('-3 VP')
game.vp -= 3
+ game.stability ++
if (check_vp()) {
return
}
@@ -6047,9 +6082,9 @@ states.vm_end_event = {
return `resolve ${clean_name(cards[this_card()].name)}.`
},
prompt () {
- console.log('in vm_end_event')
+ console.log('in vm_end_event, game.vm_infl_to_do', game.vm_infl_to_do, 'game.return_state', game.return_state)
view.prompt = `${clean_name(cards[this_card()].name)}: done.`
- if (game.vm_infl_to_do) {
+ if (game.vm_infl_to_do || game.return_state === 'vm_tst_8') {
gen_action('done')
} else {
gen_action('end_round')
@@ -6307,17 +6342,11 @@ states.vm_remove_infl = {
gen_action('done')
return
}
- /*if (game.vm_available_ops === 0 ) {
- if (game.vm_infl_to_do) {
- view.prompt = `${clean_name(cards[this_card()].name)}. Remove SPs: done.`
- gen_action('done')
- return
- } else {
+ if (game.vm_available_ops === 0 ) {
view.prompt = `${clean_name(cards[this_card()].name)}. Remove SPs: done.`
gen_action('done')
return
- }
- }*/
+ }
if (game.remove_opponent_infl) {
view.prompt = `${clean_name(cards[this_card()].name)}: remove ${pluralize(game.vm_available_ops, 'opponent SP')}${event_prompt()}.`
}
@@ -6332,12 +6361,13 @@ states.vm_remove_infl = {
push_undo()
vm_do_remove_infl(space)
game.vm_active_country = spaces[space].country
-
- if (game.vm_available_ops === 0 ) {
- vm_next()
- if (game.summary.length > 0) {
- pop_summary()
- log_br()
+ if (game.vm_event !== 44) {
+ if (game.vm_available_ops === 0 ) {
+ if (game.summary.length > 0) {
+ pop_summary()
+ log_br()
+ }
+ vm_next()
}
}
},
@@ -6707,10 +6737,11 @@ states.vm_adamec = {
states.vm_brought_in_for_questioning = {
inactive: 'discard a card.',
prompt() {
- if (game.phase === 1) {
+ /*if (game.phase === 1) {
view.prompt = 'Discard a card: done.'
gen_action('done')
- } else if (game.democrat_hand.length === 0) {
+ } else */
+ if (game.democrat_hand.length === 0) {
view.prompt = 'Brought in for Questioning. No cards to discard.'
gen_action('pass')
} else {
@@ -6737,15 +6768,16 @@ states.vm_brought_in_for_questioning = {
goto_vm(game.vm_event)
} else {
game.return = DEM
+ vm_return()
}
},
pass() {
log('No cards to discard')
vm_return()
},
- done() {
+ /*done() {
vm_return()
- }
+ }*/
}
states.vm_central_committee_reshuffle = {
@@ -6838,9 +6870,9 @@ states.vm_common_european_home_play = {
if (game.active === DEM && game.vm_event === 87 ) {
return /*Special condition if card is actually Kohl Proposes Reunification*/
}
- if (game.active === DEM && game.dem_tst_attempted_this_turn === 0 || game.active === COM && game.com_tst_attempted_this_turn === 0) {
+ /*if (game.active === DEM && game.dem_tst_attempted_this_turn === 0 || game.active === COM && game.com_tst_attempted_this_turn === 0) {
gen_action('tst')
- }
+ } */
},
influence(){
push_undo()
@@ -7154,7 +7186,7 @@ states.vm_goodbye_lenin = {
gen_action('ops')
}
} else {
- view.prompt = 'Communist has no valid cards. Play Goodbye Lenin for operations.'
+ view.prompt = 'Communist has no red events. Play Goodbye Lenin for operations.'
gen_action('ops')
}
},
@@ -7225,7 +7257,7 @@ states.vm_honecker = {
prompt() {
if (game.valid_cards.length === 0 && game.temp === 0) {
view.prompt = 'Honecker: no valid cards to choose.'
- gen_action('done')
+ gen_action('pass')
} else
if (game.temp === 0) {view.prompt = 'Honecker: choose a card to add to your hand.'
for (let card of game.valid_cards) {
@@ -7347,16 +7379,23 @@ states.vm_inflationary_currency_discard = {
for (let card of game.valid_cards) {
gen_action_card(card)
}
- } else {
- view.prompt = 'Discard a card: done.'
+ } /*else {
+ view.prompt = 'Inflationary Currency. Discard a card: done.'
gen_action('done')
- }
+ } */
},
card(card) {
push_undo()
discard(card)
game.temp = card
-
+ if (!game.vm_infl_to_do) {
+ if(game.round_player === DEM) {
+ game.return = COM
+ } else {
+ game.return = DEM
+ }
+ }
+ vm_next()
},
pass() {
push_undo()
@@ -7394,8 +7433,13 @@ states.vm_kiss_of_death = {
},
discard() {
game.vm_event = discard_card(game.communist_hand)
- next_player()
- game.state = 'vm_kiss_of_death_finish'
+ if (cards[game.vm_event].side !== "C") {
+ next_player()
+ game.state = 'vm_kiss_of_death_finish'
+ } else {
+ log('Event does not occur')
+ vm_next()
+ }
},
pass() {
log('No card to discard')
@@ -7835,9 +7879,10 @@ states.vm_nomenklatura_remove = {
return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- if (game.vm_available_ops > 0 && game.valid_spaces.length === 0 ) {
- view.prompt = 'Nomenklatura. No SPs to remove: done.'
- gen_action('done')
+ console.log('in nomenklatura, game.valid_spaces.length', game.valid_spaces.length)
+ if (game.valid_spaces.length === 0 ) {
+ view.prompt = 'Nomenklatura. No SPs to remove: pass.'
+ gen_action('pass')
} else {
view.prompt = 'Nomenklatura: remove all Democratic SPs from Elite spaces.'
@@ -7853,7 +7898,8 @@ states.vm_nomenklatura_remove = {
vm_next()
}
},
- done() {
+ pass() {
+ push_undo()
vm_next()
}
}
@@ -8639,8 +8685,8 @@ states.vm_tst_6_sc = {
do_sc(game.selected_space)
game.vm_available_ops--
game.valid_spaces = []
+ game.state = 'vm_tst_6'
vm_next()
- //game.state = 'vm_tst_6'
return
}
}
@@ -8668,6 +8714,7 @@ states.vm_tst_8 = {
},
event() {
push_undo()
+ log('Event')
game.vm_event_to_do = false
game.return_state = 'vm_tst_8'
game.return = game.active
@@ -8676,6 +8723,7 @@ states.vm_tst_8 = {
},
ops() {
push_undo()
+ log('Operations')
game.vm_infl_to_do = false
game.return = game.active
game.return_state = 'vm_tst_8'
@@ -8722,6 +8770,37 @@ states.vm_tst_8_ops = {
// ========================= POWER STRUGGLE STATES ========================
+states.vm_scare_tactics = {
+ inactive: 'remove a Support Point.',
+ prompt () {
+ if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) {
+ view.prompt = `${clean_name(cards[this_card()].name)}: no SPs to remove.`
+ gen_action('done')
+ return
+ }
+ if (game.vm_available_ops === 0 ) {
+ view.prompt = `${clean_name(cards[this_card()].name)}. Remove SPs: done.`
+ gen_action('done')
+ return
+ }
+ view.prompt = `${clean_name(cards[this_card()].name)}: remove ${pluralize(game.vm_available_ops, 'opponent SP')}${event_prompt()}.`
+ for (let space_id of game.valid_spaces) {
+ gen_action_infl(space_id);
+ }
+ },
+ infl(space) {
+ push_undo()
+ vm_do_remove_infl(space)
+ },
+ done() {
+ if (game.summary.length > 0) {
+ pop_summary()
+ log_br()
+ }
+ vm_next()
+ }
+}
+
states.vm_support_surges_1 = {
inactive: 'draw cards.',
prompt() {
@@ -8733,10 +8812,12 @@ states.vm_support_surges_1 = {
console.log('hand before', game.dem_pwr_hand)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length+1, game.com_pwr_hand.length)
game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length-1]
- console.log('hand before', game.dem_pwr_hand, 'game.temp', game.temp)
+ console.log('hand after', game.dem_pwr_hand, 'game.temp', game.temp)
} else {
+ console.log('hand before', game.com_pwr_hand)
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length, game.com_pwr_hand.length+1)
- game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length-1]
+ game.temp = game.com_pwr_hand[game.com_pwr_hand.length-1]
+ console.log('hand after', game.com_pwr_hand, 'game.temp', game.temp)
}
game.state = 'vm_support_surges_2'
@@ -8751,7 +8832,7 @@ states.vm_support_surges_2 = {
inactive: 'draw cards.',
prompt() {
if (numberless_cards.includes(game.temp)) {
- view.prompt = `Support Surges: you drew a ${power_cards[game.temp].name}. Draw a second card.`
+ view.prompt = `Support Surges: you drew ${power_cards[game.temp].name}. Draw a second card.`
} else {
view.prompt = `Support Surges: you drew a ${power_cards[game.temp].name} ${power_cards[game.temp].value}. Draw a second card.`
}
@@ -8765,7 +8846,7 @@ states.vm_support_surges_2 = {
console.log('hand before', game.dem_pwr_hand, 'game.temp', game.temp)
} else {
draw_cards(game.power_struggle_deck, game.dem_pwr_hand, game.com_pwr_hand, game.dem_pwr_hand.length, game.com_pwr_hand.length+1)
- game.temp = game.dem_pwr_hand[game.dem_pwr_hand.length - 1]
+ game.temp = game.com_pwr_hand[game.com_pwr_hand.length - 1]
}
game.state = 'vm_support_surges_3'
/*game.phase = 0
@@ -8779,7 +8860,7 @@ states.vm_support_surges_3 = {
inactive: 'draw cards.',
prompt() {
if (numberless_cards.includes(game.temp)) {
- view.prompt = `Support Surges: you drew a ${power_cards[game.temp].name}. Done.`
+ view.prompt = `Support Surges: you drew ${power_cards[game.temp].name}. Done.`
} else {
view.prompt = `Support Surges: you drew a ${power_cards[game.temp].name} ${power_cards[game.temp].value}. Done.`
}
@@ -9451,7 +9532,7 @@ CODE[83] = [ // Modrow*
[ vm_permanently_remove ],
[ vm_modrow ],
[ vm_valid_spaces_country, 'East_Germany' ],
- [ vm_prompt, 'East Germany' ],
+ [ vm_prompt, 'East Germany, no more than 2 per space' ],
[ vm_add_limited_infl, 4, 2 ],
[ vm_return ],
]