diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-09-13 17:15:00 +0100 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-09-16 11:46:21 +0100 |
commit | 678188cdcf9844f490ca83a6fe0b7a03f6518d33 (patch) | |
tree | e0bc8ce5c1c1f3c7aa7b513f73b7197b0849d344 /rules.js | |
parent | 3d8ea7307e44d55e2a675f36c97ebfb04f996743 (diff) | |
download | 1989-dawn-of-freedom-678188cdcf9844f490ca83a6fe0b7a03f6518d33.tar.gz |
Updates to prompt and gameplay
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 390 |
1 files changed, 270 insertions, 120 deletions
@@ -550,6 +550,7 @@ states.play_card ={ push_undo()
log(`Played C${cards[game.played_card].number} for influence`)
+
// Check if Common European Home played for influence
if (game.played_card === 21) {
if (game.active === DEM) {
@@ -726,6 +727,9 @@ states.finish_do_support_check = { clear_undo()
do_sc(spaces[game.selected_space].name_unique)
game.available_ops--
+ if (game.available_ops === 0) {
+ game.valid_spaces = []
+ }
game.state = 'finish_support_check_prep'
return
}
@@ -866,11 +870,13 @@ states.support_check_prep = { console.log('in ahb check, country, ', spaces[game.selected_space].country, 'ahb', game.persistent_events['austria_hungary_border_reopened'])
if (spaces[game.selected_space].country === 'East_Germany' && game.persistent_events['austria_hungary_border_reopened'] && game.active === DEM) {
game.state = 'austria_hungary_border_reopened_check'
+ return
}
//game.state = 'do_support_check'
- } else {
- game.state = 'do_support_check'
- }
+ } /*else { */
+ game.state = 'do_support_check'
+ console.log('game.state after space selected:', game.state)
+ //}
},
done () {
if (game.is_pwr_struggle) {/*Crowd Turns Against Ceausescu should be the only time you end up here during a power struggle */
@@ -893,6 +899,7 @@ states.support_check_prep = { states.do_support_check = {
inactive: 'do support checks.',
prompt () {
+ console.log('in do_support_check')
view.prompt = `Target: ${spaces[game.selected_space].name_unique}. Roll a die.`
gen_action('roll')
},
@@ -1052,7 +1059,7 @@ states.raise_stakes_1 = { inactive: 'raise the stakes',
prompt () {
- console.log('game.raised_stakes_discard', game.raised_stakes_discard)
+ console.log('game.played_power_card', game.played_power_card)
if (game.raised_stakes_discard === 3) {
view.prompt = 'Raise the stakes: done.'
gen_action('done')
@@ -1131,6 +1138,7 @@ states.raise_stakes_2 = { game.state = 'begin_power_struggle'
},
done () {
+ log('Raised the stakes')
game.raised_stakes_discard = 0
game.valid_cards = []
next_player()
@@ -1263,6 +1271,9 @@ states.power_struggle = { log_h3('Support Loss')
//if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.played_power_card === 53) {game.rally_win = 2}
//if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.played_power_card === 54) {game.petition_win = 2}
+ if (game.phase === 0) {
+ game.played_power_card = 0 /*If conceded when held the initiative but had no playable cards, ignore the last played card */
+ }
game.phase = 0
game.state = 'support_loss'
},
@@ -1328,11 +1339,12 @@ states.power_struggle = { states.support_loss ={
inactive: 'do Support Loss.',
prompt () {
+ console.log('game.played_power_card', game.played_power_card)
if (game.phase === 0) {
view.prompt = 'You lost the Power Struggle. Roll a die for Support Loss.'
gen_action('roll')
} else if (game.phase === 1 && game.available_ops > 0 && game.valid_spaces.length > 0) {
- view.prompt = `Remove ${game.available_ops} influence.`
+ view.prompt = `Support Loss: remove ${game.available_ops} influence.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id); Don't think this is needed
@@ -1976,12 +1988,21 @@ function do_sc(space) { log('+2 from Tiananmen Square Track award')
}
else {
+ let card_ops = cards[game.played_card].ops
// Check for Perestoika
if (game.active === COM && game.persistent_events['perestroika']) {
- roll++
+ card_ops++
}
- roll += cards[game.played_card].ops
- log(`+${cards[game.played_card].ops} from card ops`)
+ // Check for Sinatra Doctrine
+ if (game.active === DEM && game.persistent_events['sinatra_doctrine']) {
+ card_ops++
+ }
+ // Check for Prudence
+ if ((game.active === DEM && game.persistent_events['prudence'] === DEM) || game.active === COM && game.persistent_events['prudence'] === COM) {
+ card_ops--
+ }
+ roll += card_ops
+ log(`+${card_ops} from card ops`)
}
if (game.support_check_modifier > 0) {
@@ -2302,7 +2323,7 @@ function do_valid_cards() { }
function count_adj(name_unique) {
- const space = spaces[find_space_index(name_unique)]
+ const space = game.pieces[find_space_index(name_unique)]
let dem_adj = 0
let com_adj = 0
@@ -2311,11 +2332,9 @@ function count_adj(name_unique) { const adj_piece = game.pieces.find(piece => piece && piece.space_id === adj_space_id);
if (adj_piece) {
if (adj_piece.demCtrl === 1) {
- console.log(adj_piece.name_unique, 'is dem controlled')
dem_adj++
}
if (adj_piece.comCtrl === 1) {
- console.log(adj_piece.name_unique, 'is com controlled')
com_adj++
}
}
@@ -3040,8 +3059,9 @@ function reset_power() { game.phase = 1
game.raised_stakes_round = 0
game.raised_stakes = 0
- game.rally_win = 0
- game.petition_win = 0
+ game.played_power_card = 0
+ //game.rally_win = 0
+ //game.petition_win = 0
game.tactics_fails = ''
game.view_opp_hand = false
@@ -3055,7 +3075,7 @@ function reset_power() { game.table_cards = game.table_cards.filter(card => card !== 62)
game.persistent_events['yakovlev'] = false
}
- if (game.persistent_events['the_crowd_turns_against_ceausescu']){
+ if (game.persistent_events['the_crowd_turns_against_ceausescu'] && game.pwr_struggle_in === 'Romania'){
permanently_remove(54)
game.table_cards = game.table_cards.filter(card => card !== 54)
game.persistent_events['the_crowd_turns_against_ceausescu'] = false
@@ -3278,6 +3298,7 @@ function vm_log() { }
function vm_if() {
+ console.log('game.temp', game.temp)
console.log('vm_operand(1)', vm_operand(1))
if (!vm_operand(1)) {
let balance = 1
@@ -3312,8 +3333,9 @@ function vm_endif() { function vm_goto_step(step) {
console.log('vm_goto_step called, target:', step)
-
- for (let i = 0; i < CODE[game.vm.fp].length; i++) {
+ console.log('game.vp.ip', game.vp.ip)
+ for (let i = game.vp.ip; i < CODE[game.vm.fp].length; i++) {
+ console.log('game.vp.ip', game.vp.ip)
if (CODE[game.vm.fp][i][0] === step) {
game.vm.ip = i;
vm_exec();
@@ -3685,7 +3707,6 @@ function vm_take_control(space) { }
game.valid_spaces = game.valid_spaces.filter(id => id !== clicked_space)
log(`Took control of %${clicked_space}`)
- vm_next()
}
@@ -3759,7 +3780,7 @@ function vm_do_add_infl_free(space) { // Check whether spaces are controlled
check_control_change(clicked_space)
- if (game.vm_available_ops === 0) {game.valid_spaces = []}
+
//console.log('game pieces:', game.pieces[clicked_space])
}
@@ -4004,6 +4025,11 @@ function vm_replace_all_infl(space_id) { check_control_change(space_id)
}
+function vm_1_support_check() {
+ game.vm_available_ops = 1
+ game.state = 'vm_1_support_check_prep'
+}
+
function vm_support_check() {
game.vm_available_ops = vm_operand(1)
game.state = 'vm_support_check_prep'
@@ -4197,15 +4223,20 @@ function vm_elena(){ function vm_eliminate(space_id) {
log(`Eliminated %${space_id}`)
const adjacent_spaces = spaces[space_id].adjacent.filter(Number.isInteger);
+
+ console.log('adjacency before: Iasi', game.pieces[53].adjacent, 'Ploesti:', game.pieces[59].adjacent, 'Bucharesti:', game.pieces[61].adjacent)
// Remove clicked_space from the adjacency lists of its adjacent spaces
adjacent_spaces.forEach(s => {
game.pieces[s].adjacent = spaces[s].adjacent.filter(id => id !== space_id);
});
+ console.log('adjacency after: Iasi', game.pieces[53].adjacent, 'Ploesti:', game.pieces[59].adjacent, 'Bucharesti:', game.pieces[61].adjacent)
+
// Connect adjacent spaces to each other
for (let i = 0; i < adjacent_spaces.length; i++) {
for (let j = i + 1; j < adjacent_spaces.length; j++) {
+ console.log(' checking i,', spaces[adjacent_spaces[i]].name, 'j', spaces[adjacent_spaces[j]].name)
if (!game.pieces[adjacent_spaces[i]].adjacent.includes(adjacent_spaces[j])) {
game.pieces[adjacent_spaces[i]].adjacent.push(adjacent_spaces[j]);
}
@@ -4215,6 +4246,7 @@ function vm_eliminate(space_id) { }
}
+ console.log('adjacency after addition: Iasi', game.pieces[53].adjacent, 'Ploesti:', game.pieces[59].adjacent, 'Bucharesti:', game.pieces[61].adjacent)
// Clear the adjacency list of the clicked space
game.pieces[space_id].adjacent = [];
@@ -4375,7 +4407,7 @@ function vm_kohl_proposes_reunification() { game.vp += 2
check_vp()
if (game.persistent_events['the_wall_must_go']) {
- game.temp = 87
+ game.vm_event = 87
game.state = 'vm_common_european_home'
} else {
permanently_remove(87)
@@ -4789,14 +4821,15 @@ function vm_support_falters() { states.vm_take_control = {
get inactive() {
- return `resolve ${cards[game.played_card].name}.`
+ return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt () {
- if (game.valid_spaces.length === 0) {
- view.prompt = 'All spaces already controlled. Continue.'
+ console.log('game.vm_available_ops', game.vm_available_ops)
+ if (game.vm_available_ops > 0 && game.valid_spaces.length === 0) {
+ view.prompt = `${clean_name(cards[this_card()].name)}: all spaces controlled. Continue.`
gen_action('done')
} else if (game.vm_available_ops > 0 ) {
- view.prompt = `Take control of ${event_prompt()}.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: take control of ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
if (space) {*/
@@ -4804,13 +4837,14 @@ states.vm_take_control = { //}
}
} else {
- view.prompt = 'Done.'
+ view.prompt = `${clean_name(cards[this_card()].name)}. Take control: done.`
gen_action('done')
}
},
infl(space) {
push_undo()
vm_take_control(space)
+ game.vm_available_ops--
},
done() {
vm_next()
@@ -4873,6 +4907,7 @@ states.vm_add_infl_free = { infl(space) {
vm_do_add_infl_free(space)
if (game.vm_available_ops === 0 ) {
+ game.valid_spaces = []
game.vm_event_done = true
vm_next()
}
@@ -4951,15 +4986,20 @@ states.vm_add_limited_infl = { }
states.vm_remove_infl = {
- inactive: 'remove influence',
+ inactive: 'remove influence.',
prompt () {
- /*if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) {
- view.prompt = 'Remove influence: done.'
+ // Keep this so that there is an undo option in, e.g., Scare Tactics
+ if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) {
+ view.prompt = `${clean_name(cards[this_card()].name)}. Remove influence: done.`
gen_action('done')
return
- }*/
- view.prompt = `${clean_name(cards[this_card()].name)}: remove ${game.vm_available_ops} opponent influence${event_prompt()}.`
-
+ }
+ if (game.remove_opponent_infl) {
+ view.prompt = `${clean_name(cards[this_card()].name)}: remove ${pluralize(game.vm_available_ops, 'opponent SP')}${event_prompt()}.`
+ }
+ else {
+ view.prompt = `${clean_name(cards[this_card()].name)}: remove ${game.vm_available_ops} SP${event_prompt()}.`
+ }
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
if (space) { */
@@ -4968,12 +5008,13 @@ states.vm_remove_infl = { }
},
infl(space) {
+ push_undo()
vm_do_remove_infl(space)
const clicked_space = find_space_index(space)
game.vm_active_country = spaces[clicked_space].country
- if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) {
+ /*if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) {
vm_next()
- }
+ }*/
},
done() {
vm_next()
@@ -4983,11 +5024,15 @@ states.vm_remove_infl = { states.vm_remove_x_infl = {
get inactive() {
- return `resolve ${cards[this_card()].name}: remove influence from ${event_prompt()}.`
+ return `resolve ${clean_name(cards[this_card()].name)}: remove SP from ${event_prompt()}.`
},
prompt () {
- if (game.vm_available_ops > 0 ) {
- view.prompt = `${clean_name(cards[this_card()].name)}: remove ${game.vm_available_ops} influence from ${event_prompt()}.`
+ if (game.valid_spaces.length === 0) {
+ view.prompt = `${clean_name(cards[this_card()].name)}: no influence to remove.`
+ gen_action('done')
+ } else {
+
+ view.prompt = `${clean_name(cards[this_card()].name)}: remove ${game.vm_available_ops} SP from ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
@@ -5005,17 +5050,17 @@ states.vm_remove_x_infl = { game.vm_event_done = true
vm_next()
},
- /*done () {
+ done () {
game.vm_event_done = true
vm_next()
- }*/
+ }
}
states.vm_remove_limited_infl = {
- inactive: 'remove influence.',
+ inactive: 'remove SP.',
prompt () {
if (game.vm_available_ops > 0 && game.valid_spaces.length > 0) {
- view.prompt = `${clean_name(cards[this_card()].name)}: remove ${game.vm_available_ops} influence${event_prompt()}, no more than ${game.vm_max_infl} per space.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: remove ${game.vm_available_ops} SP${event_prompt()}, no more than ${game.vm_max_infl} per space.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
@@ -5024,7 +5069,7 @@ states.vm_remove_limited_infl = { //}
}
} else if (game.valid_spaces.length === 0) {
- view.prompt = `${clean_name(cards[this_card()].name)}: no further influence to remove.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: no further SP to remove.`
gen_action('done')
}
},
@@ -5045,11 +5090,11 @@ states.vm_remove_all_infl = { inactive: 'remove influence',
prompt () {
if (game.valid_spaces.length === 0) {
- view.prompt = `${clean_name(cards[this_card()].name)}: no influence to remove.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: no SP to remove.`
gen_action('done')
return
}
- view.prompt = `Remove all influence from ${event_prompt()}.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: remove all SPs from ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
@@ -5074,15 +5119,16 @@ states.vm_remove_all_infl = { states.vm_support_check_prep = {
inactive: 'do support check',
prompt () {
+ console.log('in states.vm_support_check_prep, game.vm_available_ops: ', game.vm_available_ops)
if (game.vm_available_ops === 0) {
- view.prompt = 'Support check: done.'
+ view.prompt = `${clean_name(cards[this_card()].name)}. Support check: done.`
gen_action('done')
} else if (game.valid_spaces.length === 0) {
- view.prompt = 'No valid targets for support check.'
+ view.prompt = `${clean_name(cards[this_card()].name)}: no valid targets for support check.`
gen_action('done')
} else {
if (game.vm_available_ops > 0) {
- view.prompt = `${event_prompt()}. ${pluralize(game.vm_available_ops, 'support check')} remaining.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: ${event_prompt()}. ${pluralize(game.vm_available_ops, 'support check')} remaining.`
}
for (let space_id of game.valid_spaces) {
if (!space_id) continue
@@ -5101,6 +5147,35 @@ states.vm_support_check_prep = { }
}
+states.vm_1_support_check_prep = {
+ inactive: 'do support check',
+ prompt () {
+ if (game.vm_available_ops === 0) {
+ view.prompt = `${clean_name(cards[this_card()].name)}. Support check: done.`
+ gen_action('done')
+ } else if (game.valid_spaces.length === 0) {
+ view.prompt = 'No valid targets for support check.'
+ gen_action('done')
+ } else {
+ view.prompt = `${clean_name(cards[this_card()].name)}: ${event_prompt()}.`
+
+ for (let space_id of game.valid_spaces) {
+ if (!space_id) continue
+ gen_action_sc(spaces[space_id].name_unique);
+ }
+ }
+ },
+ sc(space) {
+ push_undo()
+ game.selected_space = find_space_index(space)
+ game.state = 'vm_do_support_check'
+ },
+ done () {
+ game.vm_available_ops = 0
+ vm_next ()
+ }
+}
+
states.vm_do_support_check = {
inactive: 'do support checks.',
prompt () {
@@ -5188,7 +5263,7 @@ states.vm_brought_in_for_questioning = { game.phase = 1
if (cards[game.vm_event].side === 'C') {
game.return = game.active
- if (!auto_resolve_events.includes(game.vm_event)) {
+ if (!auto_resolve_events.includes(game.vm_event) && !switch_events.includes(game.vm_event)) {
next_player()
}
goto_vm(game.vm_event)
@@ -5204,7 +5279,7 @@ states.vm_central_committee_reshuffle = { return `resolve ${cards[57].name}.`
},
prompt() {
- view.prompt = 'Choose a country to add influence.'
+ view.prompt = 'Choose a country to add SP.'
if (!game.revolutions['East_Germany']) {gen_action('east_germany')}
if (!game.revolutions['Poland']) {gen_action('poland')}
if (!game.revolutions['Czechoslovakia']) {gen_action('czechoslovakia')}
@@ -5212,22 +5287,34 @@ states.vm_central_committee_reshuffle = { if (!game.revolutions['Romania']) {gen_action('romania')}
if (!game.revolutions['Bulgaria']) {gen_action('bulgaria')}
},
- east_germany() {game.valid_spaces = [1,2,3,4,5,6,7,8,9,10,11,12]
+ east_germany() {
+ game.vm_active_country = "East_Germany"
+ game.valid_spaces = [1,2,3,4,5,6,7,8,9,10,11,12]
vm_next()
},
- poland() {game.valid_spaces = [13,14,15,16,17,18,19,20,21,22,23,24,25,26]
+ poland() {
+ game.vm_active_country = "Poland"
+ game.valid_spaces = [13,14,15,16,17,18,19,20,21,22,23,24,25,26]
vm_next()
},
- czechoslovakia() {game.valid_spaces = [27,28,29,30,31,32,33,34,35,36,37]
+ czechoslovakia() {
+ game.vm_active_country = "Czechoslovakia"
+ game.valid_spaces = [27,28,29,30,31,32,33,34,35,36,37]
vm_next()
},
- hungary() {game.valid_spaces = [38,39,40,41,42,43,44,45,46,47,48,49]
+ hungary() {
+ game.vm_active_country = "Hungary"
+ game.valid_spaces = [38,39,40,41,42,43,44,45,46,47,48,49]
vm_next()
},
- romania() {game.valid_spaces = [50,51,52,53,54,55,56,57,58,59,60,61,62,63]
+ romania() {
+ game.vm_active_country = "Romania"
+ game.valid_spaces = [50,51,52,53,54,55,56,57,58,59,60,61,62,63]
vm_next()
},
- bulgaria () {game.valid_spaces = [64,65,66,67,68,69,70,71,72,73,74,75]
+ bulgaria () {
+ game.vm_active_country = "Bulgaria"
+ game.valid_spaces = [64,65,66,67,68,69,70,71,72,73,74,75]
vm_next()
},
@@ -5244,7 +5331,7 @@ states.vm_common_european_home = { gen_action_card(card)
}
} else {
- view.prompt = `Play ${cards[game.vm_event].name} for:`
+ view.prompt = `Play ${clean_name(cards[game.vm_event].name)} for:`
gen_action('influence')
gen_action('support_check')
if (game.active === DEM && game.vm_event === 87 ) {
@@ -5256,6 +5343,7 @@ states.vm_common_european_home = { }
},
card(card) {
+ push_undo()
log(`Played with C${cards[card].number}`)
game.valid_cards = []
discard(card)
@@ -5323,7 +5411,8 @@ states.vm_play_event_from_discard = { if (game.valid_cards.length === 0) {
view.prompt = 'No valid cards in discard.'
gen_action('done')
- } else if (game.temp === 0) {view.prompt = 'Choose a card. Event occurs immediately.'
+ } else if (game.temp === 0) {
+ view.prompt = `${event_prompt()}.`
for (let card of game.valid_cards) {
gen_action_card(card)
}
@@ -5352,7 +5441,7 @@ states.vm_play_event_from_discard = { states.vm_deutsche_marks_prep = {
inactive: 'choose a card.',
prompt() {
- view.prompt = 'Choose a card to give.'
+ view.prompt = 'Deutsche Marks: choose a card to give.'
for (let card of game.valid_cards) {
gen_action_card(card)
}
@@ -5373,10 +5462,10 @@ states.vm_deutsche_marks = { },
prompt() {
if(cards[game.vm_event].side === 'C' && game.playable_cards[game.vm_event].playable === 1) {
- view.prompt = `You must play ${clean_name(cards[this_card()].name)} for the event.`
+ view.prompt = `Deutsche Marks: you must play ${clean_name(cards[this_card()].name)} for the event.`
gen_action('event')
} else {
- view.prompt = `Play ${clean_name(cards[this_card()].name)} for:`
+ view.prompt = `Deutsche Marks: play ${clean_name(cards[this_card()].name)} for:`
gen_action('influence')
gen_action('support_check')
if (game.com_tst_attempted_this_turn === 0) {
@@ -5512,9 +5601,12 @@ states.vm_goodbye_lenin = { }
},
card(card) {
- log(`Chose to play ${cards[card].name} for the event`)
+ push_undo()
+ log(`Chose to play C${card} for the event`)
let card_index = game.communist_hand.indexOf(card)
game.communist_hand.splice(card_index, 1)
+ game.vm_event = card
+ game.view_opp_hand = false
goto_vm(card)
},
ops() {
@@ -5556,12 +5648,16 @@ states.vm_honecker = { return `resolve ${cards[game.played_card].name}.`
},
prompt() {
- if (game.temp === 0) {view.prompt = 'Choose a card to add to your hand.'
+ if (game.valid_cards.length === 0 && game.temp === 0) {
+ view.prompt = 'Honecker: no valid cards to choose.'
+ gen_action('done')
+ } else
+ if (game.temp === 0) {view.prompt = 'Honecker: choose a card to add to your hand.'
for (let card of game.valid_cards) {
gen_action_card(card)
}
} else {
- view.prompt = 'Choose a card: done.'
+ view.prompt = 'Honecker. Choose a card: done.'
gen_action('done')
}
},
@@ -5587,7 +5683,7 @@ states.vm_inflationary_currency = { return `resolve ${cards[game.played_card].name}.`
},
prompt() {
- view.prompt = 'Choose a country.'
+ view.prompt = 'Inflationary Currency: choose a country where your opponent has power.'
if (game.active === DEM) {
if (!game.revolutions['East_Germany']) {gen_action('east_germany')}
if (!game.revolutions['Poland']) {gen_action('poland')}
@@ -5604,22 +5700,40 @@ states.vm_inflationary_currency = { if (game.revolutions['Bulgaria']) {gen_action('bulgaria')}
}
},
- east_germany() {game.vm_active_country = 'East_Germany'
+ east_germany() {
+ push_undo()
+ game.vm_active_country = 'East_Germany'
+ log(`Chose ${country_name(game.vm_active_country)}`)
vm_next()
},
- poland() { game.vm_active_country = 'Poland'
+ poland() {
+ push_undo()
+ game.vm_active_country = 'Poland'
+ log(`Chose ${country_name(game.vm_active_country)}`)
vm_next()
},
- czechoslovakia() { game.vm_active_country = 'Czechoslovakia'
+ czechoslovakia() {
+ push_undo()
+ game.vm_active_country = 'Czechoslovakia'
+ log(`Chose ${country_name(game.vm_active_country)}`)
vm_next()
},
- hungary() { game.vm_active_country = 'Hungary'
+ hungary() {
+ push_undo()
+ game.vm_active_country = 'Hungary'
+ log(`Chose ${country_name(game.vm_active_country)}`)
vm_next()
},
- romania() { game.vm_active_country = 'Romania'
+ romania() {
+ push_undo()
+ game.vm_active_country = 'Romania'
+ log(`Chose ${country_name(game.vm_active_country)}`)
vm_next()
},
- bulgaria () { game.vm_active_country = 'Bulgaria'
+ bulgaria () {
+ push_undo()
+ game.vm_active_country = 'Bulgaria'
+ log(`Chose ${country_name(game.vm_active_country)}`)
vm_next()
},
}
@@ -5630,10 +5744,10 @@ states.vm_inflationary_currency_discard = { },
prompt() {
if (game.valid_cards.length === 0 ) {
- view.prompt = 'No valid cards to discard. You must pass.'
+ view.prompt = 'Inflationary Currency: no valid cards to discard. You must pass.'
gen_action('pass')
} else if (game.temp === 0 ) {
- view.prompt = 'You may discard a 3 op or higher value card to cancel the support check.'
+ view.prompt = 'Inflationary Currency: you may discard a 3 op or higher value card to cancel the support check.'
gen_action('pass')
for (let card of game.valid_cards) {
gen_action_card(card)
@@ -5644,7 +5758,9 @@ states.vm_inflationary_currency_discard = { }
},
card(card) {
- game.temp = discard(card)
+ push_undo()
+ discard(card)
+ game.temp = card
},
pass() {
log('Did not discard')
@@ -5768,10 +5884,10 @@ states.vm_kremlin_coup_sc = { states.vm_laszlo_tokes = {
get inactive() {
- return `resolve ${cards[game.played_card].name}.`
+ return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
- view.prompt = `Play Laszlo Tokes for:`
+ view.prompt = `Laszlo Tokes. Choose to:`
gen_action('influence')
gen_action('support_check')
},
@@ -5785,6 +5901,7 @@ states.vm_laszlo_tokes = { }
valid_spaces_infl()
game.valid_spaces = game.valid_spaces.filter(space_id => spaces[space_id].country === 'Romania')
+ game.phase = 3
vm_next()
//game.state = 'vm_add_infl'
},
@@ -5794,9 +5911,7 @@ states.vm_laszlo_tokes = { //game.state = 'vm_support_check_prep'
valid_spaces_sc()
game.valid_spaces = game.valid_spaces.filter(space_id => spaces[space_id].country === 'Romania')
- vm_goto_step(vm_support_check)
- //game.vm.ip = 7 /*Has to be a better way to do this! */
- //vm_next()
+ vm_next()
}
}
@@ -5806,7 +5921,7 @@ states.vm_switch_infl = { },
prompt() {
if (game.vm_available_ops > 0 ) {
- view.prompt = 'Select a space to replace opponent influence.'
+ view.prompt = `${clean_name(cards[game.played_card].name)}: ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
if (space) { */
@@ -6049,7 +6164,9 @@ states.vm_nomenklatura_add = { }
},
infl(space) {
+ push_undo()
vm_do_add_infl_free(space)
+ if (game.vm_available_ops === 0 ) {game.valid_spaces = []}
},
done() {
vm_next()
@@ -6119,16 +6236,29 @@ states.vm_shock_therapy = { view.prompt = 'Shock Therapy: done.'
gen_action('done')
} else {
+ log(`Selected ${country_name(game.vm_active_country)}`)
view.prompt = 'Shock Therapy: roll a die.'
gen_action('roll')
}
},
- east_germany() {game.vm_active_country = 'East_Germany'},
- poland() { game.vm_active_country = 'Poland'},
- czechoslovakia() { game.vm_active_country = 'Czechoslovakia'},
- hungary() { game.vm_active_country = 'Hungary'},
- romania() { game.vm_active_country = 'Romania'},
- bulgaria () { game.vm_active_country = 'Bulgaria'},
+ east_germany() {
+ push_undo()
+ game.vm_active_country = 'East_Germany'},
+ poland() {
+ push_undo()
+ game.vm_active_country = 'Poland'},
+ czechoslovakia() {
+ push_undo()
+ game.vm_active_country = 'Czechoslovakia'},
+ hungary() {
+ push_undo()
+ game.vm_active_country = 'Hungary'},
+ romania() {
+ push_undo()
+ game.vm_active_country = 'Romania'},
+ bulgaria () {
+ push_undo()
+ game.vm_active_country = 'Bulgaria'},
roll() {
clear_undo()
let roll = Math.floor(Math.random() * 6) + 1
@@ -6312,6 +6442,11 @@ states.vm_the_wall_must_go = { },
roll() {
clear_undo()
+ let attempt = game.the_wall_must_go['dem_wins'] + game.the_wall_must_go['com_wins']
+ if (game.the_wall_must_go['dem_roll'] === 0 && game.the_wall_must_go['com_roll'] === 0) {
+ log_h3(`Round ${attempt+1}`)
+ }
+
let roll = Math.floor(Math.random() * 6) + 1
log(`Rolled a ${roll}`)
if (game.active === DEM) {
@@ -6342,8 +6477,7 @@ states.vm_the_wall_must_go = { log('Communist wins')
game.the_wall_must_go['com_wins']++
}
- game.the_wall_must_go['dem_roll'] = 0
- game.the_wall_must_go['com_roll'] = 0
+
log(`Democrat: ${game.the_wall_must_go['dem_wins']}, Communist: ${game.the_wall_must_go['com_wins']}`)
}
if (game.the_wall_must_go['dem_wins'] === 2) {
@@ -6354,7 +6488,12 @@ states.vm_the_wall_must_go = { log('The Communist wins C86')
return
}
- next_player()
+ if (game.the_wall_must_go['dem_roll'] === 0 || game.the_wall_must_go['com_roll'] === 0) {
+ next_player()
+ } else {
+ game.the_wall_must_go['dem_roll'] = 0
+ game.the_wall_must_go['com_roll'] = 0
+ }
},
done() {
if (game.the_wall_must_go['dem_wins'] === 2) {
@@ -6420,10 +6559,10 @@ states.vm_we_are_the_people_remove = { },
prompt() {
if (game.pieces[6].demInfl === 0) {
- view.prompt = 'No influence to remove.'
+ view.prompt = '"We are the People!": no influence to remove.'
gen_action('done')
} else if (game.vm_available_ops > 0 ) {
- view.prompt = 'Remove up to 4 influence from the Lutherian Church'
+ view.prompt = '"We are the People!": remove up to 4 influence from the Lutherian Church.'
gen_action('done')
for (let space_id of game.valid_spaces) {
gen_action_infl(spaces[space_id].name_unique);
@@ -6452,12 +6591,12 @@ states.vm_we_are_the_people_add = { },
prompt() {
if (!game.vm_influence_added[6]) {
- view.prompt = 'Add influence: done.'
+ view.prompt = '"We are the People!": done.'
gen_action('done')
return
}
- view.prompt = `You must add the ${game.vm_influence_added[6]} influence to spaces in Germany`
+ view.prompt = `"We are the People!": you must add the ${game.vm_influence_added[6]} influence to spaces in Germany.`
gen_action('done')
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);*/
@@ -6465,8 +6604,10 @@ states.vm_we_are_the_people_add = { }
},
infl(space) {
- vm_do_add_infl(space)
- game.vm_influence_added++
+ push_undo()
+ vm_do_add_infl_free(space)
+ game.vm_influence_added[6]--
+ if (game.vm_influence_added[6] === 0 ) {game.valid_spaces = []}
},
done() {
vm_next()
@@ -6488,6 +6629,7 @@ states.vm_workers_revolt = { },
infl(space) {
game.temp = find_space_index(space)
+ log(`Chose %${game.temp}`)
game.state = 'vm_workers_revolt_finish'
}
}
@@ -6765,7 +6907,7 @@ states.vm_support_falters = { view.prompt = 'Support Falters: discard a card.'
gen_action('discard')
} else {
- view.prompt = 'Support Flaters: done.'
+ view.prompt = 'Support Falters: done.'
gen_action('done')
}
},
@@ -6783,16 +6925,16 @@ states.vm_support_falters = { }
/* =================== EVENTS ================================ */
-
// #region GENERATED EVENT CODE
const CODE = []
CODE[1] = [ // Legacy of Martial Law*
[ vm_valid_spaces_country_opp, 'Poland' ],
+ [ vm_prompt, 'Replace 1 Democratic SP in Poland with a Communist SP' ],
[ vm_legacy_of_martial_law ],
[ vm_valid_spaces_country_sc, 'Poland' ],
- [ vm_prompt, 'Make a Support Check in Poland' ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, 'make a Support Check in Poland' ],
+ [ vm_1_support_check ],
[ vm_permanently_remove ],
[ vm_return ],
]
@@ -6855,7 +6997,7 @@ CODE[9] = [ // The Wall* CODE[10] = [ // Cult of Personality
[ vm_valid_spaces_country_socio_2, 'Romania', 3, 4 ],
- [ vm_prompt, 'in Worker or Farmer spaces in Romania, no more than 2 per space' ],
+ [ vm_prompt, 'Worker or Farmer spaces in Romania, no more than 2 per space' ],
[ vm_add_limited_infl, 4, 2 ],
[ vm_permanently_remove ],
[ vm_return ],
@@ -6886,8 +7028,8 @@ CODE[14] = [ // Gorbachev Charms the West [ vm_valid_spaces_opponent ],
[ vm_remove_opp_infl, 2 ],
[ vm_valid_spaces_sc ],
- [ vm_prompt, 'Make a Support Check' ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, 'select a space for the Support Check' ],
+ [ vm_1_support_check ],
[ vm_return ],
]
@@ -6970,8 +7112,8 @@ CODE[27] = [ // Consumerism [ vm_remove_opp_infl, 1 ],
[ vm_valid_spaces_opponent_socio, 4 ],
[ vm_active_country ],
- [ vm_prompt, 'Make a support check in a Worker space in the same country' ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, ()=>`make a support check in a Worker space in ${country_name(game.vm_active_country)}` ],
+ [ vm_1_support_check ],
[ vm_return ],
]
@@ -7034,8 +7176,8 @@ CODE[35] = [ // Heal our Bleeding Wounds* ]
CODE[36] = [ // Dash for the West*
- [ vm_dash_for_the_west ],
[ vm_permanently_remove ],
+ [ vm_dash_for_the_west ],
[ vm_return ],
]
@@ -7071,8 +7213,8 @@ CODE[40] = [ // Hungarian Democratic Forum [ vm_prompt, 'Hungary' ],
[ vm_add_infl_free, 3 ],
[ vm_valid_spaces_country_sc, 'Hungary' ],
- [ vm_prompt, 'Make a Support Check in Hungary' ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, 'make a Support Check in Hungary' ],
+ [ vm_1_support_check ],
[ vm_permanently_remove ],
[ vm_return ],
]
@@ -7082,8 +7224,9 @@ CODE[41] = [ // Ceausescu* [ vm_prompt, ' from Romania' ],
[ vm_remove_opp_infl, 3 ],
[ vm_valid_spaces_country_sc, 'Romania' ],
- [ vm_prompt, 'Make a support check in Romania' ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, 'make a support check in Romania' ],
+ [ vm_1_support_check ],
+ [ vm_prompt, ' from Bucharesti' ],
[ vm_ceausescu ],
[ vm_permanently_remove ],
[ vm_return ],
@@ -7105,10 +7248,10 @@ CODE[44] = [ // Inflationary Currency [ vm_prompt, ()=>` from ${country_name(game.vm_active_country)}` ],
[ vm_remove_opp_infl, 2 ],
[ vm_inflationary_currency_discard ],
- [ vm_if, ()=>discarded_card() ],
+ [ vm_if, ()=>!discarded_card() ],
[ vm_valid_spaces_country_sc ],
- [ vm_prompt, ()=>`Make a Support Check in ${game.vm_active_country}` ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, ()=>`make a Support Check in ${country_name(game.vm_active_country)}` ],
+ [ vm_1_support_check ],
[ vm_endif ],
[ vm_permanently_remove ],
[ vm_return ],
@@ -7195,6 +7338,7 @@ CODE[56] = [ // Foreign Television CODE[57] = [ // Central Committee Reshuffle*
[ vm_central_committee_reshuffle ],
+ [ vm_prompt, ()=>`${country_name(game.vm_active_country)}` ],
[ vm_add_infl_free, 3 ],
[ vm_permanently_remove ],
[ vm_return ],
@@ -7261,6 +7405,7 @@ CODE[66] = [ // New Forum ]
CODE[67] = [ // Reformer Rehabilitated*
+ [ vm_prompt, 'Chose any non-scoring card in the discard pile. Event takes place immediately'],
[ vm_reformer_rehabilitated ],
[ vm_return ],
]
@@ -7302,13 +7447,14 @@ CODE[73] = [ // Laszlo Tokes* [ vm_valid_spaces, 50, 56 ],
[ vm_prompt, 'in Timisoara and Harghita/Covasna' ],
[ vm_add_limited_infl, 2, 1 ],
- [ vm_prompt, ' in Romania' ],
[ vm_laszlo_tokes ],
+ [ vm_if, ()=>game.phase === 3 ],
+ [ vm_prompt, ' in Romania' ],
[ vm_add_infl ],
- [ vm_permanently_remove ],
- [ vm_return ],
+ [ vm_else ],
[ vm_prompt, 'Make 2 Support Checks in Romania' ],
[ vm_support_check, 2 ],
+ [ vm_endif ],
[ vm_permanently_remove ],
[ vm_return ],
]
@@ -7397,8 +7543,8 @@ CODE[84] = [ // Breakaway Baltic Republics* [ vm_prompt, 'any Minorities space' ],
[ vm_take_control_prep, 1 ],
[ vm_valid_spaces_sc ],
- [ vm_prompt, 'Select a space for a support check' ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, 'select a space for the support check' ],
+ [ vm_1_support_check ],
[ vm_permanently_remove ],
[ vm_return ],
]
@@ -7432,6 +7578,7 @@ CODE[88] = [ // Adamec* ]
CODE[89] = [ // Domino Theory*
+ [ vm_prompt, 'Choose a Power Struggle card to play from the discard pile.' ],
[ vm_domino_theory ],
[ vm_permanently_remove ],
[ vm_return ],
@@ -7469,7 +7616,7 @@ CODE[92] = [ // Betrayal CODE[93] = [ // Shock Therapy*
[ vm_shock_therapy ],
[ vm_valid_spaces_country ],
- [ vm_prompt, ()=>`to ${game.vm_active_country}` ],
+ [ vm_prompt, ()=>` to ${country_name(game.vm_active_country)}` ],
[ vm_add_infl, 3 ],
[ vm_permanently_remove ],
[ vm_return ],
@@ -7494,7 +7641,7 @@ CODE[95] = [ // Power Struggle - Romania CODE[96] = [ // The Chinese Solution*
[ vm_the_chinese_solution ],
[ vm_valid_spaces_country_sc ],
- [ vm_prompt, ()=>`Make 5 Support Checks in ${game.vm_active_country}` ],
+ [ vm_prompt, ()=>`Make 5 Support Checks in ${country_name(game.vm_active_country)}` ],
[ vm_support_check_modified, 5, 3 ],
[ vm_permanently_remove ],
[ vm_return ],
@@ -7514,8 +7661,8 @@ CODE[98] = [ // Politburo Intrigue* [ vm_prompt, ' from Bulgaria' ],
[ vm_remove_limited_opp_infl, 3, 2 ],
[ vm_valid_spaces_country_sc, 'Bulgaria' ],
- [ vm_prompt, 'Make a support check in Bulgaria' ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, 'make a support check in Bulgaria' ],
+ [ vm_1_support_check ],
[ vm_permanently_remove ],
[ vm_return ],
]
@@ -7576,8 +7723,8 @@ CODE[106] = [ // Social Democratic Platform Adopted* [ vm_valid_spaces_country ],
[ vm_add_infl_free, 2 ],
[ vm_valid_spaces_country_sc ],
- [ vm_prompt, ()=>`Make a Support Check in ${game.vm_active_country}` ],
- [ vm_support_check, 1 ],
+ [ vm_prompt, ()=>`make a Support Check in ${country_name(game.vm_active_country)}` ],
+ [ vm_1_support_check ],
[ vm_permanently_remove ],
[ vm_return ],
]
@@ -7616,6 +7763,8 @@ CODE[110] = [ // Malta Summit* +
+
// ============= TIANANMEN SQUARE TRACK AWARDS ====================
CODE[203] = [//Tiananmen Square space 3 award
[vm_tst_3],
@@ -7641,6 +7790,7 @@ CODE[208] = [//Tiananmen Square space 8 event CODE[349] = [//Scare Tactics
[vm_scare_tactics],
[vm_valid_spaces_country_sc],
+ [vm_prompt, ()=>` from ${game.vm_active_country}`],
[vm_remove_opp_infl, 1],
[vm_return]
]
|