summaryrefslogtreecommitdiff
path: root/ui.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-07 00:49:36 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:12:42 +0100
commit25c63103c6d93f793b8c95ed713c27912ae57551 (patch)
tree2451aeae17f9cd7efc657145807f64dc3c1ef7ca /ui.js
parent5718d3695e0783ce8695aeb51f3af797d6037e60 (diff)
downloadshores-of-tripoli-25c63103c6d93f793b8c95ed713c27912ae57551.tar.gz
tripoli: Pirate raids.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js34
1 files changed, 32 insertions, 2 deletions
diff --git a/ui.js b/ui.js
index 205d42c..2a1fbc8 100644
--- a/ui.js
+++ b/ui.js
@@ -133,13 +133,43 @@ function update_cards() {
/* MAP AND PIECE LAYOUT */
+function tr_info() {
+ let text = "";
+ if (game.tr.hand == 1)
+ text += "1 card in hand";
+ else
+ text += game.tr.hand + " cards in hand";
+ text += "\n$" + game.tr.gold;
+ return text;
+}
+
+function us_info() {
+ let text = "";
+ if (game.us.hand == 1)
+ text += "1 card in hand";
+ else
+ text += game.us.hand + " cards in hand";
+ return text;
+}
+
function on_update() {
show_action_button("#button_pass", "pass");
show_action_button("#button_next", "next");
show_action_button("#button_undo", "undo");
- update_year_marker(game.year);
+
+ document.getElementById("tr_info").textContent = tr_info();
+ document.getElementById("us_info").textContent = us_info();
+
+ if (game.card == "United States")
+ document.getElementById("active_card").className = "card show us_card_back";
+ else if (game.card == "Tripolitania")
+ document.getElementById("active_card").className = "card show tr_card_back";
+ else if (game.card < 27)
+ document.getElementById("active_card").className = "card show us_card_" + game.card;
+ else
+ document.getElementById("active_card").className = "card show tr_card_" + (game.card-27);
+
update_season_marker(game.season);
- update_pieces(game.location);
update_pieces();
update_cards();
update_spaces();