summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--map.svg2
-rw-r--r--play.html139
-rw-r--r--play.js8
-rw-r--r--rules.js22
4 files changed, 83 insertions, 88 deletions
diff --git a/map.svg b/map.svg
index 76f8730..7104359 100644
--- a/map.svg
+++ b/map.svg
@@ -358,7 +358,7 @@
</g>
-<g id="hexes" fill="transparent"></g>
+<g id="hexes" fill="transparent" stroke="transparent"></g>
<g id="sides"></g>
</svg>
diff --git a/play.html b/play.html
index fcaf728..dd24f84 100644
--- a/play.html
+++ b/play.html
@@ -261,61 +261,29 @@ td img { vertical-align: middle }
background-color: tan;
}
-svg .side {
- stroke-linecap: round;
- stroke-width: 8px;
-}
-
-svg .side.axis_control {
- stroke: green;
- stroke-width: 4px;
- stroke-opacity: 0.8;
- stroke-dasharray: 54 100;
- stroke-dashoffset: -8;
-}
-
-svg .side.allied_control {
- stroke: brown;
- stroke-width: 4px;
- stroke-opacity: 0.8;
- stroke-dasharray: 54 100;
- stroke-dashoffset: -8;
-}
-
-svg .side.axis_supply {
- stroke-width: 64px;
- stroke-linecap: butt;
- stroke-dasharray: 8 100;
- stroke-dashoffset: -31;
- stroke-opacity: 0.6;
- stroke: green;
-}
+/* MAP */
-svg .side.allied_supply {
- stroke-width: 64px;
- stroke-linecap: butt;
- stroke-dasharray: 8 100;
- stroke-dashoffset: -31;
- stroke-opacity: 0.6;
- stroke: crimson;
+svg .fortress.axis {
+ fill: #264;
}
-svg .side.allied_supply.axis_supply {
- stroke: yellow;
+svg .side {
+ stroke-linecap: round;
+ stroke-width: 4;
}
-svg .fortress.axis {
- fill: #264;
+svg .hex {
+ stroke-width: 2;
}
svg .hex.action {
- stroke: whitesmoke;
- stroke-width: 2;
+ stroke: ivory;
+ stroke-dasharray: 2 2;
+ stroke-dashoffset: 1;
}
svg .hex.action.forced_march {
- stroke: salmon;
- stroke-width: 2;
+ stroke: crimson;
}
svg .hex.exit {
@@ -327,22 +295,8 @@ svg .hex.refit.action {
stroke: lightskyblue;
}
-svg .hex.battle:not(.action) {
- stroke: black;
- stroke-width: 4;
- stroke-opacity: 0.25;
-}
-
-svg .hex.assault:not(.action) {
- stroke: black;
- stroke-width: 4;
- stroke-opacity: 0.5;
-}
-
-svg .hex.current:not(.action) {
+svg .hex.selected {
stroke: yellow;
- stroke-width: 4;
- stroke-opacity: 0.5;
}
svg .hex.from {
@@ -355,36 +309,79 @@ svg .hex.to {
fill-opacity: 0.2;
}
+svg .hex.tip {
+ stroke: white;
+ stroke-dasharray: 4 4;
+}
+
+/* HEX CONTROL */
+
svg .hex.axis_control {
- fill: green;
+ fill: seagreen;
fill-opacity: 0.2;
}
svg .hex.allied_control {
- fill: brown;
+ fill: firebrick;
fill-opacity: 0.2;
}
+svg .side.axis_control {
+ stroke: seagreen;
+ stroke-dasharray: 54 100;
+ stroke-dashoffset: -8;
+}
+
+svg .side.allied_control {
+ stroke: firebrick;
+ stroke-dasharray: 54 100;
+ stroke-dashoffset: -8;
+}
+
+/* SUPPLY LINES */
+
svg .hex.axis_supply {
- fill: green;
- fill-opacity: 0.3;
+ fill: seagreen;
+ fill-opacity: 0.4;
}
svg .hex.allied_supply {
- fill: brown;
- fill-opacity: 0.3;
+ fill: firebrick;
+ fill-opacity: 0.4;
+}
+
+svg .side.axis_supply {
+ stroke: darkslategray;
+ stroke-width: 122px;
+ stroke-width: 121.5px;
+ stroke-width: 72px;
+ stroke-linecap: butt;
+ stroke-dasharray: 8 100;
+ stroke-dashoffset: -31;
+ stroke-opacity: 0.6;
+}
+
+svg .side.allied_supply {
+ stroke: darkred;
+ stroke-width: 122px;
+ stroke-width: 121.5px;
+ stroke-width: 72px;
+ stroke-linecap: butt;
+ stroke-dasharray: 8 100;
+ stroke-dashoffset: -31;
+ stroke-opacity: 0.6;
}
svg .hex.axis_supply.allied_supply {
- fill: gold;
- fill-opacity: 0.3;
+ fill: orange;
}
-svg .hex.tip {
- fill: black;
- fill-opacity: 0.6;
+svg .side.allied_supply.axis_supply {
+ stroke: darkorange;
}
+/* UNITS */
+
.minefield {
position: absolute;
pointer-events: none;
@@ -644,7 +641,7 @@ svg .hex.tip {
<div class="debug menu_item" onclick="send_restart('Crusader')">&#x26a0; Restart Crusader</div>
<div class="debug menu_item" onclick="send_restart('Battleaxe')">&#x26a0; Restart Battleaxe</div>
<div class="debug menu_item" onclick="send_restart('Gazala')">&#x26a0; Restart Gazala</div>
- <div class="debug menu_item" onclick="send_restart('Pursuit to Alamein')">&#x26a0; Restart Pursuit</div>
+ <div class="debug menu_item" onclick="send_restart('Pursuit to Alamein')">&#x26a0; Restart Alamein</div>
<div class="debug menu_item" onclick="send_restart('1941-42')">&#x26a0; Restart 1941-42</div>
</div>
</div>
diff --git a/play.js b/play.js
index 2590254..d9f402a 100644
--- a/play.js
+++ b/play.js
@@ -230,8 +230,8 @@ function is_side_allied_supply_line(side) {
return view.allied_supply_line[side] > 0
}
-function is_hex_battle(hex) {
- return set_has(view.battles, hex) && !set_has(view.assaults)
+function is_hex_selected(hex) {
+ return set_has(view.selected_hexes, hex)
}
function is_hex_assault(hex) {
@@ -710,9 +710,7 @@ function update_map() {
ui.hexes[hex].classList.toggle("forced_march", is_hex_forced_march_action(hex))
ui.hexes[hex].classList.toggle("from", hex === view.from1 || hex === view.from2)
ui.hexes[hex].classList.toggle("to", hex === view.to1 || hex === view.to2)
- ui.hexes[hex].classList.toggle("battle", is_hex_battle(hex))
- ui.hexes[hex].classList.toggle("assault", is_hex_assault(hex))
- ui.hexes[hex].classList.toggle("current", is_hex_current(hex))
+ ui.hexes[hex].classList.toggle("selected", is_hex_selected(hex))
ui.hexes[hex].classList.toggle("axis_control", is_hex_axis_controlled(hex))
ui.hexes[hex].classList.toggle("allied_control", is_hex_allied_controlled(hex))
for (let s = 0; s < 3; ++s) {
diff --git a/rules.js b/rules.js
index 026a9fb..3ebac16 100644
--- a/rules.js
+++ b/rules.js
@@ -5,15 +5,14 @@
// TODO: legal pass withdrawal moves (reduce supply net, withdraw from fortress attack)
// TODO: fortress combat in pass turns (must withdraw)
-// TODO: highlight selected/active/assault battles
-
// TODO: group move from queue holding box to base
// TODO: 1942 malta group (reinforce, reduce supply card draw)
-// TODO: multi-select deployment
// TODO: log summaries (deploy, rebuild, move, etc)
// TODO: put initial deployment stack somewhere more accessible (spread out along the top?)
+// UI: pause after all fires (in case 0 hits the dialog disappears fast)
+
// RULES: may units redeploying out of battle hex cross enemy controlled hexsides? (yes / doesn't matter)
// RULES: can fortress supplied units be part of supply lines for non-fortress supplied units for withdrawals to base?
@@ -1840,6 +1839,8 @@ function apply_turn_option(option) {
game.turn_option = option
+ log_br()
+
let n = game.commit[0] + game.commit[1]
if (n === 0)
log(`Played zero supply cards.`)
@@ -1961,7 +1962,6 @@ function union_axis_line() {
function union_allied_line() {
let net = allied_supply_network()
let line = allied_supply_line().slice()
- console.log("Xa")
if (net[BARDIA] === 0 && is_fortress_allied_controlled(BARDIA))
union_fortress_line(line, bardia_supply_line())
if (net[BENGHAZI] === 0 && is_fortress_allied_controlled(BENGHAZI))
@@ -2379,6 +2379,7 @@ states.regroup_move_command_point = {
for (let x of all_hexes) {
if (!is_enemy_hex(x)) {
let n = count_hex_or_adjacent_has_undisrupted_and_unmoved_friendly_unit(x)
+ // TODO: allow one-hex regroup moves? (failed forced march abuse)
if (n >= 2)
gen_action_hex(x)
}
@@ -3549,9 +3550,9 @@ function end_rout() {
function is_mandatory_combat(fortress) {
if (is_battle_hex(fortress)) {
if (game.phasing === AXIS)
- return is_fortress_allied_controlled()
+ return is_fortress_allied_controlled(fortress)
else
- return is_fortress_axis_controlled()
+ return is_fortress_axis_controlled(fortress)
}
return false
}
@@ -3590,7 +3591,7 @@ states.select_active_battles = {
inactive: "combat phase (select active battles)",
prompt() {
view.prompt = `Select active battles.`
- view.active_battles = game.active_battles
+ view.selected_hexes = game.active_battles
for (let x of all_hexes)
if (!set_has(game.active_battles, x) && is_battle_hex(x))
gen_action_hex(x)
@@ -3617,8 +3618,7 @@ states.select_assault_battles = {
inactive: "combat phase (select assault battles)",
prompt() {
view.prompt = `Select assault battles.`
- view.active_battles = game.active_battles
- view.assault_battles = game.assault_battles
+ view.selected_hexes = game.assault_battles
for (let x of game.active_battles)
if (!set_has(game.assault_battles, x))
gen_action_hex(x)
@@ -3886,7 +3886,7 @@ function gen_battle_target() {
// only artillery may target artillery if other units are alive
if (hp[ARTILLERY] > 0) {
if (fc === ARTILLERY ||
- (hp[ARTILLERY] <= 0 && hp[INFANTRY] <= 0 && hp[ANTITANK] <= 0))
+ (hp[ARMOR] <= 0 && hp[INFANTRY] <= 0 && hp[ANTITANK] <= 0))
gen_action('artillery')
}
}
@@ -3976,7 +3976,7 @@ states.battle_hits = {
function end_battle_hits() {
if (is_friendly_rout_hex(game.battle)) {
goto_rout(game.battle, false, end_battle)
- } else if (game.active === game.phasing) {
+ } else if (game.active === game.phasing && has_friendly_units_in_battle()) {
// goto offensive fire
game.state = 'battle_fire'
game.hits = [ 0, 0, 0, 0 ]