From 0dc3440161c7062ae09a93f001d5dd1629b35942 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 1 Jul 2023 16:28:00 +0200 Subject: Double bump support if killed both Ardashir and Shapur in same battle. --- rules.js | 52 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index e1aba4d..880dff1 100644 --- a/rules.js +++ b/rules.js @@ -4,9 +4,12 @@ TODO [ ] killed leader stash for buy/trash phase +[ ] killed ardashur+shapur: two support bumps +[ ] killed gives credits for military + senate +[ ] display of general+castra stacked with militia+castra -[ ] emperor variant (and tokens) -[ ] expansion cards (and images) +[ ] emperor +[ ] expansion cards */ @@ -19,7 +22,7 @@ const P2 = "Blue" const P3 = "Yellow" const P4 = "Green" -exports.scenarios = [ "Standard" ] +exports.scenarios = [ "Standard", "Expansion", "Random" ] exports.roles = function (scenario, options) { if (options.players == 2) @@ -2941,7 +2944,7 @@ function goto_battle(type, where, attacker, target) { log_h2("Battle in %" + where) spend_military(1) game.where = where - game.combat = { type, attacker, target, flanking: 0, killed: 0 } + game.combat = { type, attacker, target, killed: 0 } game.state = "initiate_battle" if (attacker >= 0) { if (is_general_inside_capital(attacker)) @@ -2995,10 +2998,12 @@ states.initiate_battle = { inactive: "Combat", prompt() { prompt("Initiate Battle against " + format_battle_target() + " in " + REGION_NAME[game.where] + ".") + if (!game.combat.flanking && has_card_event(CARD_M3)) { - view.prompt += " You may play Flanking Maneuver." + view.prompt += " Flanking Maneuver?" gen_card_event(CARD_M3) } + view.actions.roll = 1 }, card(c) { @@ -3520,13 +3525,30 @@ function end_battle() { if (game.selected_general >= 0 && get_general_location(game.selected_general) === AVAILABLE) game.selected_general = -1 - if (game.combat.killed) { + goto_free_increase_support_level() +} + +function can_free_increase_support_level(where) { + return where !== ITALIA && get_support(where) < 4 && is_own_province(where) +} + +function find_next_killed_in_combat() { + for (let i = 0; i < 6; ++i) + if (game.combat.killed & (1 << i)) + return (1 << i) + return 0 +} + +function goto_free_increase_support_level() { + let bit = find_next_killed_in_combat() + if (bit) { if (can_free_increase_support_level(game.where)) { game.state = "free_increase_support_level" return } else { log("Kept for cost reduction.") - game.killed |= game.combat.killed + game.killed |= bit + game.combat.killed &= ~bit } } @@ -3534,10 +3556,6 @@ function end_battle() { game.state = "take_actions" } -function can_free_increase_support_level(where) { - return where !== ITALIA && get_support(where) < 4 && is_own_province(where) -} - states.free_increase_support_level = { inactive: "Combat", prompt() { @@ -3549,15 +3567,17 @@ states.free_increase_support_level = { region(where) { push_undo() increase_support(where) - game.combat = null - game.state = "take_actions" + let bit = find_next_killed_in_combat() + game.combat.killed &= ~bit + goto_free_increase_support_level() }, keep() { push_undo() log("Kept for cost reduction.") - game.killed |= game.combat.killed - game.combat = null - game.state = "take_actions" + let bit = find_next_killed_in_combat() + game.killed |= bit + game.combat.killed &= ~bit + goto_free_increase_support_level() }, } -- cgit v1.2.3