summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js36
1 files changed, 35 insertions, 1 deletions
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) {