summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-07-28 18:49:04 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:26 +0100
commit6d47047daf88fef9f2cda7f060d33e571a88893f (patch)
treea1c24d0b719815bedfa468a7bfe45549b6729c15
parent1f3e8f7fcc6c283bfe31240475cdff3d5fc6b7fd (diff)
downloadrommel-in-the-desert-6d47047daf88fef9f2cda7f060d33e571a88893f.tar.gz
Malta and reinforcement tracks.
-rw-r--r--play.js24
-rw-r--r--rules.js35
2 files changed, 46 insertions, 13 deletions
diff --git a/play.js b/play.js
index 78e1b3a..3faba75 100644
--- a/play.js
+++ b/play.js
@@ -11,7 +11,8 @@ const sqrt = Math.sqrt
const class_name = [ "armor", "infantry", "anti-tank", "artillery" ]
// refit and queue hexes
-const hex_special = [ 48, 49, 102, 127 ]
+const MALTA = 4
+const hex_special = [ 48, 49, 102, 127, MALTA ]
const ARMOR = 0
const INFANTRY = 1
@@ -355,6 +356,7 @@ const HIGHWAY = 4
const map_w = 25
const map_h = 9
+const hexdeploy = map_w * map_h
let hexnext = [ 1, map_w, map_w-1, -1, -map_w, -(map_w-1) ]
@@ -455,10 +457,14 @@ function build_hexes() {
}
}
- for (let month = 1; month <= 20; ++month) {
+ for (let month = 1; month <= 10; ++month) {
ui.hex_y[map_w * map_h + month] = 24 + 37
ui.hex_x[map_w * map_h + month] = 1840 + 37 + (month-1) * 81
}
+ for (let month = 11; month <= 20; ++month) {
+ ui.hex_y[map_w * map_h + month] = 24 + 37 // + 81
+ ui.hex_x[map_w * map_h + month] = 1840 + 37 + (month-11) * 81
+ }
document.getElementById("mapsvg").getElementById("grid").setAttribute("d", path.join(" "))
@@ -525,6 +531,10 @@ function update_map() {
for (let u = 0; u < units.length; ++u) {
let e = ui.units[u]
let hex = unit_hex(u)
+ if (view.month <= 10 && hex > hexdeploy + 10)
+ hex = 0
+ if (view.month <= 10 && hex === MALTA)
+ hex = 0
if (hex) {
if (!ui.onmap.contains(e))
ui.onmap.appendChild(e)
@@ -538,9 +548,10 @@ function update_map() {
for (let hex = 0; hex < stack.length; ++hex) {
let start_x = ui.hex_x[hex]
let start_y = ui.hex_y[hex]
+ let wrap = 6
if (stack[hex] === ui.focus) {
- let height = stack[hex].length * 56
+ let height = Math.min(wrap, stack[hex].length) * 56
if (start_y + height + 25 > 960)
start_y = 960 - height + 25
}
@@ -551,8 +562,11 @@ function update_map() {
let x, y, z
if (stack[hex] === ui.focus) {
- x = start_x - 25
- y = start_y - 25 + i * 56
+ if (start_x > 2000)
+ x = start_x - 25 - ((i / wrap) | 0) * 56
+ else
+ x = start_x - 25 + ((i / wrap) | 0) * 56
+ y = start_y - 25 + (i % wrap) * 56
z = 100
} else {
if (stack[hex].length <= 1) {
diff --git a/rules.js b/rules.js
index 52a0354..9697695 100644
--- a/rules.js
+++ b/rules.js
@@ -7,12 +7,13 @@
// TODO: gazala scenario
// TODO: legal pass withdrawal moves (reduce supply net, withdraw from fortress attack)
// TOOD: reveal/hide blocks (hexes)
-// TODO: malta units?
// TODO: group move from queue holding box to base
+// TODO: unit class/speed in battle flash
// TODO: redeployment
// TODO: return for refit
// TODO: replacements
+// TODO: malta units
// RULES: may units redeploying out of battles cross enemy controlled hexsides?
@@ -108,6 +109,9 @@ const ALLIED_REFIT = 48
const AXIS_QUEUE = 127
const ALLIED_QUEUE = 49
+// Off board optional 1942 Malta reinforcements
+const MALTA = 4
+
const EL_AGHEILA = 151
const ALEXANDRIA = 74
const BENGHAZI = 54
@@ -3805,11 +3809,10 @@ function end_buildup_discard() {
}
}
-function goto_buildup_supply_check() {
+function init_buildup() {
// TODO: fortress supply
// TODO: assign fortress supply
- // Remember supply networks throughout buildup.
game.buildup = {
// redeployment network
axis_network: axis_supply_network().slice(),
@@ -3822,6 +3825,10 @@ function goto_buildup_supply_check() {
benghazi: 2,
tobruk: 5,
}
+}
+
+function goto_buildup_supply_check() {
+ init_buildup()
for_each_axis_unit_on_map(u => {
let x = unit_hex(u)
@@ -4014,7 +4021,7 @@ function goto_buildup_resupply() {
shuffle_cards()
// Per-scenario allotment
- let axis_resupply = (game.month > 10 ? 2 : 3)
+ let axis_resupply = (game.month <= 10 || game.malta) ? 2 : 3
let allied_resupply = 3
// Extra cards purchased during buildup
@@ -4278,10 +4285,22 @@ function begin_game() {
set_add(game.minefields, 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_reinforcements()
+ return
+ }
+
// No buildup first month
// No initiative first month
- goto_player_turn()
+ // XXX goto_player_turn()
+ goto_buildup()
}
// === SETUP ===
@@ -4306,9 +4325,9 @@ function setup_reinforcements(m) {
for (let u = 0; u < units.length; ++u) {
if (units[u].appearance === m) {
if (m === 'M')
- set_unit_hex(u, 4)
+ set_unit_hex(u, MALTA)
else
- set_unit_hex(u, hexdeploy + (m > 10 ? m - 10 : m))
+ set_unit_hex(u, hexdeploy + m)
}
}
}
@@ -4649,7 +4668,7 @@ const SETUP = {
"10IN/21+25",
"70/14+16",
"8IN/18",
- "B",
+ "/B",
])
setup_units(DEPLOY, -1, [
"1/22",