From fb15209e66c5365c5df2d9fe1993ab319fd8eab6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 27 Oct 2024 23:47:37 +0100 Subject: add power control markers in player list --- images/role_austria.1x.png | Bin 0 -> 1067 bytes images/role_austria.2x.png | Bin 0 -> 3006 bytes images/role_bavaria.1x.png | Bin 0 -> 1023 bytes images/role_bavaria.2x.png | Bin 0 -> 2837 bytes images/role_france.1x.png | Bin 0 -> 1106 bytes images/role_france.2x.png | Bin 0 -> 2732 bytes images/role_pragmatic.1x.png | Bin 0 -> 1133 bytes images/role_pragmatic.2x.png | Bin 0 -> 3225 bytes images/role_prussia.1x.png | Bin 0 -> 1268 bytes images/role_prussia.2x.png | Bin 0 -> 3612 bytes images/role_saxony.1x.png | Bin 0 -> 928 bytes images/role_saxony.2x.png | Bin 0 -> 2052 bytes play.css | 41 +++++++++++++++++++++++++++++ play.js | 57 ++++++++++++++++++++++++++++++++++++++++ tools/badges/role_austria.png | Bin 0 -> 1280 bytes tools/badges/role_bavaria.png | Bin 0 -> 896 bytes tools/badges/role_france.png | Bin 0 -> 684 bytes tools/badges/role_pragmatic.png | Bin 0 -> 1341 bytes tools/badges/role_prussia.png | Bin 0 -> 1688 bytes tools/badges/role_saxony.png | Bin 0 -> 636 bytes 20 files changed, 98 insertions(+) create mode 100644 images/role_austria.1x.png create mode 100644 images/role_austria.2x.png create mode 100644 images/role_bavaria.1x.png create mode 100644 images/role_bavaria.2x.png create mode 100644 images/role_france.1x.png create mode 100644 images/role_france.2x.png create mode 100644 images/role_pragmatic.1x.png create mode 100644 images/role_pragmatic.2x.png create mode 100644 images/role_prussia.1x.png create mode 100644 images/role_prussia.2x.png create mode 100644 images/role_saxony.1x.png create mode 100644 images/role_saxony.2x.png create mode 100644 tools/badges/role_austria.png create mode 100644 tools/badges/role_bavaria.png create mode 100644 tools/badges/role_france.png create mode 100644 tools/badges/role_pragmatic.png create mode 100644 tools/badges/role_prussia.png create mode 100644 tools/badges/role_saxony.png diff --git a/images/role_austria.1x.png b/images/role_austria.1x.png new file mode 100644 index 0000000..80988dc Binary files /dev/null and b/images/role_austria.1x.png differ diff --git a/images/role_austria.2x.png b/images/role_austria.2x.png new file mode 100644 index 0000000..94d592b Binary files /dev/null and b/images/role_austria.2x.png differ diff --git a/images/role_bavaria.1x.png b/images/role_bavaria.1x.png new file mode 100644 index 0000000..f676c5c Binary files /dev/null and b/images/role_bavaria.1x.png differ diff --git a/images/role_bavaria.2x.png b/images/role_bavaria.2x.png new file mode 100644 index 0000000..ad47b2a Binary files /dev/null and b/images/role_bavaria.2x.png differ diff --git a/images/role_france.1x.png b/images/role_france.1x.png new file mode 100644 index 0000000..f93f795 Binary files /dev/null and b/images/role_france.1x.png differ diff --git a/images/role_france.2x.png b/images/role_france.2x.png new file mode 100644 index 0000000..3abf715 Binary files /dev/null and b/images/role_france.2x.png differ diff --git a/images/role_pragmatic.1x.png b/images/role_pragmatic.1x.png new file mode 100644 index 0000000..886518e Binary files /dev/null and b/images/role_pragmatic.1x.png differ diff --git a/images/role_pragmatic.2x.png b/images/role_pragmatic.2x.png new file mode 100644 index 0000000..bf657fa Binary files /dev/null and b/images/role_pragmatic.2x.png differ diff --git a/images/role_prussia.1x.png b/images/role_prussia.1x.png new file mode 100644 index 0000000..dc193de Binary files /dev/null and b/images/role_prussia.1x.png differ diff --git a/images/role_prussia.2x.png b/images/role_prussia.2x.png new file mode 100644 index 0000000..8e4dbeb Binary files /dev/null and b/images/role_prussia.2x.png differ diff --git a/images/role_saxony.1x.png b/images/role_saxony.1x.png new file mode 100644 index 0000000..6c79d76 Binary files /dev/null and b/images/role_saxony.1x.png differ diff --git a/images/role_saxony.2x.png b/images/role_saxony.2x.png new file mode 100644 index 0000000..091144e Binary files /dev/null and b/images/role_saxony.2x.png differ diff --git a/play.css b/play.css index 922bc69..0b4186e 100644 --- a/play.css +++ b/play.css @@ -29,6 +29,47 @@ body { .role.active span { font-weight: bold } +.role_stat { + display: flex; + flex-wrap: wrap; + align-items: start; + gap: 4px; + padding-right: 3px; +} + +.role_marker { + display: inline-block; + width: 30px; + height: 22px; + background-size: 24px 24px; + background-position: center; + background-repeat: no-repeat; + border: 1px solid black; +} + +.role_marker.france { background-color: #ed1c24 } +.role_marker.prussia { background-color: #005988 } +.role_marker.pragmatic { background-color: #5f5c5c } +.role_marker.austria { background-color: #ffffff } +.role_marker.saxony { background-color: #157d36 } +.role_marker.bavaria { background-color: #ffc825 } + +.role_marker.france { background-image: url(images/role_france.1x.png) } +.role_marker.prussia { background-image: url(images/role_prussia.1x.png) } +.role_marker.pragmatic { background-image: url(images/role_pragmatic.1x.png) } +.role_marker.austria { background-image: url(images/role_austria.1x.png) } +.role_marker.saxony { background-image: url(images/role_saxony.1x.png) } +.role_marker.bavaria { background-image: url(images/role_bavaria.1x.png) } + +@media (min-resolution: 97dpi) { +.role_marker.france { background-image: url(images/role_france.2x.png) } +.role_marker.prussia { background-image: url(images/role_prussia.2x.png) } +.role_marker.pragmatic { background-image: url(images/role_pragmatic.2x.png) } +.role_marker.austria { background-image: url(images/role_austria.2x.png) } +.role_marker.saxony { background-image: url(images/role_saxony.2x.png) } +.role_marker.bavaria { background-image: url(images/role_bavaria.2x.png) } +} + #mapwrap { width: 2485px; height: 1654px; diff --git a/play.js b/play.js index 96a1242..0e35b5d 100644 --- a/play.js +++ b/play.js @@ -39,6 +39,10 @@ function action_menu(menu, action_list) { x |= action_menu_item(action) } +const R_LOUIS_XV = "Louis XV" +const R_FREDERICK = "Frederick" +const R_MARIA_THERESA = "Maria Theresa" + /* DATA (SHARED) */ const deck_name = [ "red", "green", "blue", "yellow" ] @@ -603,6 +607,21 @@ function make_political_back(deck) { return e } +function make_badge(power) { + let e = document.createElement("div") + e.className = "role_marker " + power + return e +} + +const power_badge = [ + make_badge("france"), + make_badge("prussia"), + make_badge("pragmatic"), + make_badge("austria"), + make_badge("bavaria"), + make_badge("saxony"), +] + function on_init() { ui.pieces = [ create_piece("piece", 0, "piece cylinder france france_1"), @@ -1129,6 +1148,40 @@ function update_favicon() { } } +function is_saxony_prussian() { + return view.saxony <= 2 +} + +function player_from_power(pow) { + switch (pow) { + case P_FRANCE: + return R_LOUIS_XV + case P_PRUSSIA: + return R_FREDERICK + case P_PRAGMATIC: + return R_FREDERICK + case P_AUSTRIA: + return R_MARIA_THERESA + case P_SAXONY: + if (is_saxony_prussian()) + return R_FREDERICK + else + return R_MARIA_THERESA + case P_BAVARIA: + return R_LOUIS_XV + } + return "NONE" +} + +function update_player_power_list(role) { + if (roles[role]) { + roles[role].stat.replaceChildren() + for (let pow of all_powers) + if (player_from_power(pow) === role) + roles[role].stat.appendChild(power_badge[pow]) + } +} + function cmp_tc(a, b) { let ax = (to_suit(a) << 7) + (to_value(a) << 3) + to_deck(a) let bx = (to_suit(b) << 7) + (to_value(b) << 3) + to_deck(b) @@ -1179,6 +1232,10 @@ function on_update() { ui.header.classList.toggle("pragmatic", view.power === P_PRAGMATIC) ui.header.classList.toggle("austria", view.power === P_AUSTRIA) + update_player_power_list(R_MARIA_THERESA) + update_player_power_list(R_FREDERICK) + update_player_power_list(R_LOUIS_XV) + used_victory.fill(0) used_elector.fill(0) used_retro.fill(0) diff --git a/tools/badges/role_austria.png b/tools/badges/role_austria.png new file mode 100644 index 0000000..1da31e4 Binary files /dev/null and b/tools/badges/role_austria.png differ diff --git a/tools/badges/role_bavaria.png b/tools/badges/role_bavaria.png new file mode 100644 index 0000000..abd1354 Binary files /dev/null and b/tools/badges/role_bavaria.png differ diff --git a/tools/badges/role_france.png b/tools/badges/role_france.png new file mode 100644 index 0000000..54c0012 Binary files /dev/null and b/tools/badges/role_france.png differ diff --git a/tools/badges/role_pragmatic.png b/tools/badges/role_pragmatic.png new file mode 100644 index 0000000..47e8aea Binary files /dev/null and b/tools/badges/role_pragmatic.png differ diff --git a/tools/badges/role_prussia.png b/tools/badges/role_prussia.png new file mode 100644 index 0000000..3a25b9d Binary files /dev/null and b/tools/badges/role_prussia.png differ diff --git a/tools/badges/role_saxony.png b/tools/badges/role_saxony.png new file mode 100644 index 0000000..c61e97b Binary files /dev/null and b/tools/badges/role_saxony.png differ -- cgit v1.2.3