diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 50 |
1 files changed, 30 insertions, 20 deletions
@@ -1,6 +1,6 @@ "use strict" -const DEBUG = 0 +const DEBUG = 1 const R_LOUIS_XV = "Louis XV" const R_FREDERICK = "Frederick" @@ -1754,7 +1754,6 @@ function draw_tc(draw, n, pow) { let k = 0 while (n > 0) { if (game.deck.length === 0) { - log_draw_tc(k, pow) k = 0 next_tactics_deck() if (game.deck.length === 0) { @@ -1766,20 +1765,19 @@ function draw_tc(draw, n, pow) { ++k --n } - - log_draw_tc(k, pow) } function give_subsidy(other) { if (other === P_BAVARIA && is_enemy_controlled_fortress(MUNCHEN)) { - log("Bavaria TC subsidy lost\nS" + MUNCHEN + " is enemy controlled") + log(">1 Bavaria subsidy lost\nS" + MUNCHEN + " is enemy controlled") return } if (other === P_SAXONY && is_enemy_controlled_fortress(DRESDEN)) { - log("Saxony TC subsidy lost\nS" + DRESDEN + " is enemy controlled") + log(">1 Saxony subsidy lost\nS" + DRESDEN + " is enemy controlled") return } draw_tc(game.hand2[other], 1, other) + log(">1 " + power_name[other] + " subsidy") } function goto_tactical_cards() { @@ -1805,24 +1803,19 @@ function draw_tactical_cards() { } else if (game.power === P_SAXONY && is_enemy_controlled_fortress(DRESDEN)) { log("Saxony TC draw lost\nS" + DRESDEN + " is enemy controlled.") } else { - let n_cards = tc_per_turn() - - // count active subsidies - if (game.contracts[game.power]) - for (let other of all_powers) - if (map_get(game.contracts[game.power], other, 0) > 0) - --n_cards + let base = tc_per_turn_base() + let mod = tc_per_turn_modifier() + let sub = count_subsidies(game.power) // Too many subsidies to hand out! // NOTE: This can only happen with Prussia. // If giving subsidies to Saxony, Bavaria, and/or France // while at the -1 or -2 TC on the Russia track. - while (n_cards < 0) { + while (base + mod - sub < 0) { // Cancel cooperative subsidy first. if (map_get(game.contracts[P_PRUSSIA], P_SAXONY, 0) > 0) { log("Canceled subsidy to Saxony (forced).") map_delete(game.contracts[P_PRUSSIA], P_SAXONY) - n_cards++ continue } @@ -1840,22 +1833,39 @@ function draw_tactical_cards() { if (n_france > 0) { log("Canceled subsidy to France (forced).") map_delete(game.contracts[P_PRUSSIA], P_FRANCE) - n_cards++ continue } if (n_bavaria > 0) { log("Canceled subsidy to Bavaria (forced).") map_delete(game.contracts[P_PRUSSIA], P_BAVARIA) - n_cards++ continue } - // Should never happen! - n_cards = 0 + break // impossible } - draw_tc(game.draw, n_cards, game.power) + /* + let str = power_name[game.power] + " " + base + if (mod < 0) + str += " \u2212 " + (-mod) + 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)`) + else + log(`>${n} ${power_name[game.power]}`) + + draw_tc(game.draw, base + mod - sub, game.power) if (game.contracts[game.power]) { for (let other of all_powers) { |