summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-11-19 22:39:48 +0000
committeriainp5 <iain.pearce.ip@gmail.com>2024-11-19 22:39:48 +0000
commitbd20b5a15165f5a06cdb829e231c642dbe312b74 (patch)
tree91add4357b24cf5807fa75cad61beae3ac13eac9
parent2d407f9d901104590844038bc1bf2e8f3a31d50f (diff)
download1989-dawn-of-freedom-bd20b5a15165f5a06cdb829e231c642dbe312b74.tar.gz
Logging improvements
-rw-r--r--rules.js39
1 files changed, 25 insertions, 14 deletions
diff --git a/rules.js b/rules.js
index 349e9d7..570a6fb 100644
--- a/rules.js
+++ b/rules.js
@@ -2119,11 +2119,17 @@ function remove_infl(space, ops) {
function do_sc(space) {
clear_undo()
let tear_gas_start = game.persistent_events.includes(C_TEAR_GAS)
+ let the_wall_start = game.persistent_events.includes(C_THE_WALL)
log_gap(`Support check: %${space}`)
- // Continue with Support Check Logic
-
let roll = roll_d6()
- log(`Roll: D${roll}`)
+
+ // Check for The Wall
+ if (game.active === COM && game.persistent_events.includes(C_THE_WALL) && spaces[space].country === 'East_Germany') {
+ logi(`No adjacency for Democrats due to C${C_THE_WALL}`)
+ log_gap(`Roll: D${roll}`)
+ }
+ // Continue with Support Check Logic
+ else { log(`Roll: D${roll}`) }
// Check for the Crowd Turns Against Ceausescu
@@ -2184,8 +2190,6 @@ function do_sc(space) {
const adj = count_adj(space)
if (game.active === COM && game.persistent_events.includes(C_THE_WALL) && spaces[space].country === 'East_Germany') {
- logi(`No adjacency for Democrats due to C${C_THE_WALL}`)
- logi(`C${C_THE_WALL} no longer in effect`)
roll += adj.com_adj
if (adj.com_adj > 0) {
logi(`+${adj.com_adj} adjacency`)
@@ -2262,11 +2266,16 @@ function do_sc(space) {
game.vp++
}
- //Check if Tear Gas used
+ //Check if Tear Gas or The Wall used
let tear_gas_end = game.persistent_events.includes(C_TEAR_GAS)
+ let the_wall_end = game.persistent_events.includes(C_THE_WALL)
if (tear_gas_start && !tear_gas_end) {
log(`C${C_TEAR_GAS} no longer in effect`)
}
+ if (the_wall_start && !the_wall_end) {
+ log(`C${C_THE_WALL} no longer in effect`)
+ }
+
// If Austria-Hungary Border Reopened used, all future support checks must be in East Germany
if (game.persistent_events.includes(C_AUSTRIA_HUNGARY_BORDER_REOPENED)){
@@ -2440,7 +2449,7 @@ function count_adj(space_id) {
let com_adj = 0
let adjacent_spaces = get_adjusted_adjacency(space_id)
-
+ console.log('adjacent spaces', adjacent_spaces)
for (let adj_space_id of adjacent_spaces) {
if (check_dem_control(adj_space_id)) {
dem_adj++
@@ -4795,13 +4804,14 @@ function get_adjusted_adjacency(space_id) {
let adjacent_spaces = spaces[space_id].adjacent;
if (adjacent_spaces.includes(game.systematization)) {
let eliminated_space_id = game.systematization;
- return adjacent_spaces.map(adj_space_id => {
+ adjacent_spaces = adjacent_spaces.map(adj_space_id => {
if (adj_space_id === eliminated_space_id) {
return spaces[eliminated_space_id].adjacent;
}
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;
}
@@ -5988,12 +5998,12 @@ states.vm_adamec = {
log(`Roll: D${roll}`)
let worker_spaces = spaces.filter(space => space && space.country === 'Czechoslovakia' && space.socio === 4 && check_dem_control(space.space_id)).length
if (worker_spaces > 0) {
- log(`-${worker_spaces} from Democrat controlled worker spaces`)
+ logi(`-${worker_spaces} from Democrat controlled worker spaces`)
roll -= worker_spaces
}
log(`Modified roll: ${roll}`)
if (roll > 2) {
- log('Adamec succeeds')
+ log_msg_gap('Adamec succeeds')
vm_next()
return
}
@@ -6029,6 +6039,7 @@ states.vm_brought_in_for_questioning = {
if (!is_auto_resolve(game.vm_event) && !switch_events.includes(game.vm_event)) {
next_player()
}
+ log(`C${game.vm_event}:`)
goto_vm(game.vm_event)
} else {
logi('Event does not occur')
@@ -7196,7 +7207,7 @@ states.vm_shock_therapy = {
}
}
log(`Roll: D${roll}`)
- log(`-${worker_farmer} from Communist controlled Worker and Farmer spaces`)
+ logi(`-${worker_farmer} from Communist controlled Worker and Farmer spaces`)
log(`Modified roll: ${roll - worker_farmer}`)
if ((roll - worker_farmer) > 2) {
log('C93 is successful. +3 VP')
@@ -7428,7 +7439,7 @@ states.vm_the_wall_must_go = {
if (game.active === DEM) {
let controlled_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_dem_control(space.space_id)).length
if (controlled_spaces > 0) {
- log(`+${controlled_spaces} from controlled spaces in East Germany`)
+ logi(`+${controlled_spaces} from controlled spaces in East Germany`)
log(`Modified roll: ${roll + controlled_spaces}`)
roll += controlled_spaces
}
@@ -7436,7 +7447,7 @@ states.vm_the_wall_must_go = {
} else {
let controlled_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_com_control(space.space_id)).length
if (controlled_spaces > 0) {
- log(`+${controlled_spaces} from controlled spaces in East Germany`)
+ logi(`+${controlled_spaces} from controlled spaces in East Germany`)
log(`Modified roll: ${roll + controlled_spaces}`)
roll += controlled_spaces
}
@@ -8386,7 +8397,7 @@ CODE[58] = [ // Austria-Hungary Border Reopened*
[ vm_return ],
]
-CODE[59] = [ // GrenzTruppen*
+CODE[59] = [ // Grenztruppen*
[ vm_grenztruppen ],
[ vm_return ],
]