diff options
-rw-r--r-- | play.js | 61 | ||||
-rw-r--r-- | rules.js | 4 |
2 files changed, 35 insertions, 30 deletions
@@ -35,13 +35,14 @@ const last_city = data.cities.name.length - 1 const ELIMINATED = data.cities.name.length const REMOVED = ELIMINATED + 1 -const ELIMINATED_TRAIN_X = 1065 -const ELIMINATED_TRAIN_Y = 210 -const ELIMINATED_DISC_X = 1365 -const ELIMINATED_DISC_Y = 210 -const ELIMINATED_GENERAL_X = 1040 -const ELIMINATED_GENERAL_Y = 160 +const ELIMINATED_TRAIN_X = 340 +const ELIMINATED_TRAIN_Y = 160 +const ELIMINATED_TRAIN_DX = 33 +const ELIMINATED_GENERAL_X = 340 +const ELIMINATED_GENERAL_Y = 110 const ELIMINATED_GENERAL_DX = 50 +const ELIMINATED_DISC_X = 340 + 75 +const ELIMINATED_DISC_Y = 240 const power_class = [ "france", "bavaria", "prussia", "saxony", "pragmatic", "austria" ] const power_name = [ "France", "Bavaria", "Prussia", "Saxony", "Pragmatic", "Austria" ] @@ -703,7 +704,7 @@ function layout_general_offset_elim(g) { function layout_train_offset(g, s) { let n = 0 - for (let i = g+1; i < 35; ++i) + for (let i = 20; i < g; ++i) if (view.pos[i] === s) ++n return n @@ -716,6 +717,28 @@ function get_cylinder_power(id) { return -1 } +function layout_hussar(id, s) { + let e = ui.pieces[id] + let n = 0 + let x, y + + if (e.parentElement !== ui.pieces_element) + ui.pieces_element.appendChild(e) + + if (s === ELIMINATED) { + x = ELIMINATED_DISC_X + y = ELIMINATED_DISC_Y + n = id - 30 + } else { + x = data.cities.x[s] + y = data.cities.y[s] + } + + e.style.left = (x - 21) + "px" + e.style.top = (y - 29 + 7 - n * 8) + "px" + e.classList.toggle("selected", set_has(view.selected, id)) +} + function layout_general(id, s) { let x, y, n @@ -778,33 +801,11 @@ function layout_train(id, s) { y = data.cities.y[s] } - e.style.left = (x - 14 + n * 33) + "px" + e.style.left = (x - 14 + n * ELIMINATED_TRAIN_DX) + "px" e.style.top = (y - 21 - n * 0) + "px" e.classList.toggle("selected", set_has(view.selected, id)) } -function layout_hussar(id, s) { - let e = ui.pieces[id] - let n = 0 - let x, y - - if (e.parentElement !== ui.pieces_element) - ui.pieces_element.appendChild(e) - - if (s === ELIMINATED) { - x = ELIMINATED_DISC_X - y = ELIMINATED_DISC_Y - n = id - 30 - } else { - x = data.cities.x[s] - y = data.cities.y[s] - } - - e.style.left = (x - 14) + "px" - e.style.top = (y - 16 - n * 12) + "px" - e.classList.toggle("selected", set_has(view.selected, id)) -} - function layout_combat_marker() { let x = (data.cities.x[view.attacker] + data.cities.x[view.defender]) >> 1 let y = (data.cities.y[view.attacker] + data.cities.y[view.defender]) >> 1 @@ -2528,6 +2528,10 @@ const setup_piece_position = [ find_city("Hlinsko"), find_city("Bruck"), find_city("Geel"), + + // Hussars + ELIMINATED, + ELIMINATED ] function make_political_deck() { |