diff options
author | Tor Andersson <tor@ccxvii.net> | 2025-01-29 15:46:37 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2025-01-29 15:46:37 +0100 |
commit | 0374d8a8382112cc2ed82c0ec06ab5b0ecdf40ba (patch) | |
tree | 6554133cc21b178b3ecbbaf0c367c9fff97bbd92 /rules.js | |
parent | 6054551fc2da4701bdc4d6d92e8106ffb91f4e6d (diff) | |
download | plantagenet-0374d8a8382112cc2ed82c0ec06ab5b0ecdf40ba.tar.gz |
fixup use of can_naval_blockade_route and add fix for states.supply_source
use common convenience function
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 { |