From fc5a07b315414f1c34e702841a70e4621b51fe0a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 2 Jul 2021 13:55:02 +0200 Subject: Improve logging of block retreats. Print which block retreats during the round. Print summary of retreat destinations at the end of the round. --- rules.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index dd5992f..8d1bb82 100644 --- a/rules.js +++ b/rules.js @@ -6,8 +6,6 @@ exports.scenarios = [ "Campaign", ]; -// TODO: delay retreats to end of battle initiative step so they are hidden - const { CARDS, BLOCKS, AREAS, BORDERS } = require('./data'); const ENEMY = { Scotland: "England", England: "Scotland" } @@ -64,11 +62,11 @@ function print_turn_log_no_count(text) { delete game.turn_log; } -function print_turn_log(verb) { + +function print_turn_log_no_active(text) { function print_move(last) { return "\n" + n + " " + last.join(" \u2192 "); } - let text = game.active + " " + verb + ":"; game.turn_log.sort(); let last = game.turn_log[0]; let n = 0; @@ -88,6 +86,10 @@ function print_turn_log(verb) { delete game.turn_log; } +function print_turn_log(verb) { + print_turn_log_no_active(game.active + " " + verb + ":"); +} + function is_active_player(current) { return (current == game.active) || (game.active == BOTH && current != OBSERVER); } @@ -1536,6 +1538,9 @@ function resume_battle() { } function end_battle() { + if (game.turn_log && game.turn_log.length > 0) + print_turn_log_no_active("Retreats from " + game.where + ":"); + game.flash = ""; game.battle_round = 0; reset_border_limits(); @@ -1560,6 +1565,10 @@ function bring_on_reserves() { function start_battle_round() { if (++game.battle_round <= 3) { + if (game.turn_log && game.turn_log.length > 0) + print_turn_log_no_active("Retreats from " + game.where + ":"); + game.turn_log = []; + log("~ Battle Round " + game.battle_round + " ~"); reset_border_limits(); @@ -1882,13 +1891,14 @@ states.retreat_in_battle = { } }, area: function (to) { + game.turn_log.push([game.active, to]); if (game.who == NORSE) { game.flash = "Norse retreat to " + to + "."; - log("The Norse retreat to " + to + "."); + log_battle(game.flash); game.location[game.who] = to; } else { game.flash = block_name(game.who) + " retreats."; - log(game.active + " retreats to " + to + "."); + log_battle(game.flash); move_block(game.who, game.where, to); } game.who = null; -- cgit v1.2.3