summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-24 13:45:01 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-24 14:09:34 +0200
commit0d300b3070f51910af34877de9de97d4fa163703 (patch)
treed2e754cc743c14f023d5bdc400da6e6f8f369d62 /play.js
parent72dfc6a21cfbb6904d671ab51da10981a4784d6f (diff)
downloadmaria-0d300b3070f51910af34877de9de97d4fa163703.tar.gz
Create and cancel subsidy contracts.
Diffstat (limited to 'play.js')
-rw-r--r--play.js31
1 files changed, 28 insertions, 3 deletions
diff --git a/play.js b/play.js
index 5e8357f..f3f5630 100644
--- a/play.js
+++ b/play.js
@@ -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")