summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js40
1 files changed, 21 insertions, 19 deletions
diff --git a/rules.js b/rules.js
index c5dc215..d12eae2 100644
--- a/rules.js
+++ b/rules.js
@@ -2539,6 +2539,13 @@ function all_friendly_unsupplied_units() {
return result
}
+function goto_fortress_supply(state) {
+ game.state = state
+ game.assign = 0
+ game.summary = [ 0, 0, 0 ]
+ resume_fortress_supply()
+}
+
function resume_fortress_supply() {
while (game.assign < 3) {
if (assign_fortress_supply())
@@ -2549,6 +2556,11 @@ function resume_fortress_supply() {
}
function end_fortress_supply() {
+ for (let ix = 0; ix < 3; ++ix)
+ if (game.summary[ix] > 0)
+ log(`Assigned ${game.summary[ix]} #${FORTRESS_HEX_LIST[ix]} supply.`)
+ game.summary = null
+
game.assign = 0
if (game.state === 'initial_fortress_supply')
game.state = 'initial_oasis_supply'
@@ -2582,12 +2594,10 @@ function auto_assign_fortress_supply(list, fortress, ss, ix) {
if (dist[unit_hex(u)] === d0)
++n
if (n <= game.capacity[ix]) {
- for (let u of list) {
- if (dist[unit_hex(u)] === d0) {
- log(`Assigned #${fortress} supply.`)
+ game.summary[ix] += n
+ for (let u of list)
+ if (dist[unit_hex(u)] === d0)
set_unit_supply(u, ss)
- }
- }
game.capacity[ix] -= n
total += n
list = list.slice(n)
@@ -2641,7 +2651,7 @@ const xxx_fortress_supply = {
let fortress = FORTRESS_HEX_LIST[ix]
push_undo()
game.capacity[ix]--
- log(`Assigned #${fortress} supply.`)
+ game.summary[ix] ++
set_unit_supply(who, ss)
},
next() {
@@ -2743,9 +2753,7 @@ function goto_initial_supply_check() {
game.capacity = [ 2, 2, 5 ]
game.oasis = [ 1, 1, 1 ]
- game.state = 'initial_fortress_supply'
- game.assign = 0
- resume_fortress_supply()
+ goto_fortress_supply('initial_fortress_supply')
}
function goto_initial_supply_check_recover() {
@@ -2837,9 +2845,7 @@ function goto_final_supply_check() {
log(`Restored supply at #${x}.`)
// Assign leftover fortress and oasis supply
- game.state = 'final_fortress_supply'
- game.assign = 0
- resume_fortress_supply()
+ goto_fortress_supply('final_fortress_supply')
}
function goto_final_supply_check_disrupt() {
@@ -5443,9 +5449,7 @@ function goto_buildup_supply_check() {
game.capacity = [ 2, 2, 5 ]
game.oasis = [ 1, 1, 1 ]
- game.state = 'buildup_fortress_supply'
- game.assign = 0
- resume_fortress_supply()
+ goto_fortress_supply('buildup_fortress_supply')
}
function goto_buildup_supply_check_recover() {
@@ -6405,7 +6409,6 @@ function begin_game() {
if (game.scenario === "Crusader") {
game.phasing = ALLIED
- set_add(game.minefields[MF_VISIBLE], TOBRUK)
}
// No buildup first month
@@ -6543,9 +6546,6 @@ const SCENARIOS = {
allied_deployment: sort_deployment_for_allied(regions["East Line"]),
axis_initial_supply: 10,
allied_initial_supply: 12,
- special: {
- gazala_pre_build: true,
- }
},
"Pursuit to Alamein": {
start: 15,
@@ -6605,6 +6605,8 @@ const SETUP = {
setup_units(DEPLOY, 0, find_allied_units(8))
setup_units(0, 0, [ "2/3", "2/SG", "9AU/20", "7AU/18" ])
setup_reinforcements(10)
+
+ set_add(game.minefields[MF_VISIBLE], TOBRUK)
},
"Battleaxe" () {