From 1c5341697eb1bd41dd05e97a75c88fa461323a74 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 22 Jun 2023 23:29:00 +0200 Subject: Pretender (expand). --- rules.js | 76 +++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 20 deletions(-) (limited to 'rules.js') 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() { -- cgit v1.2.3