diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-04-19 22:07:48 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-04-19 22:11:36 +0200 |
commit | 58cdc0c1f5c66869eb776713415f40252b474025 (patch) | |
tree | 7d28555d8d782515ebe90c5704fa70549b7b882b | |
parent | f07b13be470d04b062903e9013335ddd275c7614 (diff) | |
download | plantagenet-58cdc0c1f5c66869eb776713415f40252b474025.tar.gz |
Fix surprise landing (by fixing seaport list).
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | rules.ts | 14 | ||||
-rw-r--r-- | tools/gendata.js | 2 |
3 files changed, 9 insertions, 9 deletions
@@ -1,5 +1,5 @@ const data = { -seaports:[0,1,5,6,14,15,17,19,20,21,22,24,26,35,37,51,52,54,55,56,57,58,59,60], +seaports:[0,1,5,6,14,15,17,19,20,21,22,24,26,35,37,51,52,54,55,56,57], exile_boxes:[52,53,54,55], exile_1:55, exile_2:52, @@ -1706,7 +1706,7 @@ function is_friendly_locale(loc: Locale) { function is_adjacent_friendly_port_english_channel(loc: Locale) { for (let next of data.locales[loc].adjacent) { - if (is_friendly_locale(next) && data.port_2.includes(next)) + if (is_friendly_locale(next) && set_has(data.port_2, next)) return true } return false @@ -2184,7 +2184,7 @@ function goto_pay_troops() { if (is_lord_on_map(lord) && !is_lord_on_calendar(lord) && lord_has_capability(lord, AOW_LANCASTER_MADAME_LA_GRANDE) && - (((is_friendly_locale(here)) && data.port_2.includes(here)) || + (((is_friendly_locale(here)) && set_has(data.port_2, here)) || is_adjacent_friendly_port_english_channel(here))) { add_lord_assets(lord, COIN, 1) } @@ -3191,7 +3191,7 @@ function can_add_troops_irishmen(lord: Lord, locale: Locale) { return ( lord_has_capability(lord, AOW_YORK_IRISHMEN) && !has_exhausted_marker(locale) && - (locale === LOC_IRELAND || !!data.port_3.includes(locale)) + (locale === LOC_IRELAND || !set_has(data.port_3, locale)) ) } @@ -3938,9 +3938,9 @@ function can_action_sail() { if (game.actions === 0) return false - // at a seaport + // at a seaport (or sea) let here = get_lord_locale(game.command) - if (!is_seaport(here)) + if (!is_seaport(here) && !is_sea(here)) return false // with enough ships to carry all the army @@ -5333,7 +5333,7 @@ function add_battle_capability_troops() { is_lord_on_map(lord) && !is_lord_on_calendar(lord) && lord_has_capability(lord, AOW_LANCASTER_PHILIBERT_DE_CHANDEE) && - ((is_friendly_locale(here) && !!data.port_2.includes(here)) || is_adjacent_friendly_port_english_channel(here)) + ((is_friendly_locale(here) && set_has(data.port_2, here)) || is_adjacent_friendly_port_english_channel(here)) ) { add_lord_forces(lord, MEN_AT_ARMS, 2) } @@ -10117,7 +10117,7 @@ function goto_lancaster_event_henrys_proclamation() { function goto_lancaster_event_french_troops() { let can_play = false for (let lord of all_friendly_lords()) { - if (is_lord_on_map(lord) && data.seaports.includes(get_lord_locale(lord))) { + if (is_lord_on_map(lord) && is_seaport(get_lord_locale(lord))) { can_play = true } } diff --git a/tools/gendata.js b/tools/gendata.js index 46f7547..e5a274d 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -788,7 +788,7 @@ let port_3 = ["Bristol","Pembroke","Harlech"].map(name => locmap[name]).sort(cmp let all_ports = [ ...port_1, ...port_2, ...port_3 ].sort(cmpnum) let seaports = [ - "English Channel", "Bamburgh", "Newcastle", "Scarborough", "Ravenspur", "Lynn", "Ipswich", "North Sea", "Burgundy", "Dover", "Hastings", "Calais", "France", "Arundel", "Southampton","Dorchester","Exeter","Plymouth","Truro","Bristol","Pembroke","Harlech", "Ireland", "Irish Sea" + "Bamburgh", "Newcastle", "Scarborough", "Ravenspur", "Lynn", "Ipswich", "Burgundy", "Dover", "Hastings", "Calais", "France", "Arundel", "Southampton","Dorchester","Exeter","Plymouth","Truro","Bristol","Pembroke","Harlech", "Ireland" ].map(name => locmap[name]).sort(cmpnum) let exile_boxes = [ |