From f944c920db683e2b345b08df55bc51aa35232b77 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 24 Jun 2023 15:38:18 +0200 Subject: Place Governor / Create Army steps. --- play.js | 15 ++++++++------- rules.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 57 insertions(+), 18 deletions(-) diff --git a/play.js b/play.js index f2add88..a860eb3 100644 --- a/play.js +++ b/play.js @@ -1318,6 +1318,12 @@ function on_update() { action_button("play_all", "Play All") + action_button("recruit_general", "Recruit General") + action_button("create_army", "Create Army") + + action_button("recruit_governor", "Recruit Governor") + action_button("place_governor", "Place Governor") + action_button("enter", "Enter Capital") action_button("leave", "Leave Capital") @@ -1326,12 +1332,11 @@ function on_update() { action_button("reroll", "Reroll") action_button("roll", "Roll") - action_button("recall_governor", "Recall Governor") - action_button("disperse_mob", "Disperse Mob") action_button("train_legions", "Train Legions") action_button("add_legion_to_army", "Add Legion to Army") + action_button("recall_governor", "Recall Governor") action_button("hold_games", "Hold Games") action_button("place_militia", "Place Militia") action_button("build_improvement", "Build Improvement") @@ -1340,14 +1345,10 @@ function on_update() { action_button("basilica", "Basilica") action_button("limes", "Limes") - action_button("recruit_general", "Recruit General") - action_button("recruit_governor", "Recruit Governor") - - action_button("keep", "Keep") - action_button("end_actions", "End Actions") action_button("end_turn", "End Turn") + action_button("keep", "Keep") action_button("pass", "Pass") action_button("done", "Done") action_button("undo", "Undo") diff --git a/rules.js b/rules.js index 7ad0685..326cfe8 100644 --- a/rules.js +++ b/rules.js @@ -1707,13 +1707,15 @@ states.take_actions = { // Place Governor if (game.selected_governor >= 0 && where === AVAILABLE) { - gen_place_governor() + view.actions.place_governor = 1 + // gen_place_governor() } // Create Army if (game.selected_general >= 0 && where === AVAILABLE) { if (mip >= 1 && find_unused_legion() >= 0) - gen_create_army() + // gen_create_army() + view.actions.create_army = 1 } // Governor Actions @@ -1900,6 +1902,18 @@ states.take_actions = { recall_governor() }, + place_governor() { + push_undo() + spend_senate(1) + game.count = 1 + game.state = "place_governor_where" + }, + + create_army() { + push_undo() + game.state = "create_army" + }, + support() { push_undo() improve_support() @@ -2170,12 +2184,9 @@ function recall_governor() { // ACTION: PLACE GOVERNOR function gen_place_governor() { - let sip = game.ip[SENATE] - if (sip >= 1) { - for (let where = 0; where < 12; ++where) - if (can_place_governor(where)) - gen_action_region(where) - } + for (let where = 0; where < 12; ++where) + if (can_place_governor(where)) + gen_action_region(where) } function reduce_support(where) { @@ -2259,6 +2270,20 @@ function calc_needed_votes(where, pg) { return Math.max(1, n) } +states.place_governor_where = { + prompt() { + prompt("Place Governor: Choose a province.") + view.color = SENATE + view.selected_governor = game.selected_governor + gen_place_governor() + }, + region(where) { + push_undo() + game.where = where + game.state = "place_governor" + }, +} + states.place_governor = { prompt() { let sip = game.ip[SENATE] @@ -2496,6 +2521,19 @@ function create_army(where) { game.state = "take_actions" } +states.create_army = { + prompt() { + prompt("Create Army: Choose a province you govern.") + view.color = MILITARY + view.selected_general = game.selected_general + gen_create_army() + }, + region(where) { + push_undo() + create_army(where) + }, +} + // ACTION: MOVE ARMY function gen_move_army() { @@ -2566,7 +2604,7 @@ function play_castra() { states.castra = { prompt() { - prompt("Castra: Select an army you command.") + prompt("Castra: Choose an army you command.") for (let where = 0; where < 12; ++where) if (!has_militia_castra(where) && has_lone_militia(where) && is_own_province(where)) gen_action_militia(where) @@ -2605,7 +2643,7 @@ function play_quaestor() { states.quaestor = { prompt() { - prompt("Quaestor: Select a province you govern.") + prompt("Quaestor: Choose a province you govern.") view.color = POPULACE for (let where = 0; where < 12; ++where) if (!has_quaestor(where) && !is_breakaway(where) && !is_seat_of_power(where) && is_own_province(where)) @@ -2712,7 +2750,7 @@ function play_foederati() { states.foederati = { prompt() { - prompt("Foederati: Select an army you command...") + prompt("Foederati: Choose an army you command...") for (let i = 0; i < 6; ++i) { let id = game.current * 6 + i let where = get_general_location(id) -- cgit v1.2.3