diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-07-09 00:38:57 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:25 +0100 |
commit | 0bd59a6223df84916f766f1fcccc4439e92efc8e (patch) | |
tree | 947d6e79f58690196ea9984f189c69695e759a09 /play.js | |
parent | 68d249e1cff4b1638e4eefa463f3a680ffd62d6c (diff) | |
download | rommel-in-the-desert-0bd59a6223df84916f766f1fcccc4439e92efc8e.tar.gz |
firing and taking hits
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -1,5 +1,7 @@ "use strict" +// TODO: intermediate regroup moves + // https://www.redblobgames.com/grids/hexagons/ const svgNS = "http://www.w3.org/2000/svg" @@ -371,7 +373,7 @@ function update_map() { if (stack[hex] === ui.focus) { x = ui.hex_x[hex] - 25 - y = ui.hex_y[hex] - 25 + i * 54 + y = ui.hex_y[hex] - 25 + i * 56 z = 100 } else { if (stack[hex].length <= 1) { @@ -381,11 +383,11 @@ function update_map() { x = ui.hex_x[hex] - 30 + i * 11 y = ui.hex_y[hex] - 30 + i * 14 } else if (stack[hex].length <= 8) { - x = ui.hex_x[hex] - 35 + i * 4 - y = ui.hex_y[hex] - 35 + i * 4 + x = ui.hex_x[hex] - 30 + i * 4 + y = ui.hex_y[hex] - 30 + i * 4 } else { - x = ui.hex_x[hex] - 35 + i * 2 - y = ui.hex_y[hex] - 35 + i * 2 + x = ui.hex_x[hex] - 35 + i * 3 + y = ui.hex_y[hex] - 35 + i * 3 } z = 1 + i } @@ -466,14 +468,16 @@ function update_battle() { update_battle_line(ui.battle_line_1, is_allied_unit) update_battle_line(ui.battle_line_2, is_axis_unit) } - target_button("target_armor") - target_button("target_infantry") - target_button("target_antitank") - target_button("target_artillery") + target_button("armor") + target_button("infantry") + target_button("antitank") + target_button("artillery") + for (let i = 0; i < 4; ++i) + ui.battle_hits[i].textContent = view.hits[i] } function target_button(action) { - let button = document.getElementById(action + "_button") + let button = document.getElementById("target_" + action + "_button") if (view.actions) { button.classList.remove("hide") if (view.actions[action]) |