diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -22,6 +22,23 @@ function toggle_shift() { document.body.classList.toggle("shift") } +function action_menu_item(action) { + let menu = document.getElementById(action + "_menu") + if (view.actions && action in view.actions) { + menu.classList.toggle("disabled", view.actions[action] === 0) + return 1 + } else { + menu.classList.toggle("disabled", true) + return 0 + } +} + +function action_menu(menu, action_list) { + let x = 0 + for (let action of action_list) + x |= action_menu_item(action) +} + /* DATA (SHARED) */ const deck_name = [ "red", "green", "blue", "yellow" ] @@ -1267,6 +1284,11 @@ function on_update() { layout_combat_marker() } + action_menu(document.getElementById("subsidy_menu"), [ + "propose_subsidy", + "cancel_subsidy", + ]) + action_button_with_argument("suit", SPADES, colorize_S) action_button_with_argument("suit", CLUBS, colorize_C) action_button_with_argument("suit", HEARTS, colorize_H) @@ -1287,10 +1309,13 @@ function on_update() { for (let pow of all_powers) action_button_with_argument("power", pow, power_name[pow]) - action_button("reduce", "Reduce") - action_button("offer", "Offer") + action_button("subsidy", "Subsidy") + action_button("cancel", "Cancel") + + action_button("reduce", "Reduce military objectives") + action_button("offer", "Offer peace") action_button("accept", "Accept") - action_button("deny", "Deny") + action_button("refuse", "Refuse") action_button("re_enter", "Re-enter") action_button("force_march", "Force march") |