diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-07-01 16:28:00 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-07 19:05:52 +0200 |
commit | 0dc3440161c7062ae09a93f001d5dd1629b35942 (patch) | |
tree | 4c8a4e41ea80df7ba495d2dde058d86dd50c949c /rules.js | |
parent | 52c4d3435cb5b7f1378b849375f8dbe6834fb1ba (diff) | |
download | time-of-crisis-0dc3440161c7062ae09a93f001d5dd1629b35942.tar.gz |
Double bump support if killed both Ardashir and Shapur in same battle.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 52 |
1 files changed, 36 insertions, 16 deletions
@@ -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() }, } |