From 0dd8ed93c2b7486888f63dbd5a5afd31e319dc70 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 3 Aug 2023 01:57:34 +0200 Subject: Occupy Pretender Capital at start of turn. --- rules.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/rules.js b/rules.js index 2c3903f..6747869 100644 --- a/rules.js +++ b/rules.js @@ -1831,12 +1831,23 @@ function goto_take_actions() { game.count = 2 game.state = "frumentarii" resume_frumentarii() + } else { + resume_take_actions() } } +function is_occupied_pretender_capital(where) { + return is_pretender_province(where) && !is_own_province(where) && is_own_general(get_capital_general(where)) +} + function resume_take_actions() { game.state = "take_actions" + // Check if we occupy any pretender provinces + for (let where = 0; where < 12; ++where) + if (is_occupied_pretender_capital(where)) + game.state = "occupy_pretender_capital" + // If used Foederati (or other events) at sea if (game.selected_general && is_sea(get_general_location(game.selected_general))) game.state = "move_army_at_sea" @@ -2944,6 +2955,35 @@ function enter_capital() { resume_take_actions() } +// OCCUPATION OF A PRETENDER PROVINCIAL CAPITAL + +states.occupy_pretender_capital = { + prompt() { + prompt("Occupation of a Pretender Provincial Capital: Remove seat of power and breakaway markers and governor.") + view.color = POPULACE + for (let where = 0; where < 12; ++where) + if (is_occupied_pretender_capital(where)) + gen_action_region(where) + }, + region(where) { + push_undo() + log_h3("Occupied %" + where + ".") + game.where = where + if (is_seat_of_power(where)) { + log("Removed seat of power.") + remove_seat_of_power(where) + remove_governor(where, false) + resume_occupy_seat_of_power() + } else { + game.state = "occupy_breakaway" + log("Removed breakaway.") + remove_breakaway(where) + remove_governor(where, false) + goto_replace_pretender() + } + } +} + function resume_occupy_seat_of_power() { for (let where = 1; where < 12; ++where) { if (is_breakaway(where) && (get_province_governor(where) / 6 | 0) === game.count) { -- cgit v1.2.3