From 78cbb621a1cef47ce2d79b40f5ab2a2c13872a9d Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 6 Jul 2023 22:46:08 +0200 Subject: Format votes as need + have + dice. --- rules.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rules.js b/rules.js index ee82eeb..01c874c 100644 --- a/rules.js +++ b/rules.js @@ -2368,17 +2368,26 @@ function calc_extra_votes(where) { return n } +function format_votes(need, extra, dice) { + let s = "Need " + need + (need === 1 ? " vote." : " votes.") + if (extra > 0) + s += " Have " + extra + (extra === 1 ? " vote." : " votes.") + s += " Rolling " + dice + (dice === 1 ? " die." : " dice.") + return s +} + states.place_governor = { inactive: "Place Governor", prompt() { - let need = Math.max(0, calc_needed_votes(game.where, false) - calc_extra_votes(game.where)) + 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() view.color = SENATE view.selected_region = game.where view.selected_governor = game.selected_governor - prompt(`Place Governor: ${game.sip} senate. Rolling ${dice} dice. ${need} votes needed.`) + prompt("Place Governor: " + game.sip + " senate. " + format_votes(need, extra, dice)) if (game.ambitus < game.count && has_card_event(CARD_P2X)) { view.prompt += " Ambitus?" gen_card_event(CARD_P2X) @@ -2408,14 +2417,15 @@ states.place_governor = { states.praetorian_guard = { inactive: "Praetorian Guard", prompt() { - let need = Math.max(0, calc_needed_votes(game.where, true) - calc_extra_votes(game.where)) + 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() view.color = MILITARY view.selected_region = game.where view.selected_governor = game.selected_governor - prompt(`Praetorian Guard: ${game.mip} military. Rolling ${dice} dice. ${need} votes needed.`) + prompt("Praetorian Guard: " + game.mip + " military. " + format_votes(need, extra, dice)) if (game.ambitus < game.count && has_card_event(CARD_P2X)) { view.prompt += " Ambitus?" gen_card_event(CARD_P2X) -- cgit v1.2.3