diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -66,6 +66,10 @@ function logp(s) { game.log.push(game.active + " " + s) } +function logi(s) { + game.log.push(">" + s) +} + function log(s) { game.log.push(s) } @@ -89,40 +93,37 @@ function log_move_end() { } function print_turn_log_no_count(text) { - function print_move(last) { - return "\n" + last.join(" \u2192 ") - } + log(text) if (game.turn_log.length > 0) { game.turn_log.sort() for (let entry of game.turn_log) - text += print_move(entry) + logi(entry.join(" \u2192 ")) } else { - text += "\nnothing." + logi("nothing.") } - log(text) delete game.turn_log } function print_turn_log(text) { function print_move(last) { - return "\n" + n + " " + last.join(" \u2192 ") + logi(n + " " + last.join(" \u2192 ")) } game.turn_log.sort() let last = game.turn_log[0] + log(text) let n = 0 for (let entry of game.turn_log) { if (entry.toString() !== last.toString()) { - text += print_move(last) + print_move(last) n = 0 } ++n last = entry } if (n > 0) - text += print_move(last) + print_move(last) else - text += "\nnothing." - log(text) + logi("nothing.") delete game.turn_log } @@ -1310,7 +1311,7 @@ function free_henry_vi() { function start_campaign() { logbr() - log("Start Campaign " + game.campaign + ".") + log(".h1 Campaign " + game.campaign) // TODO: Use board game mulligan rules instead of automatically redealing? do { @@ -1326,7 +1327,7 @@ function start_game_turn() { game.turn = 8 - game.l_hand.length logbr() - log("Start Turn " + game.turn + " of campaign " + game.campaign + ".") + log(".h1 Turn " + game.turn + " of campaign " + game.campaign + ".") // Reset movement and attack tracking state reset_border_limits() @@ -1449,7 +1450,7 @@ function reveal_cards() { function start_player_turn() { logbr() - log("Start " + game.active + " turn.") + log(".h2 " + game.active) reset_border_limits() let lc = CARDS[game.l_card] let yc = CARDS[game.y_card] @@ -1974,7 +1975,7 @@ states.battle_phase = { function start_battle(where) { game.flash = "" logbr() - log("Battle in " + where + ".") + log(".h3 Battle in #" + where) game.where = where game.battle_round = 0 game.defected = [] @@ -2960,7 +2961,7 @@ states.supply_limits_king = { function goto_political_turn() { logbr() - log("Start Political Turn.") + log(".h1 Political Turn") logbr() game.turn_log = [] @@ -3398,7 +3399,7 @@ exports.setup = function (seed, scenario, options) { else throw new Error("Unknown scenario:", scenario) - log("Scenario: " + scenario) + log(".h1 " + scenario) start_campaign() return game } |