diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-08-29 16:47:46 +0100 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-09-16 11:46:21 +0100 |
commit | f24c243b66be8d0fa92709040ccba8359e4d0e50 (patch) | |
tree | bed83b8f3bd979baf146cb45d2671ad7fde1a8e5 | |
parent | 16eec02f7ba5e1e8822af4804ab192e4c3eb5927 (diff) | |
download | 1989-dawn-of-freedom-f24c243b66be8d0fa92709040ccba8359e4d0e50.tar.gz |
Improvements to prompt and game flow
-rw-r--r-- | events.txt | 6 | ||||
-rw-r--r-- | rules.js | 58 |
2 files changed, 40 insertions, 24 deletions
@@ -23,6 +23,7 @@ valid_spaces_country 'Poland' prompt 'any space(s) in Poland' add_infl_free 4 valid_spaces_country_sc 'Poland' +prompt ' in Poland' support_check 2 permanently_remove @@ -180,13 +181,14 @@ prompt ' from a Worker space' remove_opp_infl 1 valid_spaces_opponent_socio 4 active_country +prompt ' in the same country' support_check 1 CARD 28 - Factory Party Cells -# Remove a Democratic SP from 3 Worker spaces, no more than 2 per space. +# Remove 3 Democratic SP from Worker spaces, no more than 2 per space. valid_spaces_opponent_socio 4 -prompt '3 Worker spaces, no more than 2 per space' +prompt ' from Worker spaces' remove_limited_opp_infl 3 2 @@ -406,16 +406,16 @@ states.start_game = { }
states.choose_card = {
- inactive: 'choose a card',
+ inactive: 'choose a card.',
prompt() {
- if (game.played_card > 0) {
+ /*if (game.played_card > 0) {
game.state = 'play_card'
view.prompt = 'Choose a card: done.'
gen_action("done");
return;
- }
+ } */
- view.prompt = 'Choose a card'
+ view.prompt = 'Choose a card.'
let available_cards
if (game.active === DEM) {
available_cards = game.democrat_hand
@@ -468,19 +468,20 @@ states.choose_card = { check_vp()
game.persistent_events['ligachev'] = false
}
+ game.state = 'play_card'
},
- done () {
+ /*done () {
game.state = 'play_card'
- }
+ } */
}
states.play_card ={
get inactive() {
- return `play ${cards[game.played_card].name}.`
+ return `play ${clean_name(cards[game.played_card].name)}.`
},
prompt () {
if (game.phase >= 1) {
- view.prompt = 'Event: done.'
+ view.prompt = `${clean_name(cards[game.played_card].name)}: done.`
gen_action('done')
return
}
@@ -490,7 +491,7 @@ states.play_card ={ gen_action('event')
return
}
- view.prompt = 'Play for:'
+ view.prompt = `Play ${clean_name(cards[game.played_card].name)} for:`
//Check for Tiananmen Square Track awards special abilities
if ((game.active === DEM && cards[game.played_card].side !== 'C' && game.dem_tst_position >= 8 && game.com_tst_position < 8 && !game.tst_8) || (game.active === COM && cards[game.played_card].side !== 'D' && game.com_tst_position >= 8 && game.dem_tst_position < 8 && !game.tst_8)){
@@ -590,7 +591,7 @@ states.play_card ={ states.resolve_opponent_event = {
get inactive() {
- return `resolve ${cards[game.played_card].name}.`
+ return `resolve ${clean_name(cards[game.played_card].name)}.`
},
prompt() {
if (game.vm_infl_to_do) {
@@ -602,7 +603,7 @@ states.resolve_opponent_event = { if ((game.active === DEM && game.dem_tst_position >= 7 && game.com_tst_position < 7 && !game.tst_7) || (game.active === COM && game.com_tst_position >= 7 && game.dem_tst_position < 7 && !game.tst_7)){
gen_action('tst_7')
}
- view.prompt = 'You must resolve the opponent event.'
+ view.prompt = `${clean_name(cards[game.played_card].name)}: you must resolve the opponent event.`
gen_action('event')
} else {
view.prompt = 'Event resolved. End the action round.'
@@ -3061,6 +3062,14 @@ function this_card() { const pluralize = (count, noun, suffix = 's') =>
`${count} ${noun}${count !== 1 ? suffix : ''}`
+function clean_name(str) {
+ if (str && str.slice(-1) === '*') {
+ return str.slice(0, -1)
+ } else {
+ return str;
+ }
+}
+
// ======== LOG COMMANDS =============
function log(msg) {
@@ -4165,12 +4174,14 @@ function vm_foreign_television() { function vm_frg_embassies() {
game.persistent_events['frg_embassies'] = true
game.table_cards.push(74)
+ log('C74 in effect')
vm_next()
}
function vm_general_strike() {
game.persistent_events['general_strike'] = true
game.table_cards.push(5)
+ log('C5 in effect')
vm_next()
}
@@ -4754,7 +4765,7 @@ states.vm_add_infl = { states.vm_add_infl_free = {
get inactive() {
- return `resolve ${cards[this_card()].name}: add influence.`
+ return `resolve ${clean_name(cards[this_card()].name)}: add influence.`
},
prompt () {
if (game.vm_available_ops > 0 && game.valid_spaces.length === 0 ) {
@@ -4762,7 +4773,7 @@ states.vm_add_infl_free = { gen_action('done')
}
else if (game.vm_available_ops > 0 ) {
- view.prompt = `${cards[this_card()].name}: add ${game.vm_available_ops} influence to ${event_prompt()}.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_available_ops} influence to ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
@@ -4815,11 +4826,11 @@ states.vm_add_x_infl = { states.vm_add_limited_infl = {
get inactive() {
- return `resolve ${cards[this_card()].name}: add influcence.`
+ return `resolve ${clean_name(cards[this_card()].name)}: add influcence.`
},
prompt () {
if (game.vm_available_ops > 0 && game.valid_spaces.length > 0) {
- view.prompt = `${cards[this_card()].name}: add ${game.vm_available_ops} influence to ${event_prompt()}.`
+ view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_available_ops} influence to ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
@@ -4828,7 +4839,7 @@ states.vm_add_limited_infl = { //}
}
} else {
- view.prompt = 'Done.'
+ view.prompt = `${clean_name(cards[this_card()].name)}: done.`
gen_action('done')
}
},
@@ -4844,12 +4855,12 @@ states.vm_add_limited_infl = { states.vm_remove_infl = {
inactive: 'remove influence',
prompt () {
- if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) {
+ /*if (game.vm_available_ops === 0 || game.valid_spaces.length === 0) {
view.prompt = 'Remove influence: done.'
gen_action('done')
return
- }
- view.prompt = `Remove ${game.vm_available_ops} opponent influence${event_prompt()}.`
+ }*/
+ view.prompt = `${clean_name(cards[this_card()].name)}: remove ${game.vm_available_ops} opponent influence${event_prompt()}.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
@@ -4862,6 +4873,9 @@ states.vm_remove_infl = { 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) {
+ vm_next()
+ }
},
done() {
vm_next()
@@ -4901,7 +4915,7 @@ states.vm_remove_limited_infl = { inactive: 'remove influence.',
prompt () {
if (game.vm_available_ops > 0 && game.valid_spaces.length > 0) {
- view.prompt = `Remove ${game.vm_available_ops} influence, no more than ${game.vm_max_infl} per space.`
+ 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.`
for (let space_id of game.valid_spaces) {
/*const space = spaces.find(s => s && s.space_id === space_id);
@@ -4910,7 +4924,7 @@ states.vm_remove_limited_infl = { //}
}
} else {
- view.prompt = 'Done.'
+ view.prompt = `${clean_name(cards[this_card()].name)}: done.`
gen_action('done')
}
},
@@ -5058,7 +5072,7 @@ states.vm_brought_in_for_questioning = { view.prompt = 'Brought in for Questioning. No cards to discard.'
gen_action('done')
} else {
- view.prompt = 'Brought in for Questioning. You must discard a card.'
+ view.prompt = 'Brought in for Questioning: you must discard a random card.'
gen_action('discard')
}
},
|