diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-14 16:00:33 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 9a30ef0fc5a5a6fb45e1dc9d72cfa762fe8285b5 (patch) | |
tree | 07824ecd26d75bea7262b763971932919f44e51b /rules.js | |
parent | 0b0448e15af131ef263d2f9ee903e5e48fa41c89 (diff) | |
download | table-battles-9a30ef0fc5a5a6fb45e1dc9d72cfa762fe8285b5.tar.gz |
WIP Hothenfriedberg
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 60 |
1 files changed, 60 insertions, 0 deletions
@@ -316,6 +316,14 @@ const S43_VILLARS_LEFT = find_card(43, "Villars's Left") const S43_BROGLIE = find_card(43, "Broglie") const S43_PRINCE_DE_TINGRY = find_card(43, "Prince de Tingry") +const S44_HOTHENFRIEDBERG = find_scenario(44) +const S44_CHARLES = find_card(44, "Charles") +const S44_FREDERICK_II = find_card(44, "Frederick II") +const S44_BAYREUTH_DRAGOONS = find_card(44, "Bayreuth Dragoons") +const S44_LEOPOLDS_L = find_card(44, "Leopold's Left") +const S44_LEOPOLDS_C = find_card(44, "Leopold's Center") +const S44_LEOPOLDS_R = find_card(44, "Leopold's Right") + // === SETUP === exports.setup = function (seed, scenario, options) { @@ -1774,6 +1782,17 @@ function goto_start_turn() { } } + if (game.scenario === S44_HOTHENFRIEDBERG) { + if (player_index() === 1) { + let have_inf_or_cav = false + for (let c of game.front[1]) + if (is_infantry(c) || is_cavalry(c)) + have_inf_or_cav = true + if (!have_inf_or_cav) + return goto_game_over(P1, "Frederick has no Infantry or Cavalry in play!") + } + } + goto_action_phase() } @@ -2047,6 +2066,19 @@ function find_first_target_of_command(c, a) { return S37_THE_FOG } + if (game.scenario === S44_HOTHENFRIEDBERG) { + if (c === S44_CHARLES) { + if (game.reserve[1].length > 0) + return game.reserve[1] + return -1 + } + if (c === S44_FREDERICK_II) { + for (let t of card_has_rule(c, "command_sequence")) + if (is_card_in_reserve(t)) + return t + } + } + if (!a.target_list) throw new Error("no rule for Command target: " + a.target) @@ -2059,6 +2091,18 @@ function find_first_target_of_command(c, a) { } function find_all_targets_of_command(c, a) { + + if (game.scenario === S44_HOTHENFRIEDBERG) { + if (c === S44_CHARLES) { + return game.reserve[1].slice() + } + if (c === S44_FREDERICK_II) { + for (let t of card_has_rule(S44_FREDERICK_II, "command_sequence")) + if (is_card_in_reserve(t)) + return [ t ] + } + } + let list = [] for (let t of a.target_list) { if (is_card_in_reserve(t)) @@ -2223,6 +2267,13 @@ function update_attack1() { game.hits *= 2 } + if (game.scenario === S44_HOTHENFRIEDBERG) { + if (game.target === S44_CHARLES) { + if (game.selected === S44_LEOPOLDS_L || game.selected === S44_LEOPOLDS_C || game.selected === S44_LEOPOLDS_R) + game.self = 0 + } + } + // Oblique Attack (CAL expansion rule) if (is_infantry(game.selected)) { if (get_sticks(game.selected) >= get_sticks(game.target) + 3) @@ -2413,6 +2464,15 @@ states.command = { } } + if (game.scenario === S44_HOTHENFRIEDBERG) { + // one at a time + if (game.selected === S44_CHARLES || game.selected === S44_FREDERICK_II) { + pay_for_action(game.selected) + end_action_phase() + return + } + } + if (find_first_target_of_command(game.selected, current_action()) < 0) { pay_for_action(game.selected) end_action_phase() |