diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2024-10-30 16:00:08 -0400 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2024-10-30 16:00:08 -0400 |
commit | ab220ccc9626d55faca2e389190890c193748276 (patch) | |
tree | d4456d2f4a8333eea1b55d555abd970dd3287a03 /rules.js | |
parent | ddb3b77446db8393b5ad8b5270a145b23132f40f (diff) | |
download | vijayanagara-ab220ccc9626d55faca2e389190890c193748276.tar.gz |
Collect.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 36 |
1 files changed, 35 insertions, 1 deletions
@@ -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) { |