summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2024-10-24 21:57:50 -0400
committerJoël Simoneau <simoneaujoel@gmail.com>2024-10-24 21:57:50 -0400
commitdd868f6af39224b8741384ddf05968f6545e425c (patch)
treef9c46e8d4a61ed1b4e109a732316fe4e548b42d7 /play.js
parent9e162f6ec4e9d215b84026f4f5de40a9abedb0f0 (diff)
downloadvijayanagara-dd868f6af39224b8741384ddf05968f6545e425c.tar.gz
Basic Conscript
Diffstat (limited to 'play.js')
-rw-r--r--play.js58
1 files changed, 31 insertions, 27 deletions
diff --git a/play.js b/play.js
index 2dd8d7f..a0f037b 100644
--- a/play.js
+++ b/play.js
@@ -147,28 +147,7 @@ const S_VE_INF_4 = 25
const last_province = S_PUNJAB
-const space_name = [
- "Andhra",
- "Bengal",
- "Gondwana",
- "Gujarat",
- "Jaunpur",
- "Karnataka",
- "Madhyadesh",
- "Maharashtra",
- "Malwa",
- "Orissa",
- "Rajput Kingdoms",
- "Sindh",
- "Tamilakam",
- "Delhi",
- "Mountain Passes",
- "Punjab",
- "Mongol Invaders",
- "DS Available",
- "BK Available",
- "VE Available",
-]
+const space_name = data.space_name
/* LAYOUT DATA */
// :r !node tools/parse-layout.js
@@ -277,25 +256,25 @@ const layout = {
},
"rects": {
"available_boxes": {
- "Mongol Invaders": {
+ "MI_available": {
"x": 24,
"y": 100,
"w": 177,
"h": 110
},
- "DS Available": {
+ "DS_available": {
"x": 796,
"y": 91,
"w": 388,
"h": 223
},
- "BK Available": {
+ "BK_available": {
"x": 21,
"y": 908,
"w": 238,
"h": 224
},
- "VE Available": {
+ "VE_available": {
"x": 21,
"y": 1405,
"w": 239,
@@ -525,7 +504,7 @@ function init_ui() {
ui.unshaded_event.onmouseenter = on_focus_unshaded_event
ui.unshaded_event.onmouseleave = on_focus_this_event
- for (let s = 0; s < 20; ++s) {
+ for (let s = 0; s < 26; ++s) {
let e = null
// provinces
@@ -945,6 +924,10 @@ function on_update() {
layout_pieces(items, xy[0], xy[1], discs, VE)
}
+ if (s <= S_VE_AVAILABLE) {
+ ui.spaces[s].classList.toggle("action", is_action("space", s))
+ ui.spaces[s].classList.toggle("selected", view.where === s)
+ }
}
items.length = 0
@@ -967,8 +950,29 @@ function on_update() {
layout_sop()
+ // Action for pieces
+ if (view.actions && view.actions.piece)
+ for (let i = 0; i < ui.pieces.length; ++i)
+ ui.pieces[i].classList.toggle("action", set_has(view.actions.piece, i))
+ else
+ for (let i = 0; i < ui.pieces.length; ++i)
+ ui.pieces[i].classList.remove("action")
+ for (let i = 0; i < ui.pieces.length; ++i)
+ ui.pieces[i].classList.toggle("selected", view.who === i)
+
+ // SOP buttons
+ action_button("command_decree", "Command & Decree")
+ action_button("event_command", "Event or Command")
+ action_button("lim_command", "Limited Command")
action_button("pass", "Pass")
+ // DS buttons
+ action_button("conscript", "Conscript")
+ action_button("end_conscript", "End Conscript")
+
+ action_button("next", "Next")
+ action_button("undo", "Undo")
+
return