From 5be9f1b638ddd61b7bc0e917473ba9bef3708386 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sat, 21 Sep 2024 11:59:55 +0100 Subject: Tidied up debugging --- rules.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/rules.js b/rules.js index 0b08133..7e5339e 100644 --- a/rules.js +++ b/rules.js @@ -1483,7 +1483,6 @@ states.vp_roll = { } }, roll () { - push_undo() let roll = Math.floor(Math.random() * 6) + 1 log(`Rolled a ${roll}`) let rally_win = 0 @@ -2415,11 +2414,11 @@ function valid_spaces_support_falters() { } function valid_spaces_infl() { - if (game.state.startsWith('vm')) { + /*if (game.state.startsWith('vm')) { console.log('valid_spaces_infl called from VM') } else { console.log('valid_spaces_infl called not from VM') - } + }*/ // 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; @@ -2427,34 +2426,34 @@ function valid_spaces_infl() { // Iterate over all spaces to find the ones with the player's influence for (let piece of game.pieces) { if (!piece) continue - console.log('checking piece:', piece) + //console.log('checking piece:', piece) const player_influence = game.active === COM ? piece.comInfl : piece.demInfl; // If the piece has the player's influence, add it and its adjacent spaces to the set if (player_influence > 0) { - console.log(piece, 'added to set') + //console.log(piece, 'added to set') valid_spaces_set.add(piece.space_id); // Check adjacency information for (let adj_space_id of piece.adjacent) { - console.log('adj_space_id', adj_space_id) + //console.log('adj_space_id', adj_space_id) if (adj_space_id) { - console.log('checking adjacent space', spaces[adj_space_id].name_unique) + //console.log('checking adjacent space', spaces[adj_space_id].name_unique) const adj_piece = game.pieces.find(p => p && p.space_id === adj_space_id); - console.log('adjacent piece', adj_piece) + //console.log('adjacent piece', adj_piece) // Check if the adjacent space is controlled by the opponent const opponent_control = game.active === COM ? adj_piece.demCtrl : adj_piece.comCtrl; - console.log('controlled?', opponent_control) - console.log('genscher?', game.persistent_events['genscher']) + //console.log('controlled?', opponent_control) + //console.log('genscher?', game.persistent_events['genscher']) //Check for Genscher. Can always place in East Germany even with 1 op if (game.active === DEM && adj_piece.country === 'East_Germany' && game.persistent_events['genscher']){ - console.log('space added with genscher') + //console.log('space added with genscher') valid_spaces_set.add(adj_piece.space_id) } // Otherwise, only add the adjacent space if the available_ops >= 2 or the space is not controlled by the opponent if (ops >= 2 || !opponent_control) { - console.log('space added normally') + //console.log('space added normally') valid_spaces_set.add(adj_piece.space_id) } } -- cgit v1.2.3