summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js13
-rw-r--r--rules.ts14
2 files changed, 23 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index a54a52c..b00a282 100644
--- a/rules.js
+++ b/rules.js
@@ -3502,7 +3502,7 @@ states.supply_source = {
if (port_supply > 0 && stronghold_supply === 0) {
game.where = loc;
// blockade at source or destination
- if (can_naval_blockade(get_lord_locale(game.command)) || can_naval_blockade(game.where)) {
+ if (can_naval_blockade_supply()) {
game.state = "blockade_supply";
}
else {
@@ -3541,6 +3541,15 @@ function end_supply() {
delete game.supply;
game.where = NOWHERE;
}
+function can_naval_blockade_supply() {
+ if (can_naval_blockade(game.where))
+ return true;
+ if (is_exile_box(get_lord_locale(game.command))) {
+ let dist = map_get(game.supply, game.where, 0);
+ return can_naval_blockade_route(dist);
+ }
+ return false;
+}
states.select_supply_type = {
inactive: "Supply",
prompt() {
@@ -3556,7 +3565,7 @@ states.select_supply_type = {
},
port() {
// blockade at source or destination
- if (can_naval_blockade(game.where) || (is_exile_box(get_lord_locale(game.command)) && can_naval_blockade_route(get_lord_locale(game.command)))) {
+ if (can_naval_blockade_supply()) {
game.state = "blockade_supply";
}
else {
diff --git a/rules.ts b/rules.ts
index 3987d3f..9d23fbd 100644
--- a/rules.ts
+++ b/rules.ts
@@ -4262,7 +4262,7 @@ states.supply_source = {
if (port_supply > 0 && stronghold_supply === 0) {
game.where = loc
// blockade at source or destination
- if (can_naval_blockade(get_lord_locale(game.command)) || can_naval_blockade(game.where)) {
+ if (can_naval_blockade_supply()) {
game.state = "blockade_supply"
} else {
use_port_supply(loc, get_port_supply_amount(loc, true))
@@ -4309,6 +4309,16 @@ function end_supply() {
game.where = NOWHERE
}
+function can_naval_blockade_supply() {
+ if (can_naval_blockade(game.where))
+ return true
+ if (is_exile_box(get_lord_locale(game.command))) {
+ let dist = map_get(game.supply, game.where, 0)
+ return can_naval_blockade_route(dist)
+ }
+ return false
+}
+
states.select_supply_type = {
inactive: "Supply",
prompt() {
@@ -4324,7 +4334,7 @@ states.select_supply_type = {
},
port() {
// blockade at source or destination
- if (can_naval_blockade(game.where) || (is_exile_box(get_lord_locale(game.command)) && can_naval_blockade_route(get_lord_locale(game.command)))) {
+ if (can_naval_blockade_supply()) {
game.state = "blockade_supply"
} else {
use_port_supply(game.where, get_port_supply_amount(game.where, true))