diff options
-rw-r--r-- | rules.js | 79 |
1 files changed, 51 insertions, 28 deletions
@@ -1125,18 +1125,22 @@ function deal_axis_supply_cards(n) { let cur = game.axis_hand[REAL] + game.axis_hand[DUMMY] if (cur + n > 16) n = 16 - cur - log(`Axis drew ${n} cards.`) - for (let i = 0; i < n; ++i) - game.axis_hand[draw_supply_card(game.draw_pile)]++ + if (n > 0) { + log(`Axis drew ${n} cards.`) + for (let i = 0; i < n; ++i) + game.axis_hand[draw_supply_card(game.draw_pile)]++ + } } function deal_allied_supply_cards(n) { let cur = game.allied_hand[REAL] + game.allied_hand[DUMMY] if (cur + n > 16) n = 16 - cur - log(`Allied drew ${n} cards.`) - for (let i = 0; i < n; ++i) - game.allied_hand[draw_supply_card(game.draw_pile)]++ + if (n > 0) { + log(`Allied drew ${n} cards.`) + for (let i = 0; i < n; ++i) + game.allied_hand[draw_supply_card(game.draw_pile)]++ + } } function shuffle_cards() { @@ -5486,6 +5490,19 @@ states.buildup_eliminate_unsupplied = { // === BUILDUP - POINT DETERMINATION === +function is_pregame_buildup() { + return game.scenario === "Gazala" && game.month === 14 +} + +function goto_pregame_buildup() { + game.phasing = ALLIED + init_buildup() + game.axis_bps = 30 + game.allied_bps = 30 + set_active_player() + goto_buildup_discard() +} + function init_buildup() { game.buildup = { // redeployment network @@ -5982,7 +5999,10 @@ function end_buildup_spending() { set_enemy_player() goto_buildup_discard() } else { - goto_buildup_resupply() + if (is_pregame_buildup()) + end_pregame_buildup() + else + goto_buildup_resupply() } } @@ -6072,16 +6092,25 @@ states.dismantle3 = { }, } -function goto_buildup_resupply() { - log_h2("Resupply") - log(`Shuffled supply cards.`) - - shuffle_cards() +function end_pregame_buildup() { + if (game.buildup.axis_cards > 0 || game.buildup.allied_cards > 0) { + log_h2("Resupply") + deal_axis_supply_cards(game.buildup.axis_cards) + deal_allied_supply_cards(game.buildup.allied_cards) + } + game.buildup = null + goto_initial_supply_cards() +} +function goto_buildup_resupply() { // Per-scenario allotment let axis_resupply = (game.month <= 10 || game.malta) ? 2 : 3 let allied_resupply = 3 + log_h2("Resupply") + log(`Shuffled supply cards.`) + shuffle_cards() + // Extra cards purchased during buildup axis_resupply += game.buildup.axis_cards allied_resupply += game.buildup.allied_cards @@ -6104,6 +6133,7 @@ function goto_buildup_resupply() { // === INITIATIVE === function goto_player_initiative() { + log_h2("Initiative") game.phasing = AXIS set_passive_player() game.state = 'allied_player_initiative' @@ -6121,7 +6151,7 @@ states.allied_player_initiative = { gen_action('pass') }, real_card() { - log(`Allied challenged for the initiative.`) + log(`Allied player challenged for the initiative.`) player_hand()[0]-- game.phasing = ALLIED set_passive_player() @@ -6129,11 +6159,12 @@ states.allied_player_initiative = { }, dummy_card() { player_hand()[1]-- - log(`Allied challenged for the initiative.`) + log(`Allied player challenged for the initiative.`) set_active_player() game.state = 'axis_player_initiative' }, pass() { + log(`Allied player did not challenge for the initiative.`) goto_player_turn() } } @@ -6329,7 +6360,10 @@ function end_free_deployment() { } else { game.selected = -1 game.summary = null - goto_initial_supply_cards() + if (is_pregame_buildup()) + goto_pregame_buildup() + else + goto_initial_supply_cards() } } @@ -6357,14 +6391,14 @@ states.initial_supply_cards = { }, discard() { if (is_axis_player()) { - let n = current_scenario().axis_initial_supply + let n = game.axis_hand[REAL] + game.axis_hand[DUMMY] log(`Axis discarded ${n} cards.`) game.axis_hand[REAL] = 0 game.axis_hand[DUMMY] = 0 deal_axis_supply_cards(n) set_enemy_player() } else { - let n = current_scenario().allied_initial_supply + let n = game.allied_hand[REAL] + game.allied_hand[DUMMY] log(`Allied discarded ${n} cards.`) game.allied_hand[REAL] = 0 game.allied_hand[DUMMY] = 0 @@ -6388,17 +6422,6 @@ function begin_game() { set_add(game.minefields[MF_VISIBLE], TOBRUK) } - if (game.scenario === "Gazala") { - // PreGame Buildup - game.phasing = ALLIED - init_buildup() - game.axis_bps = 30 - game.allied_bps = 30 - set_active_player() - goto_buildup_discard() - return - } - // No buildup first month // No initiative first month |