From e40e0171938dfe33c7069f2ca5c199a294bcd586 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 16 Sep 2022 00:32:56 +0200 Subject: Show eliminated units off to the side of the Qattara depression. --- eliminated.svg | 1 + play.html | 10 ++++++++++ play.js | 10 ++++++++++ rules.js | 2 ++ 4 files changed, 23 insertions(+) create mode 100644 eliminated.svg diff --git a/eliminated.svg b/eliminated.svg new file mode 100644 index 0000000..7c03a40 --- /dev/null +++ b/eliminated.svg @@ -0,0 +1 @@ + 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) } -- cgit v1.2.3