diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-07-10 22:52:15 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-10 22:52:15 +0200 |
commit | 176078f3f16a6747532d7b18c3032250488f1e00 (patch) | |
tree | f852bfa69c265b6c093e45a7684a09609fd9b751 /rules.js | |
parent | 84c2f1a2c5b13e97d5115a8c0f1bd9d10879f3e1 (diff) | |
download | time-of-crisis-176078f3f16a6747532d7b18c3032250488f1e00.tar.gz |
Fix Mobile Vulgus. Check room for Build Improvement button.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -637,6 +637,8 @@ function find_unused_legion() { } function can_build_improvement(province) { + if (has_amphitheater(province) && has_basilica(province) && has_limes(province)) + return false if (get_mobs(province)) return false if (has_active_barbarians(province)) @@ -2346,6 +2348,16 @@ function count_units_in_capital(where) { return n } +function count_owner_units_in_capital(where) { + let n = 0 + let army = get_capital_general(where) + if (army < 0 || (army / 6 | 0) === get_province_player(where)) + n += count_units_in_army(army) + if (has_militia(where)) + n += 1 + return n +} + function calc_needed_votes(praetorian_guard) { let n = get_support(game.where) * 2 // base number of votes let old_governor = get_province_governor(game.where) @@ -3553,7 +3565,7 @@ states.frumentarii = { function can_play_mobile_vulgus() { for (let where = 0; where < 12; ++where) { if (is_enemy_province(where)) { - let n = get_support(where) + count_units_in_capital(where) + let n = get_support(where) + count_owner_units_in_capital(where) if (game.pip >= n) return true } @@ -3572,7 +3584,7 @@ states.mobile_vulgus_where = { view.color = POPULACE for (let where = 0; where < 12; ++where) { if (is_enemy_province(where)) { - let n = get_support(where) + count_units_in_capital(where) + let n = get_support(where) + count_owner_units_in_capital(where) if (game.pip >= n) gen_action_region(where) } @@ -3589,7 +3601,7 @@ states.mobile_vulgus = { inactive: "Mobile Vulgus", prompt() { prompt("Mobile Vulgus: " + game.pip + " populace. Reduce support in " + REGION_NAME[game.where] + ".") - let n = get_support(game.where) + count_units_in_capital(game.where) + let n = get_support(game.where) + count_owner_units_in_capital(game.where) if (game.pip >= n) gen_action_support(game.where, get_support(game.where) - 1) view.actions.done = 1 @@ -3597,10 +3609,10 @@ states.mobile_vulgus = { support() { push_undo() log("Reduced support level.") - let n = get_support(game.where) + count_units_in_capital(game.where) - spend_populace(n) + let n = count_owner_units_in_capital(game.where) + spend_populace(get_support(game.where) + n) reduce_support(game.where) - if (is_neutral_province(game.where)) + if (is_neutral_province(game.where) || game.pip < get_support(game.where) + n) resume_take_actions() }, done() { @@ -4501,6 +4513,7 @@ states.advance_after_combat = { inactive: "Combat", prompt() { prompt("Combat: You may advance into provincial capital.") + view.selected_general = game.selected_general gen_action_capital(game.where) view.actions.pass = 1 }, @@ -4607,6 +4620,7 @@ states.triumph = { inactive: "Combat", prompt() { prompt("Combat: You may play Triumph.") + view.selected_general = game.selected_general gen_card_event(CARD_S4X) view.actions.pass = 1 }, |