diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-05-08 13:20:09 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-05-08 13:20:19 +0200 |
commit | aaf26d90cfac2897a06e1203ee8087cabc3a6429 (patch) | |
tree | dbd793265836b9f58d2b4d0dc84b45dd5d6617c8 | |
parent | d2a86b6d1adca8e9f0efbfd130108da1de791bf2 (diff) | |
download | plantagenet-aaf26d90cfac2897a06e1203ee8087cabc3a6429.tar.gz |
keep exile status when shifting lords on calendar
-rw-r--r-- | rules.js | 18 | ||||
-rw-r--r-- | rules.ts | 19 |
2 files changed, 19 insertions, 18 deletions
@@ -815,6 +815,12 @@ function set_lord_calendar(lord, turn) { turn = 16; set_lord_locale(lord, CALENDAR + turn); } +function set_lord_calendar_keep_exile(lord, turn) { + let x = is_lord_in_exile(lord); + set_lord_calendar(lord, turn); + if (x) + set_lord_in_exile(lord); +} function set_lord_in_exile(lord) { let turn = get_lord_calendar(lord); set_lord_locale(lord, CALENDAR_EXILE + turn); @@ -8418,18 +8424,12 @@ function foreign_haven_shift_lords() { let turn = current_turn(); for (let lord of all_lancaster_lords) { if (is_lord_on_calendar(lord) && get_lord_calendar(lord) > turn) { - let x = is_lord_in_exile(lord); - set_lord_calendar(lord, turn); - if (x) - set_lord_in_exile(lord); + set_lord_calendar_keep_exile(lord, turn); } } for (let lord of all_york_lords) { if (is_lord_on_calendar(lord) && get_lord_calendar(lord) > turn + 1) { - let x = is_lord_in_exile(lord); - set_lord_calendar(lord, turn + 1); - if (x) - set_lord_in_exile(lord); + set_lord_calendar_keep_exile(lord, turn + 1); } } } @@ -9619,7 +9619,7 @@ states.heralds_attempt = { }, check(spend) { if (roll_influence_check("C" + AOW_LANCASTER_HERALDS + " L" + game.who, game.command, spend)) - set_lord_calendar(game.who, current_turn() + 1); + set_lord_calendar_keep_exile(game.who, current_turn() + 1); end_heralds_attempt(); }, }; @@ -1165,6 +1165,13 @@ function set_lord_calendar(lord: Lord, turn: number) { set_lord_locale(lord, CALENDAR + turn as Locale) } +function set_lord_calendar_keep_exile(lord: Lord, turn: number) { + let x = is_lord_in_exile(lord) + set_lord_calendar(lord, turn) + if (x) + set_lord_in_exile(lord) +} + function set_lord_in_exile(lord: Lord) { let turn = get_lord_calendar(lord) set_lord_locale(lord, CALENDAR_EXILE + turn as Locale) @@ -9878,19 +9885,13 @@ function foreign_haven_shift_lords() { for (let lord of all_lancaster_lords) { if (is_lord_on_calendar(lord) && get_lord_calendar(lord) > turn) { - let x = is_lord_in_exile(lord) - set_lord_calendar(lord, turn) - if (x) - set_lord_in_exile(lord) + set_lord_calendar_keep_exile(lord, turn) } } for (let lord of all_york_lords) { if (is_lord_on_calendar(lord) && get_lord_calendar(lord) > turn + 1) { - let x = is_lord_in_exile(lord) - set_lord_calendar(lord, turn + 1) - if (x) - set_lord_in_exile(lord) + set_lord_calendar_keep_exile(lord, turn + 1) } } } @@ -11156,7 +11157,7 @@ states.heralds_attempt = { }, check(spend) { if (roll_influence_check("C" + AOW_LANCASTER_HERALDS + " L" + game.who, game.command, spend)) - set_lord_calendar(game.who, current_turn() + 1) + set_lord_calendar_keep_exile(game.who, current_turn() + 1) end_heralds_attempt() }, } |