diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-11 17:49:19 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-11 17:49:19 +0000 |
commit | 7d4f6e7a27d32f487b850b8b85a7e2753c1471ac (patch) | |
tree | 3ada9aeabdc016d97c31e6bae752af15c38e9622 /rules.js | |
parent | 3b2ab45561186d66ad9c1161c6947a0f76d75e47 (diff) | |
download | 1989-dawn-of-freedom-7d4f6e7a27d32f487b850b8b85a7e2753c1471ac.tar.gz |
Fixing adjacency not counting space 0
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -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; |