summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-04-12 18:27:27 +0200
committerTor Andersson <tor@ccxvii.net>2025-04-12 18:27:27 +0200
commit8bf0d40a2649326f5da78c17342c60ab96b3dc18 (patch)
tree9b533cd1b0a8573d66cff09d0933e6511493dcdf /rules.js
parentddd0520b63316ed91fe70b6981402fda9aafb2eb (diff)
downloadvijayanagara-8bf0d40a2649326f5da78c17342c60ab96b3dc18.tar.gz
Allow shorter routes for campaign.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index a74ada9..343cdf9 100644
--- a/rules.js
+++ b/rules.js
@@ -2178,10 +2178,10 @@ function is_n_from_warangal(n, s) {
states.campaign = {
inactive: "Campaign",
prompt() {
- view.campaign_spaces = [...game.decree.campaign].sort((a, b) => a - b)
+ view.campaign_spaces = game.decree.campaign.slice().sort((a, b) => a - b)
if (game.vm && game.vm.fp === 13) {
- view.prompt = "Campaign: Select four contiguous spaces, finishing adjacent to Warangal."
+ view.prompt = "Campaign: Select a route up to four spaces long, finishing adjacent to Warangal."
if (game.decree.campaign.length === 0) {
for (let s = first_space; s <= last_space; ++s) {
if (can_start_campaign_in_space(s) && is_n_from_warangal(3, s))
@@ -2192,9 +2192,11 @@ states.campaign = {
if (!game.decree.campaign.includes(s) && is_n_from_warangal(3-game.decree.campaign.length, s))
gen_action_space(s)
}
+ if (game.decree.campaign.length > 1 && is_n_from_warangal(1, game.decree.campaign.at(-1)))
+ view.actions.next = 1
}
} else {
- view.prompt = "Campaign: Select four contiguous spaces, from start to finish."
+ view.prompt = "Campaign: Select a route up to four spaces long, from start to finish."
if (game.decree.campaign.length === 0) {
for (let s = first_space; s <= last_space; ++s) {
if (can_start_campaign_in_space(s) && is_campaign_succ(s))
@@ -2205,6 +2207,8 @@ states.campaign = {
if (!game.decree.campaign.includes(s) && is_campaign_succ(s) && has_valid_campaign_connection(s))
gen_action_space(s)
}
+ if (game.decree.campaign.length > 1)
+ view.actions.next = 1
}
}
@@ -2231,12 +2235,12 @@ states.campaign_moves = {
inactive: "Campaign",
prompt() {
view.prompt = "Campaign: Move units along the campaign trail."
- view.campaign_spaces = [...game.decree.campaign].sort((a, b) => a - b)
+ view.campaign_spaces = game.decree.campaign.slice().sort((a, b) => a - b)
view.who = game.decree.selected
for_each_movable(DS, p => {
if (
- [...game.decree.campaign.slice(0, -1)].includes(piece_space(p)) &&
+ game.decree.campaign.slice(0, -1).includes(piece_space(p)) &&
!set_has(game.decree.pieces, p)
)
gen_action_piece(p)