summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.html22
-rw-r--r--play.js17
-rw-r--r--rules.js19
3 files changed, 50 insertions, 8 deletions
diff --git a/play.html b/play.html
index 16c303e..fcaf728 100644
--- a/play.html
+++ b/play.html
@@ -327,6 +327,24 @@ 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) {
+ stroke: yellow;
+ stroke-width: 4;
+ stroke-opacity: 0.5;
+}
+
svg .hex.from {
fill: gold;
fill-opacity: 0.2;
@@ -449,11 +467,11 @@ svg .hex.tip {
}
.unit.disrupted {
- border-color: crimson;
+ border-color: dimgray;
}
.unit.unsupplied {
- border-color: green;
+ border-color: brown;
}
.unit.r0 { transform: rotate(0deg); }
diff --git a/play.js b/play.js
index a424ad8..2590254 100644
--- a/play.js
+++ b/play.js
@@ -230,6 +230,18 @@ 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_assault(hex) {
+ return set_has(view.assaults, hex)
+}
+
+function is_hex_current(hex) {
+ return hex === view.pursuit || hex === view.battle
+}
+
function focus_stack(stack) {
if (ui.focus !== stack) {
console.log("FOCUS STACK", stack)
@@ -698,6 +710,9 @@ 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("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) {
@@ -736,7 +751,7 @@ function update_battle_line(hex, line, test) {
e.classList.toggle("action", is_unit_action(u))
e.classList.toggle("selected", is_unit_selected(u))
e.classList.toggle("disrupted", is_unit_disrupted(u))
- e.classList.toggle("fire", is_unit_fired(u))
+ e.classList.toggle("moved", is_unit_fired(u))
e.classList.toggle("revealed", is_unit_revealed(u))
} else {
if (line.contains(e))
diff --git a/rules.js b/rules.js
index e205eed..29195d7 100644
--- a/rules.js
+++ b/rules.js
@@ -5,7 +5,7 @@
// TODO: legal pass withdrawal moves (reduce supply net, withdraw from fortress attack)
// TODO: fortress combat in pass turns (must withdraw)
-// TODO: highlight selected/active battles
+// TODO: highlight selected/active/assault battles
// TODO: group move from queue holding box to base
// TODO: 1942 malta group (reinforce, reduce supply card draw)
@@ -1887,9 +1887,11 @@ function end_player_turn() {
set_clear(game.partial_retreats)
// Reveal supply cards
- log_br()
- log(`Supply Cards Revealed:\n${game.commit[0]} real and ${game.commit[1]} dummy.`)
- log_br()
+ if (game.commit[0] + game.commit[1] > 0) {
+ log_br()
+ log(`Supply Cards Revealed:\n${game.commit[0]} real and ${game.commit[1]} dummy.`)
+ log_br()
+ }
game.commit = [ 0, 0 ]
@@ -3920,6 +3922,7 @@ function gen_battle_hits() {
}
function apply_battle_hit(who) {
+ game.flash = ""
game.hits[unit_class[who]] -= reduce_unit(who)
}
@@ -5721,7 +5724,6 @@ exports.view = function(state, current) {
if (current === game.active)
view.selected = game.selected
-
if (game.from1) view.from1 = game.from1
if (game.from2) view.from2 = game.from2
if (game.to1) view.to1 = game.to1
@@ -5734,6 +5736,13 @@ exports.view = function(state, current) {
view.flash = game.flash
}
+ if (game.fired.length > 0 && (game.battle || game.pursuit))
+ view.fired = game.fired
+ if (game.active_battles.length > 0)
+ view.battles = game.active_battles
+ if (game.assault_battles.length > 0)
+ view.assaults = game.assault_battles
+
return common_view(current)
}