From eaa39d34fc8f20b5e996aa896f338d765456ad60 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 27 Jul 2024 17:30:13 +0200 Subject: manual arnold. attrition fix. --- play.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 9fee8e5..7e6852b 100644 --- a/play.js +++ b/play.js @@ -437,7 +437,7 @@ function get_static_xy(s) { let x, y if (s >= 66) { x = data.spaces[s].x - y = data.spaces[s].y + y = data.spaces[s].y + 60 } else { x = data.spaces[s].x - 20 y = data.spaces[s].y + 15 @@ -568,7 +568,7 @@ function on_update() { if (s === NOWHERE) continue - let pos = ui.layout_static[s] + let pos = (s < 66) ? ui.layout_static[s] : get_static_xy(s) if (view.move && view.move.who === g) pos = ui.layout_move if (view.react && view.react.who === g) @@ -576,6 +576,9 @@ function on_update() { let [ x, y ] = pos + if (s >= 66) + y -= 60 + if (view.move && view.move.who === g) { ui.generals[g].classList.add("selected") } else if (view.react && view.react.who === g) { @@ -587,13 +590,13 @@ function on_update() { let offset = general_offset(g) x += offset * (45 + 9) } else { + let wrap = (s === 66 ? 3 : 4) let total = general_total(g) let offset = general_offset(g) - let off_x = offset % 3 - let off_y = offset / 3 | 0 - let ctr_x = total > 3 ? 3 : total + let off_x = offset % wrap + let off_y = offset / wrap | 0 + let ctr_x = total > wrap ? wrap : total off_x -= (ctr_x - 1) / 2 - // off_y -= (total / 3 | 0) / 2 x += off_x * (45 + 9) y += off_y * (45 + 9) y -= 15 -- cgit v1.2.3