summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-08-13 15:39:20 +0200
committerTor Andersson <tor@ccxvii.net>2023-10-01 16:11:22 +0200
commitd31416c59ce6cf5d62db6fbdc6586472fbb00c4b (patch)
tree7e1450ffe8165b6435a26315d2a0e4a0c2de4ebd /play.js
parent8909f58b58de9ae562af7ffa72eb4a56b87aefb4 (diff)
downloadwaterloo-campaign-1815-d31416c59ce6cf5d62db6fbdc6586472fbb00c4b.tar.gz
Place/Recall detachments.
WIP: place by road
Diffstat (limited to 'play.js')
-rw-r--r--play.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/play.js b/play.js
index 0ba5099..0ad5f78 100644
--- a/play.js
+++ b/play.js
@@ -203,6 +203,7 @@ function on_update() {
for (let id = 0; id < piece_count; ++id) {
let hex = view.pieces[id] >> 1
if (hex >= first_hex) {
+ // ON MAP
ui.pieces[id].classList.remove("hide")
ui.pieces[id].classList.toggle("flip", (view.pieces[id] & 1) === 1)
let x = ui.hex_x[hex] - ui.stack[hex] * 18
@@ -217,7 +218,17 @@ function on_update() {
}
ui.pieces[id].style.top = y + "px"
ui.pieces[id].style.left = x + "px"
+ } else if (hex === 100 || hex === 101) {
+ // AVAILABLE DETACHMENTS
+ ui.pieces[id].classList.remove("hide")
+ ui.pieces[id].classList.remove("flip")
+ let x = 600 + 20 + ui.stack[hex] * 50
+ let y = 1650 + 20 + 60 * (hex-100)
+ ui.stack[hex] += 1
+ ui.pieces[id].style.top = y + "px"
+ ui.pieces[id].style.left = x + "px"
} else if (hex >= 1) {
+ // ON TURN TRACK
ui.pieces[id].classList.remove("hide")
ui.pieces[id].classList.remove("flip")
let x = TURN_X + hex * TURN_DX - ui.stack[hex] * 18
@@ -233,10 +244,13 @@ function on_update() {
ui.pieces[id].style.top = y + "px"
ui.pieces[id].style.left = x + "px"
} else {
+ // TODO: ENTRY HEXES
+ // ELIMINATED
ui.pieces[id].classList.add("hide")
}
ui.pieces[id].classList.toggle("action", is_action("piece", id))
ui.pieces[id].classList.toggle("selected", view.who === id)
+ ui.pieces[id].classList.toggle("target", view.target === id)
}
if (view.roads) {