summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--info/readme.html8
-rw-r--r--play.js1
-rw-r--r--rules.js140
3 files changed, 112 insertions, 37 deletions
diff --git a/info/readme.html b/info/readme.html
index ef978f0..e8ed05a 100644
--- a/info/readme.html
+++ b/info/readme.html
@@ -27,6 +27,14 @@ Don't forget to spend enough senate influence points before rolling the dice!
<hr>
<p>
+What does the "Automatic" button do during the Place Governor action?
+<p>
+It spends enough influence to guarantee success, and then places the governor
+without rolling the dice (so that you can still undo if you change your mind).
+This can only be used in neutral provinces where each die is a guaranteed vote.
+
+<hr>
+<p>
How do I take the Create Army action?
<p>
Select an available general and then the province you want to create the army in.
diff --git a/play.js b/play.js
index 9814cba..e538cb9 100644
--- a/play.js
+++ b/play.js
@@ -1508,6 +1508,7 @@ function on_update() {
action_button("enter", "Enter Capital")
action_button("leave", "Leave Capital")
+ action_button("spend_enough", "Automatic")
action_button("spend_military", "Spend Military")
action_button("spend_senate", "Spend Senate")
action_button("reroll", "Reroll")
diff --git a/rules.js b/rules.js
index 76908c5..9101394 100644
--- a/rules.js
+++ b/rules.js
@@ -1221,12 +1221,13 @@ states.setup_province = {
states.setup_hand = {
inactive: "Setup",
prompt() {
- prompt("Setup: Draw cards.")
let hand = current_hand()
if (hand.length < 5) {
+ prompt("Setup: Draw cards.")
for (let c of current_draw())
gen_action_card(c)
} else {
+ prompt("Setup: Done.")
view.actions.done = 1
}
},
@@ -2339,12 +2340,12 @@ function count_units_in_capital(where) {
return n
}
-function calc_needed_votes(where, pg) {
+function calc_needed_votes(where, praetorian_guard) {
let n = get_support(where) * 2 // base number of votes
let old_governor = get_province_governor(where)
let old_player = (old_governor < 0) ? -1 : (old_governor / 6 | 0)
// Praetorian Guard ignores units in capital
- if (!pg) {
+ if (!praetorian_guard) {
let army_general = get_capital_general(where)
if (army_general >= 0) {
let army_player = army_general / 6 | 0
@@ -2370,6 +2371,13 @@ function calc_extra_votes(where) {
return n
}
+function calc_used_dice(where) {
+ let dice = game.count
+ if (game.where === ITALIA)
+ dice += count_own_basilicas()
+ return dice
+}
+
function format_votes(need, extra, dice) {
let s = "Need " + need + (need === 1 ? " vote." : " votes.")
if (extra > 0)
@@ -2383,9 +2391,7 @@ states.place_governor = {
prompt() {
let need = calc_needed_votes(game.where, false)
let extra = calc_extra_votes(game.where)
- let dice = game.count
- if (game.where === ITALIA)
- dice += count_own_basilicas()
+ let dice = calc_used_dice(game.where)
view.color = SENATE
view.selected_region = game.where
view.selected_governor = game.selected_governor
@@ -2398,6 +2404,13 @@ states.place_governor = {
view.actions.spend_senate = 1
else
view.actions.spend_senate = 0
+ if (is_neutral_province(game.where)) {
+ let enough = Math.max(0, need - extra - dice)
+ if (game.sip >= enough)
+ view.actions.spend_enough = 1
+ else
+ view.actions.spend_enough = 0
+ }
view.actions.roll = 1
},
card(c) {
@@ -2410,6 +2423,16 @@ states.place_governor = {
spend_senate(1)
game.count += 1
},
+ spend_enough() {
+ push_undo()
+ let need = calc_needed_votes(game.where, false)
+ let extra = calc_extra_votes(game.where)
+ let dice = calc_used_dice(game.where)
+ let enough = Math.max(0, need - extra - dice)
+ spend_senate(enough)
+ game.count += enough
+ auto_replace_neutral_governor(false)
+ },
roll() {
clear_undo()
roll_to_place_governor()
@@ -2421,9 +2444,7 @@ states.praetorian_guard = {
prompt() {
let need = calc_needed_votes(game.where, true)
let extra = calc_extra_votes(game.where)
- let dice = game.count
- if (game.where === ITALIA)
- dice += count_own_basilicas()
+ let dice = calc_used_dice(game.where)
view.color = MILITARY
view.selected_region = game.where
view.selected_governor = game.selected_governor
@@ -2436,6 +2457,13 @@ states.praetorian_guard = {
view.actions.spend_military = 1
else
view.actions.spend_military = 0
+ if (is_neutral_province(game.where)) {
+ let enough = Math.max(0, need - extra - dice)
+ if (game.mip >= enough)
+ view.actions.spend_enough = 1
+ else
+ view.actions.spend_enough = 0
+ }
view.actions.roll = 1
},
card(c) {
@@ -2448,24 +2476,31 @@ states.praetorian_guard = {
spend_military(1)
game.count += 1
},
+ spend_enough() {
+ push_undo()
+ let need = calc_needed_votes(game.where, true)
+ let extra = calc_extra_votes(game.where)
+ let dice = calc_used_dice(game.where)
+ let enough = Math.max(0, need - extra - dice)
+ spend_military(enough)
+ game.count += enough
+ auto_replace_neutral_governor(true)
+ },
roll() {
clear_undo()
roll_to_place_governor()
},
}
-function roll_to_place_governor(pg) {
- let need = calc_needed_votes(game.where, pg)
+function roll_to_place_governor(praetorian_guard) {
+ let need = calc_needed_votes(game.where, praetorian_guard)
let have = calc_extra_votes(game.where)
+ let dice = calc_used_dice(game.where)
set_placed_governor(game.where)
- if (game.where === ITALIA)
- game.count += count_own_basilicas()
-
-
log_br()
- if (pg)
+ if (praetorian_guard)
log("Praetorian Guard in %" + game.where + ".")
else
log("Place Governor in %" + game.where + ".")
@@ -2476,11 +2511,11 @@ function roll_to_place_governor(pg) {
log("Need " + need + " votes.")
if (is_neutral_province(game.where))
- have += roll_dice(game.count, 1)
- else if (!pg && has_quaestor(game.where))
- have += roll_dice(game.count, 3)
+ have += roll_dice(dice, 1)
+ else if (!praetorian_guard && has_quaestor(game.where))
+ have += roll_dice(dice, 3)
else
- have += roll_dice(game.count, 2)
+ have += roll_dice(dice, 2)
if (game.where === ITALIA && is_populace_emperor()) {
log("Populace Emperor")
@@ -2493,27 +2528,57 @@ function roll_to_place_governor(pg) {
}
if (have >= need) {
- if (game.where === ITALIA) {
- // Remember for Damnatio Memoriae
- let was_senate_emperor = is_senate_emperor()
- let old_emperor = get_province_player(ITALIA)
- let old_support = get_support(ITALIA)
+ goto_place_governor_success()
+ } else {
+ log("Failed!")
+ log_br()
+ resume_take_actions()
+ }
+}
+
+function auto_replace_neutral_governor(praetorian_guard) {
+ let need = calc_needed_votes(game.where, praetorian_guard)
+ let have = calc_extra_votes(game.where)
+ let dice = calc_used_dice(game.where)
- place_governor(game.where, game.selected_governor)
+ log_br()
+ if (praetorian_guard)
+ log("Praetorian Guard in %" + game.where + ".")
+ else
+ log("Place Governor in %" + game.where + ".")
- if (old_emperor >= 0 && !was_senate_emperor && (has_card_event(CARD_S4) || has_card_event(CARD_S4B))) {
- game.count = (old_emperor << 3) | old_support
- game.state = "damnatio_memoriae"
- } else {
- goto_becoming_emperor()
- }
+ if (need === 1)
+ log("Need " + need + " vote.")
+ else
+ log("Need " + need + " votes.")
+
+ logi(new Array(dice).fill("B0").join(" "))
+
+ if (game.ambitus > 0) {
+ log("Ambitus")
+ logi(new Array(game.ambitus).fill("B0").join(" "))
+ }
+
+ goto_place_governor_success()
+}
+
+function goto_place_governor_success() {
+ if (game.where === ITALIA) {
+ // Remember for Damnatio Memoriae
+ let was_senate_emperor = is_senate_emperor()
+ let old_emperor = get_province_player(ITALIA)
+ let old_support = get_support(ITALIA)
+
+ place_governor(game.where, game.selected_governor)
+
+ if (old_emperor >= 0 && !was_senate_emperor && (has_card_event(CARD_S4) || has_card_event(CARD_S4B))) {
+ game.count = (old_emperor << 3) | old_support
+ game.state = "damnatio_memoriae"
} else {
- place_governor(game.where, game.selected_governor)
- resume_take_actions()
+ goto_becoming_emperor()
}
} else {
- log("Failed!")
- log_br()
+ place_governor(game.where, game.selected_governor)
resume_take_actions()
}
}
@@ -5033,16 +5098,17 @@ function goto_refill_hand() {
states.refill_hand = {
inactive: "End of Turn",
prompt() {
- prompt("End of Turn: Draw cards.")
let hand = current_hand()
let draw = current_draw()
let n = 5
if (game.frumentarii & (1 << game.current))
n = 3
if (hand.length < n && draw.length > 0) {
+ prompt("End of Turn: Draw cards.")
for (let c of draw)
gen_action_card(c)
} else {
+ prompt("End of Turn: Done.")
view.actions.end_turn = 1
}
},