summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-18 21:40:12 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-18 21:40:12 +0200
commite3c19854fc127277f3f4571501357b7a3cf3a4f7 (patch)
tree1615bb1f5f675c8fedd302a2a85fc3d9e073521f /rules.ts
parentf777019e0c3f992965a4aad04862d1a19540a3f3 (diff)
downloadplantagenet-e3c19854fc127277f3f4571501357b7a3cf3a4f7.tar.gz
Fix Great Ships connecting all seas for Disembark (it shouldn't).
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/rules.ts b/rules.ts
index a24eb9a..4c515af 100644
--- a/rules.ts
+++ b/rules.ts
@@ -565,9 +565,11 @@ function is_adjacent(a: Locale, b: Locale) {
function find_ports(here: Locale, lord: Lord): Locale[] {
- // TODO: verify which lord is being passed in every place
- if ((lord_has_capability(lord, AOW_YORK_GREAT_SHIPS) || lord_has_capability(lord, AOW_LANCASTER_GREAT_SHIPS)))
- return data.all_ports
+ // for Parley, Supply, and Tax purposes only (not Disembark)
+ if (lord !== NOBODY) {
+ if ((lord_has_capability(lord, AOW_YORK_GREAT_SHIPS) || lord_has_capability(lord, AOW_LANCASTER_GREAT_SHIPS)))
+ return data.all_ports
+ }
if (here === data.sea_1) return data.port_1
if (here === data.sea_2) return data.port_2
@@ -7984,8 +7986,8 @@ function do_disembark() {
return success
}
-function has_safe_ports(sea: Locale, lord: Lord) {
- for (let loc of find_ports(sea, lord))
+function has_safe_ports(sea: Locale) {
+ for (let loc of find_ports(sea, NOBODY))
if (!has_enemy_lord(loc))
return true
return false
@@ -8004,8 +8006,7 @@ states.disembark = {
}
}
} else {
- let sea = get_lord_locale(game.who)
- for (let loc of find_ports(sea, game.who))
+ for (let loc of find_ports(get_lord_locale(game.who), NOBODY))
if (!has_enemy_lord(loc))
gen_action_locale(loc)
}
@@ -8015,7 +8016,7 @@ states.disembark = {
},
lord(lord) {
if (do_disembark()) {
- if (has_safe_ports(get_lord_locale(lord), lord)) {
+ if (has_safe_ports(get_lord_locale(lord))) {
game.who = lord
} else {
no_safe_disembark(lord)