diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-07 00:49:36 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:12:42 +0100 |
commit | 25c63103c6d93f793b8c95ed713c27912ae57551 (patch) | |
tree | 2451aeae17f9cd7efc657145807f64dc3c1ef7ca /ui.js | |
parent | 5718d3695e0783ce8695aeb51f3af797d6037e60 (diff) | |
download | shores-of-tripoli-25c63103c6d93f793b8c95ed713c27912ae57551.tar.gz |
tripoli: Pirate raids.
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 34 |
1 files changed, 32 insertions, 2 deletions
@@ -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(); |