From 2d091994e2e47ef540d464719caef557895d0952 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 11 Nov 2024 00:01:00 +0100 Subject: draw card logging --- rules.js | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index aeceb81..7ba0ed9 100644 --- a/rules.js +++ b/rules.js @@ -1757,14 +1757,14 @@ function draw_tc(draw, n) { function give_subsidy(other) { if (other === P_BAVARIA && is_enemy_controlled_fortress(MUNCHEN)) { - log(">1 Bavaria subsidy lost\nS" + MUNCHEN + " is enemy controlled") + log(">1 to Bavaria lost\nS" + MUNCHEN + " is enemy controlled") return } if (other === P_SAXONY && is_enemy_controlled_fortress(DRESDEN)) { - log(">1 Saxony subsidy lost\nS" + DRESDEN + " is enemy controlled") + log(">1 to Saxony lost\nS" + DRESDEN + " is enemy controlled") return } - log(">1 " + power_name[other] + " subsidy") + log(">1 to " + power_name[other]) draw_tc(game.hand2[other], 1) } @@ -1833,29 +1833,16 @@ function draw_tactical_cards() { break // impossible } - /* - let str = power_name[game.power] + " " + base if (mod < 0) - str += " \u2212 " + (-mod) + log(`${power_name[game.power]} ${base} TC (\u2212${-mod} political).`) else if (mod > 0) - str += " + " + (mod) - if (sub > 0) - str += " \u2212 " + (sub) - str += " TC." - log(str) - */ - log("Draw TC") - let n = base + mod - sub - if (mod < 0) - log(`>${n} ${power_name[game.power]} (\u2212${-mod} politics)`) - else if (mod > 0) - log(`>${n} ${power_name[game.power]} (+${mod} politics)`) + log(`${power_name[game.power]} ${base} TC (+${mod} political).`) else - log(`>${n} ${power_name[game.power]}`) - - draw_tc(game.draw, base + mod - sub) + log(`${power_name[game.power]} ${base} TC.`) - if (game.contracts[game.power]) { + if (sub > 0) { + log(">" + (base - mod - sub) + " to " + power_name[game.power]) + draw_tc(game.draw, base + mod - sub) for (let other of all_powers) { let contract = map_get(game.contracts[game.power], other, 0) if (contract > 0) { @@ -1866,6 +1853,8 @@ function draw_tactical_cards() { map_delete(game.contracts[game.power], other) } } + } else { + draw_tc(game.draw, base + mod) } } @@ -1899,7 +1888,7 @@ states.tactical_cards_draw = { str += "TC." if (sub > 0) - str += " Give " + sub + " TC to " + list_subsidies().join(" and ") + "." + str += " Give " + sub + " TC to " + list_subsidies(game.power).join(" and ") + "." prompt(str) if (base + mod - sub >= 0) @@ -2506,8 +2495,9 @@ states.movement = { } } - // if (has_unmoved_piece_on_flanders_map(game.power)) prompt("Move your pieces on the Flanders map.") else - if (done_trains && done_generals) + if (game.power === P_AUSTRIA && has_unmoved_piece_on_flanders_map(game.power)) + prompt("Move your pieces on the Flanders map.") + else if (done_trains && done_generals) prompt("Movement done.") else if (done_generals && !done_trains) prompt("Move your supply trains.") -- cgit v1.2.3