summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-08-03 01:57:34 +0200
committerTor Andersson <tor@ccxvii.net>2023-08-03 01:58:26 +0200
commit0dd8ed93c2b7486888f63dbd5a5afd31e319dc70 (patch)
tree25bd338caaa692881847a0f1a3381aacebbc223d /rules.js
parent618358a8d1d7bbd2fc26ddf99d311e3e610d39f7 (diff)
downloadtime-of-crisis-0dd8ed93c2b7486888f63dbd5a5afd31e319dc70.tar.gz
Occupy Pretender Capital at start of turn.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js40
1 files changed, 40 insertions, 0 deletions
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) {