summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-16 00:32:56 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commite40e0171938dfe33c7069f2ca5c199a294bcd586 (patch)
tree473bd1b9a1ecb394d1c7679b7416add22bd5d955
parented3fbab5440ea95bf04d10880f178681a379ff5b (diff)
downloadrommel-in-the-desert-e40e0171938dfe33c7069f2ca5c199a294bcd586.tar.gz
Show eliminated units off to the side of the Qattara depression.
-rw-r--r--eliminated.svg1
-rw-r--r--play.html10
-rw-r--r--play.js10
-rw-r--r--rules.js2
4 files changed, 23 insertions, 0 deletions
diff --git a/eliminated.svg b/eliminated.svg
new file mode 100644
index 0000000..7c03a40
--- /dev/null
+++ b/eliminated.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M255.997 16.004c-120 0-239.997 60-239.997 149.998C16 226.002 61 256 61 316c0 45-15 45-15 75 0 14.998 48.01 32.002 89.998 44.998v60h239.997v-60s90.567-27.957 90-45c-.933-27.947-15-30-15-74.998 0-30 45.642-91.42 44.998-149.998 0-90-119.998-149.998-239.996-149.998zm-90 179.997c33.137 0 60 26.864 60 60 0 33.136-26.863 60-60 60C132.863 316 106 289.136 106 256c0-33.136 26.862-60 59.998-60zm179.998 0c33.136 0 60 26.864 60 60 0 33.136-26.864 60-60 60-33.136 0-60-26.864-60-60 0-33.136 26.864-60 60-60zm-89.998 105c15 0 45 60 45 75 0 29.998 0 29.998-15 29.998h-60c-15 0-15 0-15-30 0-15 30-74.998 45-74.998z" fill="#000" fill-opacity="0.2"/></svg>
diff --git a/play.html b/play.html
index 8ad0308..d90f707 100644
--- a/play.html
+++ b/play.html
@@ -432,11 +432,13 @@ svg #lines line.axis_supply.allied_supply {
box-shadow: 0 0 2px 1px hsl(80, 20%, 20%);
}
+.unit.axis.eliminated,
.unit.axis.fired,
.unit.axis.moved:not(.disrupted):not(.unsupplied) {
border-color: hsl(80, 20%, 40%);
}
+.unit.axis.eliminated:not(.revealed),
.unit.axis.fired:not(.revealed),
.unit.axis.moved:not(.revealed) {
background-color: hsl(80, 20%, 50%);
@@ -448,11 +450,13 @@ svg #lines line.axis_supply.allied_supply {
box-shadow: 0 0 2px 1px hsl(30, 40%, 20%);
}
+.unit.allied.eliminated,
.unit.allied.fired,
.unit.allied.moved:not(.disrupted):not(.unsupplied) {
border-color: hsl(35, 40%, 40%);
}
+.unit.allied.eliminated:not(.revealed),
.unit.allied.fired:not(.revealed),
.unit.allied.moved:not(.revealed) {
background-color: hsl(35, 40%, 50%);
@@ -464,6 +468,12 @@ svg #lines line.axis_supply.allied_supply {
background-position: center bottom;
}
+.unit.eliminated:not(.revealed) {
+ background-image: url(eliminated.svg);
+ background-size: 60%;
+ background-position: center;
+}
+
.unit.axis.revealed {
background-color: #abba8e;
}
diff --git a/play.js b/play.js
index ed17112..f083057 100644
--- a/play.js
+++ b/play.js
@@ -23,6 +23,7 @@ const SS_TOBRUK = 4
const SS_OASIS = 5
const DEPLOY = 1
+const ELIMINATED = 2
const ARMOR = 0
const INFANTRY = 1
@@ -375,6 +376,8 @@ function on_focus_unit(evt) {
t += " - moved"
if (is_unit_fired(u))
t += " - fired"
+ if (unit_hex(u) === ELIMINATED)
+ t += " - eliminated"
document.getElementById("status").textContent = t
}
@@ -716,6 +719,7 @@ function layout_stack(stack, hex, start_x, start_y, wrap, xdir) {
e.classList.toggle("action", !view.battle && is_unit_action(u))
e.classList.toggle("selected", !view.battle && is_unit_selected(u))
e.classList.toggle("moved", is_unit_moved(u))
+ e.classList.toggle("eliminated", unit_hex(u) === ELIMINATED)
}
}
@@ -750,6 +754,12 @@ function update_map() {
for (let u = 0; u < unit_count; ++u) {
let e = ui.units[u]
let hex = unit_hex(u)
+ if (hex === 2) {
+ if (is_axis_unit(u))
+ hex = 170
+ else
+ hex = 171
+ }
if (hex >= hexdeploy + view.month + 10)
hex = 0
if (is_setup_hex(hex)) {
diff --git a/rules.js b/rules.js
index 31e5a6c..8d55078 100644
--- a/rules.js
+++ b/rules.js
@@ -132,6 +132,7 @@ const ALLIED_QUEUE = 49
// Free deployment holding box
const DEPLOY = 1
+const ELIMINATED = 2
// Off board optional 1942 Malta reinforcements
const MALTA = 4
@@ -439,6 +440,7 @@ function set_unit_fired(u) {
function eliminate_unit(u) {
invalidate_caches()
game.units[u] = 0
+ set_unit_hex(u, ELIMINATED)
hide_unit(u)
}