summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-10-08 11:52:34 +0200
committerTor Andersson <tor@ccxvii.net>2023-12-10 18:16:55 +0100
commitf4f93f474f07943113d205960de8d21bfbbe449a (patch)
tree101ee6f627896c5ab875916b3ad735ebe3771516 /rules.js
parent5f88881e39a4f49cd355ba6eb8230bc4f0b91401 (diff)
downloadplantagenet-f4f93f474f07943113d205960de8d21bfbbe449a.tar.gz
Fix Parley during campaign.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index 7460d4b..a1dc9dc 100644
--- a/rules.js
+++ b/rules.js
@@ -3130,6 +3130,8 @@ function end_campaign_plan() {
// === CAMPAIGN: COMMAND ACTIVATION ===
function goto_command_activation() {
+ clear_undo()
+
if (game.plan_y.length === 0 && game.plan_l.length === 0) {
game.command = NOBODY
goto_end_campaign()
@@ -3547,16 +3549,18 @@ function list_parley_command() {
let here = get_lord_locale(game.command)
if (can_parley_at(here))
- set_add(result, here)
-
- for (let next of data.locales[here].adjacent)
- if (can_parley_at(next))
- set_add(result, here)
+ map_set(result, here, 0)
- if (is_seaport(here) && get_shared_assets(here, SHIP) > 0)
- for (let next of find_ports(here))
+ if (is_friendly_locale(here)) {
+ for (let next of data.locales[here].adjacent)
if (can_parley_at(next))
- set_add(result, here)
+ map_set(result, next, 1)
+
+ if (is_seaport(here) && get_shared_assets(here, SHIP) > 0)
+ for (let next of find_ports(here))
+ if (can_parley_at(next))
+ map_set(result, next, 1)
+ }
return result
}
@@ -3587,6 +3591,7 @@ function goto_parley() {
// Campaign phase, and current location is no cost (except some events), and always successful.
if (game.what.length === 2 && get_lord_locale(game.command) === game.what[0]) {
+ log(`Parley.`)
shift_favour_toward(game.what[0])
end_parley()
return
@@ -3602,7 +3607,6 @@ function goto_parley() {
}
function end_parley() {
- clear_undo()
pop_state()
game.where = NOWHERE
game.what = NOTHING