summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-12-02 11:28:19 +0100
committerTor Andersson <tor@ccxvii.net>2024-12-02 11:28:19 +0100
commit72595561e3c14688b285e59511aecb50b47e9f0d (patch)
tree76e1d8fcb7eb80be8cd5c78315c3a6068dee6741 /rules.js
parent33c73232d062f0d5a1a58979a0518947769ecb3b (diff)
downloadplantagenet-72595561e3c14688b285e59511aecb50b47e9f0d.tar.gz
Supply from Exile Box to Port on same sea should not count distance.
... don't need to haul from the port on the same sea back to scotland!
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/rules.js b/rules.js
index 73a5cc3..7c04f26 100644
--- a/rules.js
+++ b/rules.js
@@ -3424,13 +3424,18 @@ function goto_supply() {
game.state = "supply_source";
init_supply();
}
-function modify_supply(loc, supply, report) {
+function modify_supply(loc, supply, is_port_supply, report) {
let here = get_lord_locale(game.command);
let carts = count_shared_carts(here, true);
// Must carry supply over land with one cart per provender per way
- let distance = map_get(game.supply, loc, 0) >> 3;
- if (distance > 0)
- supply = Math.min(supply, Math.floor(carts / distance));
+ if (is_exile_box(here) && is_port_supply) {
+ /* exception: supply from exile box to port on same sea! */
+ }
+ else {
+ let distance = map_get(game.supply, loc, 0) >> 3;
+ if (distance > 0)
+ supply = Math.min(supply, Math.floor(carts / distance));
+ }
// Harbingers capability doubles supply received
if (lord_has_capability(game.command, AOW_LANCASTER_HARBINGERS)) {
if (report)
@@ -3448,7 +3453,7 @@ function get_port_supply_amount(loc, report) {
if (is_seaport(loc) || is_exile_box(loc)) {
let here = get_lord_locale(game.command);
let ships = count_shared_ships(here, true);
- return modify_supply(loc, ships, report);
+ return modify_supply(loc, ships, true, report);
}
return 0;
}
@@ -3466,7 +3471,7 @@ function get_stronghold_supply_amount(loc, report) {
logcap(AOW_YORK_STAFFORD_BRANCH);
supply += 1;
}
- return modify_supply(loc, supply, report);
+ return modify_supply(loc, supply, false, report);
}
return 0;
}