diff options
-rw-r--r-- | create.html | 28 | ||||
-rw-r--r-- | rules.js | 50 |
2 files changed, 66 insertions, 12 deletions
diff --git a/create.html b/create.html index 80f55a0..8e141c5 100644 --- a/create.html +++ b/create.html @@ -33,6 +33,33 @@ For balance this scenario has been modified to start VP at French 2. </div> +<div class="scenario_info show" id="Annus Mirabilis (WBC)"> +<p> +This variant of the Annus Mirabilis scenario uses the WBC tournament rules: + +<p> +1) Starting with the Late Season 1757, immediately after dealing and examining +cards, the British player may randomly discard a card to add any one British +Regulars or Highlanders card in the discard pile to his hand. + +<p> +2) The French Marine Detachment (1-4) units only have one step. + +Whenever one of these units takes a step loss it is permanently removed from +play instead of being flipped to its 0-4 side. + +When taking losses as a result of battle, assault, attrition or events, +whenever a French stack includes both 3-4 Regulars and 1-4 Marine Detachments, +all 3-4 units in the stack must be reduced before any MD units are eliminated. + +When taking losses for winter attrition, the Marine Detachments are considered +to be reduced units. + +<p> +3) French start at 3 VP. + +</div> + <div class="scenario_info" id="Early War Campaign"> <p>Intermediate Scenario One (1755-59) <p> @@ -128,6 +155,7 @@ scenario.onchange = function (evt) { document.getElementById(scenario.value).classList.add("show"); switch (scenario.value) { case "Annus Mirabilis": + case "Annus Mirabilis (WBC)": document.querySelector(".not_am").classList.add("hide"); document.querySelector(".not_am").querySelectorAll("input").forEach(input => input.checked = false); break; @@ -4,6 +4,8 @@ // TODO: select leader for defense instead of automatically picking the best // TODO: remove old 7 command leader(s) immediately as they're drawn, before placing reinforcements +// TODO: use set functions from rommel instead of array.includes array.push + const { spaces, pieces, cards } = require("./data") const BRITAIN = 'Britain' @@ -80,6 +82,7 @@ function is_light_infantry(p) { return (p >= 26 && p <= 31) } function is_provincial(p) { return (p >= 32 && p <= 55) } function is_southern_provincial(p) { return (p >= 50 && p <= 55) } function is_northern_provincial(p) { return (p >= 32 && p <= 49) } +function is_marine_detachment(p) { return (p >= 127 && p <= 133) } function is_coureurs(p) { return (p >= 119 && p <= 126) } function is_ranger(p) { return (p >= 23 && p <= 25) } function is_indian(p) { return (p >= 14 && p <= 22) || (p >= 97 && p <= 118) } @@ -1071,6 +1074,16 @@ function set_unit_reduced(p, v) { } } +function is_one_step_marine_detachment(p) { + return is_marine_detachment(p) && game.options.one_step_md +} + +function can_reduce_unit(p) { + if (is_one_step_marine_detachment(p)) + return false + return !is_unit_reduced(p) +} + function is_piece_inside(p) { return game.location[p] < 0 } @@ -1757,7 +1770,7 @@ function restore_unit(p) { } function reduce_unit(p, verbose=true) { - if (is_unit_reduced(p)) { + if (is_unit_reduced(p) || is_one_step_marine_detachment(p)) { eliminate_piece(p, verbose) return true } @@ -4933,7 +4946,7 @@ states.step_losses = { if (game.battle.dt_loss > 0) { for (let i = 0; i < game.battle.units.length; ++i) { let p = game.battle.units[i] - if (is_drilled_troops(p) && !is_unit_reduced(p)) { + if (is_drilled_troops(p) && can_reduce_unit(p)) { done = false gen_action_piece(p) } @@ -4951,7 +4964,7 @@ states.step_losses = { if (done) { for (let i = 0; i < game.battle.units.length; ++i) { let p = game.battle.units[i] - if (!is_unit_reduced(p)) { + if (can_reduce_unit(p)) { done = false gen_action_piece(p) } @@ -5016,7 +5029,7 @@ states.raid_step_losses = { if (game.raid.step_loss > 0) { for (let i = 0; i < game.raid.units.length; ++i) { let p = game.raid.units[i] - if (!is_unit_reduced(p)) { + if (can_reduce_unit(p)) { can_reduce = true gen_action_piece(p) } @@ -6503,6 +6516,11 @@ function goto_remove_raided_markers() { // LATE SEASON - WINTER ATTRITION +function is_unit_reduced_for_winter(p) { + // WBC rules: one-step MD are considered reduced for winter attrition + return is_unit_reduced(p) || is_one_step_marine_detachment(p) +} + function goto_winter_attrition() { set_active(FRANCE) game.state = 'winter_attrition' @@ -6530,7 +6548,7 @@ function resume_winter_attrition() { if (is_drilled_troops(p)) { if (is_piece_inside(p) || !safe) { stack.dt.push(p) - if (is_unit_reduced(p)) + if (is_unit_reduced_for_winter(p)) stack.n++ } } @@ -6569,7 +6587,7 @@ states.winter_attrition = { for (let s in game.winter_attrition) { let stack = game.winter_attrition[s] for (let p of stack.dt) { - if (is_unit_reduced(p)) { + if (is_unit_reduced_for_winter(p)) { if (stack.n > 0) { done = false gen_action_piece(p) @@ -6592,7 +6610,7 @@ states.winter_attrition = { piece(p) { let stack = game.winter_attrition[piece_space(p)] push_undo() - if (is_unit_reduced(p)) + if (is_unit_reduced_for_winter(p)) stack.n-- reduce_unit(p, true) remove_from_array(stack.dt, p) @@ -7670,17 +7688,15 @@ states.small_pox_eliminate_steps = { let done = true if (game.count > 0) { for_each_friendly_unit_in_space(game.small_pox, p => { - if (!is_unit_reduced(p)) { + if (can_reduce_unit(p)) { done = false gen_action_piece(p) } }) if (done) { for_each_friendly_unit_in_space(game.small_pox, p => { - if (is_unit_reduced(p)) { - done = false - gen_action_piece(p) - } + done = false + gen_action_piece(p) }) } } @@ -9008,6 +9024,7 @@ states.intrigues_against_shirley = { exports.scenarios = [ "Annus Mirabilis", + "Annus Mirabilis (WBC)", "Early War Campaign", "Late War Campaign", "The Full Campaign", @@ -9414,6 +9431,11 @@ exports.setup = function (seed, scenario, options) { // See https://boardgamegeek.com/thread/1366550/article/19163465#19163465 setup_1757(1759, 2) break + case "Annus Mirabilis (WBC)": + setup_1757(1759, 3) + game.options.one_step_md = 1 + game.options.regulars_from_discard = 1 + break case "Early War Campaign": setup_1755(1759) break @@ -9466,6 +9488,10 @@ exports.setup = function (seed, scenario, options) { log(`After 1756 Britain may exchange a random card for a discarded Regulars or Highlanders.`) } + if (game.options.one_step_md) { + log(`Marine Detachments only have one step.`) + } + start_year() return game |