summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-29 00:13:12 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-29 01:27:32 +0100
commit02d028e66bcfb378f669215ea7a7756c0407e9c2 (patch)
treee262206c5aa2f2295fa5c38a3f5b9f36d4e99230
parent07ee7cf2d1eb6eab14095c50186bf611a81ddb66 (diff)
download1989-dawn-of-freedom-02d028e66bcfb378f669215ea7a7756c0407e9c2.tar.gz
Remove optional semicolons.
-rw-r--r--rules.js328
1 files changed, 164 insertions, 164 deletions
diff --git a/rules.js b/rules.js
index 0d488d5..41c01c9 100644
--- a/rules.js
+++ b/rules.js
@@ -508,19 +508,19 @@ states.place_starting_infl = {
inactive: 'place starting SPs.',
prompt() {
if (game.temp === (game.starting_infl.length - 1) && game.available_ops === 0 ) {
- view.prompt = 'Place starting SPs: done. Start Turn 1.';
- gen_action("start");
+ view.prompt = 'Place starting SPs: done. Start Turn 1.'
+ gen_action("start")
} else if (game.available_ops === 0) {
- view.prompt = 'Place starting SPs: done.';
- gen_action("done");
- return;
+ view.prompt = 'Place starting SPs: done.'
+ gen_action("done")
+ return
} else if ((game.starting_infl.length === 5 && game.temp > 2) || game.temp > 3) {
view.prompt = `Place your last ${pluralize(game.available_ops,'starting SP')}.`
} else {
view.prompt = `Place ${pluralize(game.available_ops,'starting SP')}.`
}
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
},
space(space) {
@@ -794,7 +794,7 @@ states.add_influence = {
} else {
view.prompt = `Add SPs: ${game.available_ops} remaining.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -1144,9 +1144,9 @@ states.the_crowd_turns_against_ceausescu_infl = {
prompt () {
if (game.vm_available_ops === 0)
{
- view.prompt = 'Place SPs: done.';
- gen_action("done");
- return;
+ view.prompt = 'Place SPs: done.'
+ gen_action("done")
+ return
}
view.prompt = `Add SPs: ${game.vm_available_ops} remaining`
@@ -1289,12 +1289,12 @@ states.power_struggle = {
if (game.phase === 1) {
let base_prompt = `${power_cards[game.played_power_card].name} played` + (leader_cards.includes(game.played_power_card) ? ` as a ${game.proxy_power_card}.` : ".")
if (game.valid_cards.length > 0) {
- view.prompt = `${base_prompt} You must match or concede.`;
+ view.prompt = `${base_prompt} You must match or concede.`
for (let card of game.valid_cards) {
- gen_action_power_card(card);
+ gen_action_power_card(card)
}
} else {
- view.prompt = `${base_prompt} You must concede.`;
+ view.prompt = `${base_prompt} You must concede.`
}
gen_action('concede')
}
@@ -1974,8 +1974,8 @@ states.stasi_play_card = {
push_undo()
game.played_card = card
let find_card
- find_card = game.democrat_hand.indexOf(card);
- game.democrat_hand.splice(find_card, 1);
+ find_card = game.democrat_hand.indexOf(card)
+ game.democrat_hand.splice(find_card, 1)
game.available_ops = get_card_ops(card)
if (game.democrat_hand.includes(C_COMMON_EUROPEAN_HOME) && cards[card].side === "C") {
@@ -2090,12 +2090,12 @@ function remove_infl(space, ops) {
if (game.active === COM) {
game.demInfl[space]--
if (game.demInfl[space] === 0) {
- game.valid_spaces = game.valid_spaces.filter(id => id !== space);
+ game.valid_spaces = game.valid_spaces.filter(id => id !== space)
}
} else {
game.comInfl[space]--
if (game.comInfl[space] === 0) {
- game.valid_spaces = game.valid_spaces.filter(id => id !== space);
+ game.valid_spaces = game.valid_spaces.filter(id => id !== space)
}
}
check_tyrant()
@@ -2104,12 +2104,12 @@ function remove_infl(space, ops) {
if (game.active === COM) {
game.comInfl[space]--
if (game.comInfl[space] === 0) {
- game.valid_spaces = game.valid_spaces.filter(id => id !== space);
+ game.valid_spaces = game.valid_spaces.filter(id => id !== space)
}
} else {
game.demInfl[space]--
if (game.demInfl[space] === 0) {
- game.valid_spaces = game.valid_spaces.filter(id => id !== space);
+ game.valid_spaces = game.valid_spaces.filter(id => id !== space)
}
}
check_tyrant()
@@ -2296,19 +2296,19 @@ function valid_spaces_setup() {
let infl = game.demInfl[i]
if (infl === 0) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
} else {
let infl = game.comInfl[i]
if (infl === 0) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
}
}
function valid_spaces_sc() {
- let valid_spaces_set = new Set();
+ let valid_spaces_set = new Set()
for (let i = 0 ; i < spaces.length; i++) {
let space = spaces[i]
@@ -2316,7 +2316,7 @@ function valid_spaces_sc() {
if (game.active === DEM) {
let infl = game.comInfl[i]
if (infl !== 0 ) {
- valid_spaces_set.add(space.space_id);
+ valid_spaces_set.add(space.space_id)
}
} else {
let infl = game.demInfl[i]
@@ -2326,56 +2326,56 @@ function valid_spaces_sc() {
if (game.persistent_events.includes(C_WE_ARE_THE_PEOPLE) && space.space_id === S_LEIPZIG) {continue}
if (game.persistent_events.includes(C_FOREIGN_CURRENCY_DEBT_BURDEN) && space.country === game.foreign_currency_debt_burden) {continue}
- valid_spaces_set.add(space.space_id);
+ valid_spaces_set.add(space.space_id)
}
}
}
- game.valid_spaces = Array.from(valid_spaces_set);
+ game.valid_spaces = Array.from(valid_spaces_set)
//Check for the Crown Turns Against Ceausescu
if (game.is_pwr_struggle && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU)) {
game.valid_spaces = game.valid_spaces.filter(n => spaces[n].country === 'Romania')
}
- return game.valid_spaces;
+ return game.valid_spaces
}
function valid_spaces_support_loss() {
- let valid_spaces_set = new Set();
+ let valid_spaces_set = new Set()
for (let i = 0; i < game.demInfl.length; i++) {
let space = spaces[i]
if (game.active === DEM) {
let infl = game.demInfl[i]
if (infl > 0 && space.country === game.pwr_struggle_in) {
- valid_spaces_set.add(space.space_id);
+ valid_spaces_set.add(space.space_id)
}
} else {
let infl = game.comInfl[i]
if (infl > 0 && space.country === game.pwr_struggle_in) {
- valid_spaces_set.add(space.space_id);
+ valid_spaces_set.add(space.space_id)
}
}
}
- game.valid_spaces = Array.from(valid_spaces_set);
- return game.valid_spaces;
+ game.valid_spaces = Array.from(valid_spaces_set)
+ return game.valid_spaces
}
function valid_spaces_infl() {
// Check if function is called from the VM or not, take relevant ops variable
- let ops = game.state.startsWith('vm') ? game.vm_available_ops : game.available_ops;
+ let ops = game.state.startsWith('vm') ? game.vm_available_ops : game.available_ops
- let valid_spaces_set = new Set();
+ let valid_spaces_set = new Set()
for (let i = 0; i < game.demInfl.length; i++) {
let space = spaces[i]
- let player_influence = game.active === COM ? game.comInfl[i] : game.demInfl[i];
+ let player_influence = game.active === COM ? game.comInfl[i] : game.demInfl[i]
// If the piece has the player's influence, add it and its adjacent spaces to the set
if (player_influence > 0) {
- valid_spaces_set.add(space.space_id);
+ valid_spaces_set.add(space.space_id)
let adjacent_spaces = get_adjusted_adjacency(space.space_id)
for (let adj_space_id of adjacent_spaces) {
if (adj_space_id >= 0) {
- const adj_piece = spaces[adj_space_id];
+ const adj_piece = spaces[adj_space_id]
// Check if the adjacent space is controlled by the opponent
const opponent_control = check_opp_control(adj_piece.space_id)
@@ -2393,8 +2393,8 @@ function valid_spaces_infl() {
}
}
}
- game.valid_spaces = Array.from(valid_spaces_set);
- return game.valid_spaces;
+ game.valid_spaces = Array.from(valid_spaces_set)
+ return game.valid_spaces
}
function valid_cards(player_hand, presence) {
@@ -2462,43 +2462,43 @@ function count_adj(space_id) {
function check_control(space_id) {
if ( (game.comInfl[space_id] - game.demInfl[space_id]) >= spaces[space_id].stability) {
- return true;
+ return true
} else if ((game.demInfl[space_id] - game.comInfl[space_id]) >= spaces[space_id].stability) {
- return true;
+ return true
} else {
- return false;
+ return false
}
}
function check_opp_control(space_id) {
if (game.active === DEM && ((game.comInfl[space_id] - game.demInfl[space_id]) >= spaces[space_id].stability)) {
- return true;
+ return true
} else if (game.active === COM && ((game.demInfl[space_id] - game.comInfl[space_id]) >= spaces[space_id].stability)) {
- return true;
+ return true
} else {
- return false;
+ return false
}
}
function check_dem_control(space_id) {
if ((game.demInfl[space_id] - game.comInfl[space_id]) >= spaces[space_id].stability) {
- return true;
+ return true
} else {
- return false;
+ return false
}
}
function check_com_control(space_id) {
if ((game.comInfl[space_id] - game.demInfl[space_id]) >= spaces[space_id].stability) {
- return true;
+ return true
} else {
- return false;
+ return false
}
}
function do_tst_attempt() {
- let roll = roll_d6();
- log(`Roll: D${roll}`);
+ let roll = roll_d6()
+ log(`Roll: D${roll}`)
roll += game.available_ops
logi(`+${game.available_ops} from card ops`)
@@ -2506,7 +2506,7 @@ function do_tst_attempt() {
// TIANANMEN SQUARE MODIFIERS
if (game.active === DEM && game.dem_tst_attempted === 1 || game.active === COM && game.com_tst_attempted === 1) {
- roll ++;
+ roll ++
logi('+1 from previous TST attempts')
}
if (game.active === DEM && game.dem_tst_position >= 1 && game.com_tst_position === 0) {
@@ -2518,8 +2518,8 @@ function do_tst_attempt() {
logi('+1 from TST award')
}
if ((game.active === DEM && cards[game.played_card].side === 'D') || (game.active === COM && cards[game.played_card].side === 'C')) {
- roll ++;
- logi('+1 for playing own card');
+ roll ++
+ logi('+1 for playing own card')
}
if (game.active === COM && game.persistent_events.includes(53)) {
roll ++
@@ -2599,46 +2599,46 @@ function do_tst_attempt() {
function check_presence(country) {
- let dem_spaces = 0;
- let com_spaces = 0;
- let dem_battlegrounds = 0;
- let com_battlegrounds = 0;
- let dem_leaders = {1: false, 4: false, 5: false, 6: false, 7: false};
- let com_leaders = {1: false, 4: false, 5: false, 6: false, 7: false};
+ let dem_spaces = 0
+ let com_spaces = 0
+ let dem_battlegrounds = 0
+ let com_battlegrounds = 0
+ let dem_leaders = {1: false, 4: false, 5: false, 6: false, 7: false}
+ let com_leaders = {1: false, 4: false, 5: false, 6: false, 7: false}
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
if (space.country === country) {
if (check_dem_control(i)) {
- dem_spaces++;
+ dem_spaces++
if (space.battleground === 1) {
- dem_battlegrounds++;
+ dem_battlegrounds++
}
if (leaders.includes(space.socio)) {
- dem_leaders[space.socio] = true;
+ dem_leaders[space.socio] = true
}
}
if (check_com_control(i)) {
- com_spaces++;
+ com_spaces++
if (space.battleground === 1) {
- com_battlegrounds++;
+ com_battlegrounds++
}
if (leaders.includes(space.socio)) {
- com_leaders[space.socio] = true;
+ com_leaders[space.socio] = true
}
}
}
}
// Determine domination
- let dem_domination = dem_battlegrounds > com_battlegrounds && dem_spaces > com_spaces && dem_spaces - dem_battlegrounds > 0;
- let com_domination = com_battlegrounds > dem_battlegrounds && com_spaces > dem_spaces && com_spaces - com_battlegrounds > 0;
+ let dem_domination = dem_battlegrounds > com_battlegrounds && dem_spaces > com_spaces && dem_spaces - dem_battlegrounds > 0
+ let com_domination = com_battlegrounds > dem_battlegrounds && com_spaces > dem_spaces && com_spaces - com_battlegrounds > 0
// Determine control
- let total_battlegrounds = battlegrounds(country);
- let dem_control = dem_battlegrounds === total_battlegrounds && dem_spaces > com_spaces;
- let com_control = com_battlegrounds === total_battlegrounds && com_spaces > dem_spaces;
+ let total_battlegrounds = battlegrounds(country)
+ let dem_control = dem_battlegrounds === total_battlegrounds && dem_spaces > com_spaces
+ let com_control = com_battlegrounds === total_battlegrounds && com_spaces > dem_spaces
return {
dem_spaces: dem_spaces,
@@ -2651,11 +2651,11 @@ function check_presence(country) {
com_control: com_control,
dem_leaders: dem_leaders,
com_leaders: com_leaders
- };
+ }
}
function battlegrounds(country) {
- let battlegrounds = 0;
+ let battlegrounds = 0
if (country === "Hungary") {
battlegrounds = 4
} else if (country === "Bulgaria") {
@@ -2663,7 +2663,7 @@ function battlegrounds(country) {
} else {
battlegrounds = 6
}
- return battlegrounds;
+ return battlegrounds
}
function take_power(country) {
@@ -3375,18 +3375,18 @@ function end_round() {
// Check for duplicate card entries
let card_check
if (game.samizdat_card > 0) {
- card_check = [...game.strategy_deck, ...game.strategy_discard, ...game.strategy_removed, ...game.persistent_events, ...game.communist_hand, ... game.democrat_hand, game.samizdat_card];
+ card_check = [...game.strategy_deck, ...game.strategy_discard, ...game.strategy_removed, ...game.persistent_events, ...game.communist_hand, ... game.democrat_hand, game.samizdat_card]
} else {
- card_check = [...game.strategy_deck, ...game.strategy_discard, ...game.strategy_removed, ...game.persistent_events, ...game.communist_hand, ... game.democrat_hand];
+ card_check = [...game.strategy_deck, ...game.strategy_discard, ...game.strategy_removed, ...game.persistent_events, ...game.communist_hand, ... game.democrat_hand]
}
card_check = card_check.filter(card => card <= last_strategy_card)
function check_duplicates(array) {
- return new Set(array).size !== array.length;
+ return new Set(array).size !== array.length
}
function find_duplicates(array) {
- const duplicates = array.filter((item, index) => array.indexOf(item) !== index);
- return [...new Set(duplicates)];
+ const duplicates = array.filter((item, index) => array.indexOf(item) !== index)
+ return [...new Set(duplicates)]
}
card_check = card_check.sort((a, b) => a - b)
@@ -3648,24 +3648,24 @@ function draw_deck() {
function draw_cards(deck, democrat_hand, communist_hand, dem_hand_limit, com_hand_limit) {
//Start with the communist player
- let turn = 'communist';
+ let turn = 'communist'
while (democrat_hand.length < dem_hand_limit || communist_hand.length < com_hand_limit) {
if (deck.length === 0) {
log_h3('--- Reshuffle ---')
deck.push(...game.strategy_discard)
game.strategy_discard = []
} else if (turn === 'communist' && communist_hand.length < com_hand_limit) {
- communist_hand.push(draw_card(deck));
- turn = 'democrat';
+ communist_hand.push(draw_card(deck))
+ turn = 'democrat'
} else if(turn === 'communist' && communist_hand.length === com_hand_limit) {
- turn = 'democrat';
+ turn = 'democrat'
}
else if (turn === 'democrat' && democrat_hand.length < dem_hand_limit) {
- democrat_hand.push(draw_card(deck));
- turn = 'communist';
+ democrat_hand.push(draw_card(deck))
+ turn = 'communist'
}
else if (turn === 'democrat' && democrat_hand.length === dem_hand_limit) {
- turn = 'communist';
+ turn = 'communist'
}
}
clear_undo()
@@ -3678,7 +3678,7 @@ function draw_card(deck) {
game.strategy_discard = []
}
const randomIndex = Math.floor(random(deck.length))
- return deck.splice(randomIndex, 1)[0];
+ return deck.splice(randomIndex, 1)[0]
}
function discard(card) {
@@ -3697,11 +3697,11 @@ function discard(card) {
}
} else if (game.is_pwr_struggle) {
if (game.active === COM) {
- find_card = game.com_pwr_hand.indexOf(card);
- game.com_pwr_hand.splice(find_card, 1);
+ find_card = game.com_pwr_hand.indexOf(card)
+ game.com_pwr_hand.splice(find_card, 1)
} else {
- find_card = game.dem_pwr_hand.indexOf(card);
- game.dem_pwr_hand.splice(find_card, 1);
+ find_card = game.dem_pwr_hand.indexOf(card)
+ game.dem_pwr_hand.splice(find_card, 1)
}
game.power_struggle_discard.push(card)
}
@@ -3721,11 +3721,11 @@ function silent_discard(card) {
}
} else if (game.is_pwr_struggle) {
if (game.active === COM) {
- find_card = game.com_pwr_hand.indexOf(card);
- game.com_pwr_hand.splice(find_card, 1);
+ find_card = game.com_pwr_hand.indexOf(card)
+ game.com_pwr_hand.splice(find_card, 1)
} else {
- find_card = game.dem_pwr_hand.indexOf(card);
- game.dem_pwr_hand.splice(find_card, 1);
+ find_card = game.dem_pwr_hand.indexOf(card)
+ game.dem_pwr_hand.splice(find_card, 1)
}
game.power_struggle_discard.push(card)
}
@@ -3848,7 +3848,7 @@ function clean_name(str) {
if (str && str.slice(-1) === '*') {
return str.slice(0, -1)
} else {
- return str;
+ return str
}
}
@@ -3941,9 +3941,9 @@ function pop_summary() {
if (game.summary.length > 0) {
for (let [n, msg] of game.summary) {
if (n > 1) {
- log(msg.replace("£ SP", `${n} SPs`));
+ log(msg.replace("£ SP", `${n} SPs`))
} else {
- log(msg.replace("£ SP", `${n} SP`));
+ log(msg.replace("£ SP", `${n} SP`))
}
}
}
@@ -3954,9 +3954,9 @@ function pop_summary_i() {
if (game.summary.length > 0) {
for (let [n, msg] of game.summary) {
if (n > 1) {
- logi(msg.replace("£ SP", `${n} SPs`));
+ logi(msg.replace("£ SP", `${n} SPs`))
} else {
- logi(msg.replace("£ SP", `${n} SP`));
+ logi(msg.replace("£ SP", `${n} SP`))
}
}
}
@@ -4030,24 +4030,24 @@ function object_copy(original) {
/* =================== VM FUNCTIONS ========================== */
function goto_vm(proc) {
- let old_vm = game.vm;
+ let old_vm = game.vm
- game.state = "vm";
+ game.state = "vm"
game.vm = {
prompt: 0,
fp: proc,
ip: 0,
- };
+ }
if (old_vm) {
- game.vm.return_vm = old_vm;
+ game.vm.return_vm = old_vm
}
- vm_exec();
+ vm_exec()
}
function vm_exec() {
- vm_inst(0)();
+ vm_inst(0)()
}
function vm_inst(a) {
@@ -4055,8 +4055,8 @@ function vm_inst(a) {
}
function vm_next() {
- game.vm.ip++;
- vm_exec();
+ game.vm.ip++
+ vm_exec()
}
function vm_logi(){
@@ -4106,13 +4106,13 @@ function vm_endif() {
function vm_goto_step(step) {
for (let i = game.vm.ip; i < CODE[game.vm.fp].length; i++) {
if (CODE[game.vm.fp][i][0] === step) {
- game.vm.ip = i;
- vm_exec();
- return;
+ game.vm.ip = i
+ vm_exec()
+ return
}
}
- console.log("ERROR: Target operation not found in the current procedure.");
+ console.log("ERROR: Target operation not found in the current procedure.")
}
function vm_goto(op, nop, dir, step) {
@@ -4198,8 +4198,8 @@ function vm_valid_spaces() {
game.valid_spaces.push(space.space_id)
}
}
- check_systematization();
- vm_next();
+ check_systematization()
+ vm_next()
}
function vm_valid_spaces_com() {
@@ -4208,8 +4208,8 @@ function vm_valid_spaces_com() {
if (game.comInfl[space.space_id] >0) {
game.valid_spaces.push(space.space_id)
}
- check_systematization();
- vm_next();
+ check_systematization()
+ vm_next()
}
function vm_valid_spaces_opponent () {
@@ -4273,7 +4273,7 @@ function vm_valid_spaces_country () {
else {country = game.vm_active_country}
for (let space of spaces) {
if (space.country === country) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
check_systematization()
@@ -4295,11 +4295,11 @@ function vm_valid_spaces_country_opp () {
for (let space of spaces) {
if (game.active === DEM) {
if (space.country === country && game.comInfl[space.space_id] >0) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
} else {
if (space.country === country && game.demInfl[space.space_id]>0) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
}
@@ -4322,7 +4322,7 @@ function vm_valid_spaces_country_socio_2() {
for (let space of spaces) {
if (space.space_id === game.systematization) continue
if ((space.country === vm_operand(1) && space.socio === vm_operand(2)) || (space.country === vm_operand(1) && space.socio === vm_operand(3))) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
vm_next()
@@ -4333,7 +4333,7 @@ function vm_valid_spaces_region_socio() {
for (let space of spaces) {
if (space.space_id === game.systematization) continue
if (space.region === vm_operand(1) && space.socio === vm_operand(2)) {
- valid_spaces.push(space.space_id);
+ valid_spaces.push(space.space_id)
}
}
game.valid_spaces = valid_spaces
@@ -4345,7 +4345,7 @@ function vm_valid_spaces_region_opp() {
for (let space of spaces) {
let s = space.space_id
if ((game.active === DEM && space.region === vm_operand(1) && game.comInfl[s] > 0 ) || (game.active === COM && space.region === vm_operand(1) && game.demInfl[s] > 0 )) {
- valid_spaces.push(space.space_id);
+ valid_spaces.push(space.space_id)
}
}
game.valid_spaces = valid_spaces
@@ -4358,7 +4358,7 @@ function vm_valid_spaces_solidarity_legalised() {
let space = spaces[i]
let uncontrolled = (!check_control(i) && !check_opp_control(i))
if ((space.country === 'Poland' && uncontrolled && space.socio === 3) || (space.country === 'Poland' && uncontrolled && space.socio === 4)) {
- valid_spaces.push(space.space_id);
+ valid_spaces.push(space.space_id)
}
}
return valid_spaces
@@ -4450,11 +4450,11 @@ function vm_do_add_limited_infl(space, max_infl) {
game.vm_available_ops --
if (!game.vm_influence_added) {
- game.vm_influence_added = {};
+ game.vm_influence_added = {}
}
if (!game.vm_influence_added[space]) {
- game.vm_influence_added[space] = 0;
+ game.vm_influence_added[space] = 0
}
if (game.active === COM) {
@@ -4466,7 +4466,7 @@ function vm_do_add_limited_infl(space, max_infl) {
game.vm_influence_added[space] ++
if (game.vm_influence_added[space] === max_infl) {
- game.valid_spaces = game.valid_spaces.filter(id => id !== space);
+ game.valid_spaces = game.valid_spaces.filter(id => id !== space)
}
check_tyrant()
if (game.vm_available_ops === 0) {game.valid_spaces = [] }
@@ -4549,11 +4549,11 @@ function vm_do_remove_limited_infl(space, max_infl) {
game.vm_available_ops --
if (!game.vm_influence_added) {
- game.vm_influence_added = {};
+ game.vm_influence_added = {}
}
if (!game.vm_influence_added[space]) {
- game.vm_influence_added[space] = 0;
+ game.vm_influence_added[space] = 0
}
if (game.active === COM) {
@@ -4571,7 +4571,7 @@ function vm_do_remove_limited_infl(space, max_infl) {
game.vm_influence_added[space] ++
if (game.vm_influence_added[space] === max_infl) {
- game.valid_spaces = game.valid_spaces.filter(id => id !== space);
+ game.valid_spaces = game.valid_spaces.filter(id => id !== space)
}
check_tyrant()
@@ -4802,16 +4802,16 @@ function vm_dash_for_the_west() {
}
function vm_deutsche_marks() {
- let max_value = 1;
+ let max_value = 1
for (let c of game.democrat_hand) {
if (cards[c].ops > max_value) {
max_value = cards[c].ops
}
}
- let valid_cards = [];
+ let valid_cards = []
for (let c of game.democrat_hand) {
if (cards[c].ops === max_value) {
- valid_cards.push(c);
+ valid_cards.push(c)
}
}
game.valid_cards = valid_cards
@@ -4864,18 +4864,18 @@ function vm_eliminate(space_id) { // Eliminate the democrat influence and move t
}
function get_adjusted_adjacency(space_id) {
- let adjacent_spaces = spaces[space_id].adjacent;
+ let adjacent_spaces = spaces[space_id].adjacent
if (adjacent_spaces.includes(game.systematization)) {
- let eliminated_space_id = game.systematization;
+ let eliminated_space_id = game.systematization
adjacent_spaces = adjacent_spaces.map(adj_space_id => {
if (adj_space_id === eliminated_space_id) {
- return spaces[eliminated_space_id].adjacent;
+ return spaces[eliminated_space_id].adjacent
}
- return adj_space_id;
+ return adj_space_id
}).flat(); // Flatten in case the eliminated space has multiple adjacencies
}
adjacent_spaces = adjacent_spaces.filter(s => s !== space_id)
- return adjacent_spaces;
+ return adjacent_spaces
}
function vm_exit_visas() {
@@ -5076,7 +5076,7 @@ function vm_legacy_of_1968() {
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
if ((!check_com_control(i) && space.country === 'Czechoslovakia')) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
vm_next()
@@ -5159,7 +5159,7 @@ function vm_poszgay() {
let valid_spaces = []
for (let space of spaces) {
if (space && space.country === 'Hungary' && !check_dem_control(space.space_id)) {
- valid_spaces.push(space.space_id);
+ valid_spaces.push(space.space_id)
}
}
game.valid_spaces = valid_spaces
@@ -5450,7 +5450,7 @@ function vm_we_are_the_people() {
add_to_persistent_events(C_WE_ARE_THE_PEOPLE)
logi(`The Communist may no longer make Support Checks in Leipzig`)
if (!game.vm_influence_added) {
- game.vm_influence_added = {};
+ game.vm_influence_added = {}
}
game.vm_influence_added[S_LUTHERAN_CHURCH] = 0
game.vm_available_ops = 4
@@ -5462,14 +5462,14 @@ function vm_workers_revolt() {
for (let space of spaces) {
let country = space.country
if (!game.revolutions[find_country_index(country)] && game.comInfl[space.space_id] > 0 && space.socio === 4) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
} else {
for (let space of spaces) {
let country = space.country
if (game.revolutions[find_country_index(country)] && game.demInfl[space.space_id] > 0 && space.socio === 4) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
}
@@ -5542,7 +5542,7 @@ function vm_kremlin_coup_elite() {
game.valid_spaces=[]
elite_spaces.forEach(space => {
if (spaces[space].country === game.vm_active_country && !check_com_control(space)) {
- game.valid_spaces.push(space);
+ game.valid_spaces.push(space)
}
})
game.state = 'vm_kremlin_coup_take_control'
@@ -5584,7 +5584,7 @@ states.vm_take_control = {
} else if (game.vm_available_ops > 0 ) {
view.prompt = `${clean_name(cards[this_card()].name)}: take control of ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
} else {
view.prompt = `${clean_name(cards[this_card()].name)}. Take control: done.`
@@ -5666,7 +5666,7 @@ states.vm_add_infl_free = {
view.prompt = `${clean_name(cards[this_card()].name)}: add ${game.vm_available_ops} SPs to ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
} else {
get_end_infl_prompt()
@@ -5742,7 +5742,7 @@ states.vm_add_limited_infl = {
view.prompt = `${clean_name(cards[this_card()].name)}: add ${pluralize(game.vm_available_ops,'SP')} to ${event_prompt()}.`
}
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -5778,7 +5778,7 @@ states.vm_remove_infl = {
view.prompt = `${clean_name(cards[this_card()].name)}: remove ${pluralize(game.vm_available_ops,'SP')}${event_prompt()}.`
}
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
},
space(space) {
@@ -5815,7 +5815,7 @@ states.vm_remove_x_infl = {
view.prompt = `${clean_name(cards[this_card()].name)}: remove ${pluralize(game.vm_available_ops,'SP')} from ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -5839,7 +5839,7 @@ states.vm_remove_limited_infl = {
view.prompt = `${clean_name(cards[this_card()].name)}: remove ${pluralize(game.vm_available_ops,'SP')}${event_prompt()}, no more than ${game.vm_max_infl} per space.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
} else if (game.valid_spaces.length === 0 && game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: no further SP to remove.`
@@ -5870,7 +5870,7 @@ states.vm_remove_all_infl = {
} else if (game.vm_available_ops > 0) {
view.prompt = `${clean_name(cards[this_card()].name)}: remove all SPs from ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -5900,7 +5900,7 @@ states.vm_support_check_prep = {
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) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -6007,7 +6007,7 @@ states.vm_1_support_check_prep = {
} else {
view.prompt = `${clean_name(cards[this_card()].name)}: ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -6858,7 +6858,7 @@ states.vm_kremlin_coup_take_control = {
} else {
view.prompt = `Kremlin Coup! Take control of the Elite space in ${country_name(game.vm_active_country)}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -6891,7 +6891,7 @@ states.vm_kremlin_coup_sc_prep = {
},
prompt() {
view.prompt = `Kremlin Coup! Conduct a support check in ${country_name(game.vm_active_country)}'s Bureaucratic space.`
- gen_action_space(game.selected_space);
+ gen_action_space(game.selected_space)
},
space(space) {
push_undo()
@@ -6953,7 +6953,7 @@ states.vm_switch_infl = {
} else {
view.prompt = `${clean_name(cards[game.played_card].name)}: ${event_prompt()}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -7144,7 +7144,7 @@ states.vm_nomenklatura_remove = {
view.prompt = 'Nomenklatura: remove all Democratic SPs from Elite spaces.'
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -7168,7 +7168,7 @@ states.vm_nomenklatura_add = {
prompt() {
view.prompt = `Nomenklatura: add 3 SPs to any Elite space(s). ${pluralize(game.vm_available_ops, 'SP')} remaining.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
},
space(space) {
@@ -7373,7 +7373,7 @@ states.vm_systematization = {
prompt() {
view.prompt = 'Systematization: eliminate a space in Romania.'
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
},
space(space) {
@@ -7483,7 +7483,7 @@ states.vm_the_tyrant_is_gone = {
view.prompt = 'The Tyrant is Gone: Select a space in Romania for the Ceausescus to flee to.'
for (let space_id of game.valid_spaces) {
if (!space_id) continue
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
} else {
view.prompt = 'The Tyrant is Gone: done.'
@@ -7582,7 +7582,7 @@ states.vm_warsaw_pact_summit = {
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
if (game.demInfl[i] === 0) {
- game.valid_spaces.push(space.space_id);
+ game.valid_spaces.push(space.space_id)
}
}
game.vm_available_ops = 4
@@ -7614,7 +7614,7 @@ states.vm_we_are_the_people_remove = {
view.prompt = '"We are the People!": remove up to 4 SPs from the Lutherian Church.'
gen_action('done')
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
} else {
view.prompt = '"We are the People!" Remove SPs: done.'
@@ -7645,7 +7645,7 @@ states.vm_we_are_the_people_add = {
prompt() {
view.prompt = `"We are the People!": you must add the ${pluralize(game.vm_available_ops,'SP')} to spaces in Germany.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
},
space(space) {
@@ -7769,7 +7769,7 @@ states.vm_tst_4 = {
view.prompt = `Tiananmen Square Track award: remove ${pluralize(game.vm_available_ops,'SP')}.`
for (let space_id of game.valid_spaces) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
},
space(space) {
@@ -7791,7 +7791,7 @@ states.vm_tst_6 = {
view.prompt = 'Tiananmen Square Track award: you have a free 2 Ops support check.'
for (let space_id of game.valid_spaces) {
if (space_id) {
- gen_action_space(space_id);
+ gen_action_space(space_id)
}
}
},
@@ -7916,7 +7916,7 @@ states.vm_scare_tactics = {
}
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_space(space_id);
+ gen_action_space(space_id)
}
},
space(space) {