summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-04-16 23:34:20 -0400
committerJoël Simoneau <simoneaujoel@gmail.com>2025-04-16 23:34:20 -0400
commit1642efbfd117fd92e0c8de53720955c5217ca4b4 (patch)
tree623a1f55dec06d7b7921fa589a7c6a8378699a37
parent9b241c84a5e50e959352e2a65c464d4208cdcce1 (diff)
downloadvijayanagara-1642efbfd117fd92e0c8de53720955c5217ca4b4.tar.gz
Fix Event 10 is_province
-rw-r--r--events.txt4
-rw-r--r--rules.js8
2 files changed, 8 insertions, 4 deletions
diff --git a/events.txt b/events.txt
index 7b8f99c..b0a65ac 100644
--- a/events.txt
+++ b/events.txt
@@ -204,9 +204,9 @@ SHADED 9
EVENT 10
stay_eligible
prompt "Move up to 4 Delhi Sultanate Units to adjacent Provinces."
- piece_undo_opt 4 is_ds_unit(p)
+ piece_undo_opt 4 (is_ds_unit(p) && is_province(piece_space(p)))
prompt "Move Delhi Sultanate Unit to an adjacent Province."
- space_no_undo 1 is_adjacent(s, piece_space(game.vm.p))
+ space_no_undo 1 (is_adjacent(s, piece_space(game.vm.p)) && is_province(s))
move
endspace
endpiece
diff --git a/rules.js b/rules.js
index 81fc709..215419f 100644
--- a/rules.js
+++ b/rules.js
@@ -3155,6 +3155,10 @@ function move_all_faction_piece_from(faction, type, from, to) {
})
}
+function is_province(s) {
+ return (s >= first_space && s <= last_province)
+}
+
function is_adjacent_to_city(city, s) {
return set_has(CITIES[city].adjacent, s)
}
@@ -6215,9 +6219,9 @@ CODE[9 * 2 + 1] = [
CODE[10 * 2 + 0] = [
[ vm_stay_eligible ],
[ vm_prompt, "Move up to 4 Delhi Sultanate Units to adjacent Provinces." ],
- [ vm_piece, true, 0, 4, (p,s)=>is_ds_unit(p) ],
+ [ vm_piece, true, 0, 4, (p,s)=>(is_ds_unit(p) && is_province(piece_space(p))) ],
[ vm_prompt, "Move Delhi Sultanate Unit to an adjacent Province." ],
- [ vm_space, false, 1, 1, (s)=>is_adjacent(s, piece_space(game.vm.p)) ],
+ [ vm_space, false, 1, 1, (s)=>(is_adjacent(s, piece_space(game.vm.p)) && is_province(s)) ],
[ vm_move ],
[ vm_endspace ],
[ vm_endpiece ],