summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js58
1 files changed, 36 insertions, 22 deletions
diff --git a/rules.js b/rules.js
index 0843e6f..44cbfa8 100644
--- a/rules.js
+++ b/rules.js
@@ -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')
}
},