summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-27 23:47:37 +0100
committerTor Andersson <tor@ccxvii.net>2024-10-27 23:47:37 +0100
commitfb15209e66c5365c5df2d9fe1993ab319fd8eab6 (patch)
tree99ad2008455dcda1d2d242eb879ae69d06299101
parentaba1092cc2e5eb0edef4862c228c29e5f974f982 (diff)
downloadmaria-fb15209e66c5365c5df2d9fe1993ab319fd8eab6.tar.gz
add power control markers in player list
-rw-r--r--images/role_austria.1x.pngbin0 -> 1067 bytes
-rw-r--r--images/role_austria.2x.pngbin0 -> 3006 bytes
-rw-r--r--images/role_bavaria.1x.pngbin0 -> 1023 bytes
-rw-r--r--images/role_bavaria.2x.pngbin0 -> 2837 bytes
-rw-r--r--images/role_france.1x.pngbin0 -> 1106 bytes
-rw-r--r--images/role_france.2x.pngbin0 -> 2732 bytes
-rw-r--r--images/role_pragmatic.1x.pngbin0 -> 1133 bytes
-rw-r--r--images/role_pragmatic.2x.pngbin0 -> 3225 bytes
-rw-r--r--images/role_prussia.1x.pngbin0 -> 1268 bytes
-rw-r--r--images/role_prussia.2x.pngbin0 -> 3612 bytes
-rw-r--r--images/role_saxony.1x.pngbin0 -> 928 bytes
-rw-r--r--images/role_saxony.2x.pngbin0 -> 2052 bytes
-rw-r--r--play.css41
-rw-r--r--play.js57
-rw-r--r--tools/badges/role_austria.pngbin0 -> 1280 bytes
-rw-r--r--tools/badges/role_bavaria.pngbin0 -> 896 bytes
-rw-r--r--tools/badges/role_france.pngbin0 -> 684 bytes
-rw-r--r--tools/badges/role_pragmatic.pngbin0 -> 1341 bytes
-rw-r--r--tools/badges/role_prussia.pngbin0 -> 1688 bytes
-rw-r--r--tools/badges/role_saxony.pngbin0 -> 636 bytes
20 files changed, 98 insertions, 0 deletions
diff --git a/images/role_austria.1x.png b/images/role_austria.1x.png
new file mode 100644
index 0000000..80988dc
--- /dev/null
+++ b/images/role_austria.1x.png
Binary files differ
diff --git a/images/role_austria.2x.png b/images/role_austria.2x.png
new file mode 100644
index 0000000..94d592b
--- /dev/null
+++ b/images/role_austria.2x.png
Binary files differ
diff --git a/images/role_bavaria.1x.png b/images/role_bavaria.1x.png
new file mode 100644
index 0000000..f676c5c
--- /dev/null
+++ b/images/role_bavaria.1x.png
Binary files differ
diff --git a/images/role_bavaria.2x.png b/images/role_bavaria.2x.png
new file mode 100644
index 0000000..ad47b2a
--- /dev/null
+++ b/images/role_bavaria.2x.png
Binary files differ
diff --git a/images/role_france.1x.png b/images/role_france.1x.png
new file mode 100644
index 0000000..f93f795
--- /dev/null
+++ b/images/role_france.1x.png
Binary files differ
diff --git a/images/role_france.2x.png b/images/role_france.2x.png
new file mode 100644
index 0000000..3abf715
--- /dev/null
+++ b/images/role_france.2x.png
Binary files differ
diff --git a/images/role_pragmatic.1x.png b/images/role_pragmatic.1x.png
new file mode 100644
index 0000000..886518e
--- /dev/null
+++ b/images/role_pragmatic.1x.png
Binary files differ
diff --git a/images/role_pragmatic.2x.png b/images/role_pragmatic.2x.png
new file mode 100644
index 0000000..bf657fa
--- /dev/null
+++ b/images/role_pragmatic.2x.png
Binary files differ
diff --git a/images/role_prussia.1x.png b/images/role_prussia.1x.png
new file mode 100644
index 0000000..dc193de
--- /dev/null
+++ b/images/role_prussia.1x.png
Binary files differ
diff --git a/images/role_prussia.2x.png b/images/role_prussia.2x.png
new file mode 100644
index 0000000..8e4dbeb
--- /dev/null
+++ b/images/role_prussia.2x.png
Binary files differ
diff --git a/images/role_saxony.1x.png b/images/role_saxony.1x.png
new file mode 100644
index 0000000..6c79d76
--- /dev/null
+++ b/images/role_saxony.1x.png
Binary files differ
diff --git a/images/role_saxony.2x.png b/images/role_saxony.2x.png
new file mode 100644
index 0000000..091144e
--- /dev/null
+++ b/images/role_saxony.2x.png
Binary files 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
--- /dev/null
+++ b/tools/badges/role_austria.png
Binary files differ
diff --git a/tools/badges/role_bavaria.png b/tools/badges/role_bavaria.png
new file mode 100644
index 0000000..abd1354
--- /dev/null
+++ b/tools/badges/role_bavaria.png
Binary files differ
diff --git a/tools/badges/role_france.png b/tools/badges/role_france.png
new file mode 100644
index 0000000..54c0012
--- /dev/null
+++ b/tools/badges/role_france.png
Binary files differ
diff --git a/tools/badges/role_pragmatic.png b/tools/badges/role_pragmatic.png
new file mode 100644
index 0000000..47e8aea
--- /dev/null
+++ b/tools/badges/role_pragmatic.png
Binary files differ
diff --git a/tools/badges/role_prussia.png b/tools/badges/role_prussia.png
new file mode 100644
index 0000000..3a25b9d
--- /dev/null
+++ b/tools/badges/role_prussia.png
Binary files differ
diff --git a/tools/badges/role_saxony.png b/tools/badges/role_saxony.png
new file mode 100644
index 0000000..c61e97b
--- /dev/null
+++ b/tools/badges/role_saxony.png
Binary files differ