summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js77
1 files changed, 54 insertions, 23 deletions
diff --git a/rules.js b/rules.js
index 1f7b93d..ae2aa02 100644
--- a/rules.js
+++ b/rules.js
@@ -1627,7 +1627,7 @@ states.take_actions = {
gen_action_governor(id)
break
case AVAILABLE:
- if (sip >= 1 || has_unused_praetorian_guard())
+ if (sip >= 1)
gen_action_governor(id)
break
default:
@@ -2213,6 +2213,7 @@ states.place_governor = {
votes += count_own_basilicas()
view.color = SENATE
view.selected_region = game.where
+ view.selected_governor = game.selected_governor
prompt(`Place Governor: ${sip} Senate. Rolling ${votes} dice. ${need} votes needed.`)
if (sip >= 1)
view.actions.spend_senate = 1
@@ -2239,6 +2240,7 @@ states.praetorian_guard = {
votes += count_own_basilicas()
view.color = MILITARY
view.selected_region = game.where
+ view.selected_governor = game.selected_governor
prompt(`Praetorian Guard: ${mip} Military. Rolling ${votes} dice. ${need} votes needed.`)
if (mip >= 1)
view.actions.spend_military = 1
@@ -2351,36 +2353,66 @@ states.damnatio_memoriae_mobs = {
// ACTION: PRAETORIAN GUARD
-function has_unused_praetorian_guard() {
- return game.ip[MILITARY] >= 1 && !is_emperor_player() && !has_placed_governor(ITALIA) && has_praetorian_guard_card()
-}
-
-function has_praetorian_guard_card() {
- let played = false
- let used = false
- for (let c of game.played)
- if (c >= CARD_M4[0] && c <= CARD_M4[1])
- played = true
- for (let c of game.used)
- if (c >= CARD_M4[0] && c <= CARD_M4[1])
- used = true
- return played && !used
-}
-
function can_play_praetorian_guard() {
- // TODO: select governor after playing praetorian guard?
- if (game.selected_governor >= 0 && get_governor_location(game.selected_governor) === AVAILABLE)
- return game.ip[MILITARY] >= 1 && !is_emperor_player() && !has_placed_governor(ITALIA)
+ for (let i = 0; i < 6; ++i) {
+ let id = game.current * 6 + i
+ if (get_governor_location(id) === AVAILABLE)
+ return game.ip[MILITARY] >= 1 && !is_emperor_player() && !has_placed_governor(ITALIA)
+ }
return false
}
-function play_praetorian_guard() {
+function play_praetorian_guard_auto() {
+ game.selected_general = -1
+ if (game.selected_governor < 0 || get_governor_location(game.selected_governor) !== AVAILABLE) {
+ for (let i = 0; i < 6; ++i) {
+ let id = game.current * 6 + i
+ if (get_governor_location(id) === AVAILABLE)
+ game.selected_governor = id
+ }
+ }
spend_military(1)
- game.count = 0
+ game.count = 1
game.where = ITALIA
game.state = "praetorian_guard"
}
+function play_praetorian_guard() {
+ game.state = "praetorian_guard_governor"
+}
+
+states.praetorian_guard_governor = {
+ prompt() {
+ prompt("Praetorian Guard: Choose an available governor to place in Italia.")
+ for (let i = 0; i < 6; ++i) {
+ let id = game.current * 6 + i
+ if (get_governor_location(id) === AVAILABLE)
+ gen_action_governor(id)
+ }
+ },
+ governor(id) {
+ push_undo()
+ game.selected_governor = id
+ game.selected_general = -1
+ game.state = "praetorian_guard_italia"
+ },
+}
+
+states.praetorian_guard_italia = {
+ prompt() {
+ prompt("Praetorian Guard: Place governor in Italia.")
+ view.color = MILITARY
+ gen_action_region(ITALIA)
+ },
+ region(where) {
+ push_undo()
+ spend_military(1)
+ game.count = 1
+ game.where = ITALIA
+ game.state = "praetorian_guard"
+ },
+}
+
// ACTION: CREATE ARMY
function gen_create_army() {
@@ -4014,7 +4046,6 @@ exports.setup = function (seed, scenario, options) {
game.hand[player] = []
game.draw[player] = setup_player_deck(player)
game.discard[player] = []
- // for (let i = 0; i < 9; ++i) set_add(game.draw[player], game.market[i].pop())
}
update_neutral_italia()