summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2024-10-30 16:00:08 -0400
committerJoël Simoneau <simoneaujoel@gmail.com>2024-10-30 16:00:08 -0400
commitab220ccc9626d55faca2e389190890c193748276 (patch)
treed4456d2f4a8333eea1b55d555abd970dd3287a03
parentddb3b77446db8393b5ad8b5270a145b23132f40f (diff)
downloadvijayanagara-ab220ccc9626d55faca2e389190890c193748276.tar.gz
Collect.
-rw-r--r--play.js1
-rw-r--r--rules.js36
2 files changed, 36 insertions, 1 deletions
diff --git a/play.js b/play.js
index 1712cc4..9ac2349 100644
--- a/play.js
+++ b/play.js
@@ -993,6 +993,7 @@ function on_update() {
// Decree buttons
action_button("build", "Build")
+ action_button("collect", "Collect")
action_button("tax", "Tax")
action_button("trade", "Trade")
diff --git a/rules.js b/rules.js
index 536663b..5ed5bd3 100644
--- a/rules.js
+++ b/rules.js
@@ -219,6 +219,7 @@ exports.setup = function (seed, scenario, _options) {
// Setup
setup_standard()
+ update_control()
setup_deck()
@@ -372,6 +373,11 @@ function goto_build() {
game.state = "build"
}
+function goto_collect() {
+ init_command("Collect")
+ game.state = "collect"
+}
+
function goto_conscript() {
init_command("Conscript")
game.state = "conscript"
@@ -505,6 +511,7 @@ states.command_decree = {
gen_any_decree()
},
build: goto_build,
+ collect: goto_collect,
conscript: goto_conscript,
march: goto_march,
rally: goto_rally,
@@ -562,9 +569,25 @@ states.build = {
game.decree = 0
game.state = "command_decree"
}
+}
+states.collect = {
+ // TODO : Add horses logic to trade
+ prompt() {
+ view.prompt = `Collect tribute: Collect ${collect_count()} from half the Tributaries prosperity`
+
+ gen_action_resources(DS)
+ },
+ resources(f) {
+ let c = collect_count()
+ add_resources(DS, c)
+ logi_resources(DS, c)
+ game.decree = 0
+ game.state = "command_decree"
+ }
}
+
states.conscript = {
prompt() {
view.prompt = "Conscript: Select Tributaries, Qasbah or Dehli to place troops."
@@ -803,6 +826,17 @@ function conscript_count() {
return 1
}
+function can_collect() {
+ return collect_count() > 0
+}
+
+function collect_count() {
+ console.log(game.prosperity)
+ let c = Math.floor(game.prosperity[DS])
+ console.log("Collect count ", c)
+ return Math.floor(game.prosperity[0] / 2)
+}
+
function can_march() {
for (let s = first_space; s <= last_space; ++s)
if (can_march_in_space(s))
@@ -878,7 +912,7 @@ function end_command() {
function gen_any_decree() {
if (game.current === DS) {
- // view.actions.collect = can_collect() ? 1 : 0
+ view.actions.collect = can_collect() ? 1 : 0
// view.actions.campaign = can_campaign() ? 1 : 0
// view.actions.demand = can_demand() ? 1 : 0
} else if (game.current === BK) {