summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js24
1 files changed, 9 insertions, 15 deletions
diff --git a/rules.js b/rules.js
index a5802f6..9b8cb6f 100644
--- a/rules.js
+++ b/rules.js
@@ -2447,17 +2447,15 @@ function count_adj(id) {
let adjacent_spaces = get_adjusted_adjacency(space.space_id)
for (let adj_space_id of adjacent_spaces) {
- if (adj_space_id) {
- const adj_piece = spaces.find(piece => piece && piece.space_id === adj_space_id);
- if (adj_piece && adj_piece.space_id !== space.space_id) {
- if (check_dem_control(adj_piece.space_id)) {
- dem_adj++
- }
- if (check_com_control(adj_piece.space_id)) {
- com_adj++
- }
- }
- }
+ const adj_piece = spaces.find(piece => piece.space_id === adj_space_id);
+ if (adj_piece.space_id !== space.space_id) {
+ if (check_dem_control(adj_piece.space_id)) {
+ dem_adj++
+ }
+ if (check_com_control(adj_piece.space_id)) {
+ com_adj++
+ }
+ }
}
return {dem_adj, com_adj}
}
@@ -4775,14 +4773,10 @@ 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;
if (adjacent_spaces.includes(game.systematization)) {
- }
- if (game.systematization !== 0) {
let eliminated_space_id = game.systematization;
-
return adjacent_spaces.map(adj_space_id => {
if (adj_space_id === eliminated_space_id) {
return spaces[eliminated_space_id].adjacent;