diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 36 |
1 files changed, 35 insertions, 1 deletions
@@ -450,6 +450,11 @@ function goto_tax() { game.state = "tax" } +function goto_trade() { + init_command("Trade") + game.state = "trade" +} + /* STATES */ states.eligible = { @@ -505,6 +510,7 @@ states.command_decree = { rally: goto_rally, rebel: goto_rebel, tax: goto_tax, + trade: goto_trade, } states.event_command = { @@ -726,6 +732,23 @@ states.tax = { } } +states.trade = { + // TODO : Add horses logic to trade + prompt() { + view.prompt = `Trade: Collect ${trade_count()} from Provinces with your presence` + + gen_action_resources(BK) + }, + resources(f) { + let t = trade_count() + add_resources(game.current, t) + logi_resources(BK, t) + game.decree = 0 + game.state = "command_decree" + } +} + + /* COMMANDS */ function init_command(type) { @@ -859,7 +882,7 @@ function gen_any_decree() { // view.actions.campaign = can_campaign() ? 1 : 0 // view.actions.demand = can_demand() ? 1 : 0 } else if (game.current === BK) { - // view.actions.trade = can_trade() ? 1 : 0 + view.actions.trade = can_trade() ? 1 : 0 view.actions.build = can_build() ? 1 : 0 // view.actions.conspire = can_conspire() ? 1 : 0 } else if (game.current === VE) { @@ -885,6 +908,17 @@ function tax_count() { return count_pieces_on_map(VE, DISC) + game.prosperity[VE] } +function can_trade() { + return trade_count() > 0 +} + +function trade_count() { + let count = 0 + for (let s = first_space; s <= last_province; ++s) + count += (count_pieces(s, BK, DISC) + count_pieces(s, BK, ELITE)) > 0 ? 1 : 0 + return count +} + /* TRIBUTARY AND REBELS */ function add_tributary(s) { |