summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-09 16:50:36 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-09 16:53:42 +0200
commitcc11c3552042118ce631c3c1541efe298df92e8c (patch)
tree5c0f1d9d9afa45b1620f2cfb122eba41e6174048
parentaaf26d90cfac2897a06e1203ee8087cabc3a6429 (diff)
downloadplantagenet-cc11c3552042118ce631c3c1541efe298df92e8c.tar.gz
fix route search for tax and supply (missing no enemy lord checks)
-rw-r--r--rules.js8
-rw-r--r--rules.ts8
2 files changed, 8 insertions, 8 deletions
diff --git a/rules.js b/rules.js
index 7d1552e..0f6a879 100644
--- a/rules.js
+++ b/rules.js
@@ -3263,7 +3263,7 @@ states.command = {
*/
function can_supply_at(source, ships) {
// if theoretically possible to supply from this source (does not check carts or ships)
- if (is_stronghold(source) && is_friendly_locale(source)) {
+ if (is_stronghold(source) && is_friendly_locale(source) && !has_enemy_lord(source)) {
if (ships > 0 && is_seaport(source))
return true;
if (!has_exhausted_marker(source))
@@ -3286,7 +3286,7 @@ function search_supply_by_way(result, start, carts, ships) {
else
return true;
}
- if (is_friendly_locale(here)) {
+ if (is_friendly_locale(here) && !has_enemy_lord(here)) {
if ((next_dist >> 3) <= carts) {
for (let next of data.locales[here].adjacent) {
if (!search_seen[next]) {
@@ -3763,7 +3763,7 @@ function end_forage() {
}
// === 4.6.3 ACTION: TAX ===
function can_tax_at(here, lord) {
- if (is_friendly_locale(here) && !has_exhausted_marker(here)) {
+ if (is_friendly_locale(here) && !has_enemy_lord(here) && !has_exhausted_marker(here)) {
// London, Calais, and Harlech
if (here === LOC_LONDON || here === LOC_CALAIS || here === LOC_HARLECH)
return true;
@@ -3795,7 +3795,7 @@ function search_tax(result, start, lord, ships) {
else
return true;
}
- if (is_friendly_locale(here)) {
+ if (is_friendly_locale(here) && !has_enemy_lord(here)) {
for (let next of data.locales[here].adjacent) {
if (!search_seen[next]) {
search_seen[next] = 1;
diff --git a/rules.ts b/rules.ts
index 4aad144..62ed47d 100644
--- a/rules.ts
+++ b/rules.ts
@@ -3983,7 +3983,7 @@ states.command = {
function can_supply_at(source: Locale, ships: number) {
// if theoretically possible to supply from this source (does not check carts or ships)
- if (is_stronghold(source) && is_friendly_locale(source)) {
+ if (is_stronghold(source) && is_friendly_locale(source) && !has_enemy_lord(source)) {
if (ships > 0 && is_seaport(source))
return true
if (!has_exhausted_marker(source))
@@ -4010,7 +4010,7 @@ function search_supply_by_way(result, start: Locale, carts: number, ships: numbe
return true
}
- if (is_friendly_locale(here)) {
+ if (is_friendly_locale(here) && !has_enemy_lord(here)) {
if ((next_dist >> 3) <= carts) {
for (let next of data.locales[here].adjacent) {
if (!search_seen[next]) {
@@ -4557,7 +4557,7 @@ function end_forage() {
// === 4.6.3 ACTION: TAX ===
function can_tax_at(here: Locale, lord: Lord) {
- if (is_friendly_locale(here) && !has_exhausted_marker(here)) {
+ if (is_friendly_locale(here) && !has_enemy_lord(here) && !has_exhausted_marker(here)) {
// London, Calais, and Harlech
if (here === LOC_LONDON || here === LOC_CALAIS || here === LOC_HARLECH)
return true
@@ -4596,7 +4596,7 @@ function search_tax(result, start: Locale, lord: Lord, ships: boolean) {
return true
}
- if (is_friendly_locale(here)) {
+ if (is_friendly_locale(here) && !has_enemy_lord(here)) {
for (let next of data.locales[here].adjacent) {
if (!search_seen[next]) {
search_seen[next] = 1