summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-06-22 23:29:00 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-07 18:39:37 +0200
commit1c5341697eb1bd41dd05e97a75c88fa461323a74 (patch)
treef9630ca6cf6865d66f0ff54a96f9ec737c46ca3b /rules.js
parentb83c7f35103b43a9fae4ba9b0d4b98bd95a745b1 (diff)
downloadtime-of-crisis-1c5341697eb1bd41dd05e97a75c88fa461323a74.tar.gz
Pretender (expand).
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js76
1 files changed, 56 insertions, 20 deletions
diff --git a/rules.js b/rules.js
index d407d32..2abc607 100644
--- a/rules.js
+++ b/rules.js
@@ -49,13 +49,13 @@ game.battle -> game.battle / game.count + game.where
[x] praetorian guard
[ ] damnatio memoriae
-[ ] pretender
- [ ] place
+[x] pretender
+ [x] place
[ ] expand
- [ ] scoring effects
+ [x] scoring effects
[ ] occupation effects
-[ ] game end
+[x] game end
[ ] rival emperors
[ ] emperor turns
@@ -1000,6 +1000,33 @@ function assign_hit_to_legion(id) {
}
}
+function is_pretender_province(where) {
+ return is_breakaway(where) || is_seat_of_power(where)
+}
+
+function find_seat_of_power() {
+ for (let where = 1; where < 12; ++where)
+ if (is_seat_of_power(where) && is_own_province(where))
+ return where
+ return -1
+}
+
+function is_possible_seat_of_power(from) {
+ if (is_own_province(from) && get_support(from) >= 3)
+ for (let to of ADJACENT[from])
+ if (is_own_province(to) && get_support(to) >= 3)
+ return true
+ return false
+}
+
+function is_expand_pretender_province(from) {
+ if (get_support(from) >= 3 && !is_pretender_province(from) && is_own_province(from))
+ for (let to of ADJACENT[from])
+ if (is_pretender_province(to) && is_own_province(to))
+ return true
+ return false
+}
+
// === SETUP ===
states.setup_province = {
@@ -1086,6 +1113,7 @@ function goto_upkeep() {
// === CRISIS ===
function goto_crisis() {
+ game.crisis = -1
game.dice[0] = roll_die()
game.dice[1] = roll_die()
game.dice[2] = 0
@@ -1904,6 +1932,7 @@ states.move_army_at_sea = {
prompt() {
let [ mip, sip, pip ] = game.ip
prompt("Move Army.")
+ view.color = MILITARY
view.selected_general = game.selected_general
gen_move_army()
},
@@ -2107,21 +2136,6 @@ states.mob = {
// CARD: PRETENDER
-function find_seat_of_power() {
- for (let where = 1; where < 12; ++where)
- if (is_seat_of_power(where) && is_own_province(where))
- return where
- return -1
-}
-
-function is_possible_seat_of_power(from) {
- if (is_own_province(from) && get_support(from) >= 3)
- for (let to of ADJACENT[from])
- if (is_own_province(to) && get_support(to) >= 3)
- return true
- return false
-}
-
function can_play_pretender() {
if (is_emperor_player())
return false
@@ -2718,7 +2732,7 @@ states.support_check_emperor = {
prompt() {
prompt("Support Check: Reduce support in Italia for Rival Emperor and/or Pretender.")
view.color = POPULACE
- gen_action_region(where)
+ gen_action_region(ITALIA)
},
region(where) {
push_undo()
@@ -2759,9 +2773,31 @@ states.support_check_mobs = {
// === EXPAND PRETENDER EMPIRE ===
function goto_expand_pretender_empire() {
+ for (let where = 1; where < 12; ++where) {
+ if (is_expand_pretender_province(where)) {
+ game.state = "expand_pretender_empire"
+ return
+ }
+ }
goto_gain_legacy()
}
+states.expand_pretender_empire = {
+ prompt() {
+ prompt("Expand Pretender Empire!")
+ view.color = POPULACE
+ for (let where = 1; where < 12; ++where)
+ if (is_expand_pretender_province(where))
+ gen_action_region(where)
+ },
+ region(where) {
+ push_undo()
+ add_breakaway(where)
+ remove_quaestor(where) // no effect anymore
+ goto_expand_pretender_empire()
+ },
+}
+
// === GAIN LEGACY ===
function goto_gain_legacy() {