summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-04-10 10:20:19 -0400
committerJoël Simoneau <simoneaujoel@gmail.com>2025-04-10 10:20:19 -0400
commit2b1d488ddede1e27f11d055e30ef399e392bafe8 (patch)
treeccead59b16e423a79fe51cc5e2667f29fd2ae1a0
parent0e0180cf6a0552088dead19de67b090f40b974a3 (diff)
downloadvijayanagara-2b1d488ddede1e27f11d055e30ef399e392bafe8.tar.gz
Better Govern Events
-rw-r--r--events.txt2
-rw-r--r--play.js12
-rw-r--r--rules.js10
3 files changed, 14 insertions, 10 deletions
diff --git a/events.txt b/events.txt
index 90c71d5..c2d65a5 100644
--- a/events.txt
+++ b/events.txt
@@ -94,6 +94,7 @@ SHADED 4
stay_eligible
current DS
prompt "Govern ignoring location requirements."
+ asm game.vm.ignore_loc_req = true
govern
EVENT 5
@@ -169,6 +170,7 @@ EVENT 8
SHADED 8
current DS
prompt `In each Province adjacent to Devagiri and/or Gulbarga, Govern for free ignoring location requirements and place a Troop.`
+ asm game.vm.ignore_loc_req = true
space_opt all (is_adjacent_to_city(C_DEVAGIRI, s) || is_adjacent_to_city(C_GULBARGA, s)) && can_govern_in_space(s)
free_govern_in_space
place_opt 1 DS TROOPS
diff --git a/play.js b/play.js
index 57b204d..ce7a766 100644
--- a/play.js
+++ b/play.js
@@ -72,10 +72,10 @@ const LAYOUT = {
"Tamilakam BK": [648, 1478],
"Tamilakam VE": [657, 1543],
"Tamilakam mongols": [752, 1394],
- "Delhi DS": [718, 316],
+ "Delhi DS": [718, 326],
"Delhi BK": [571, 422],
"Delhi VE": [724, 414],
- "Delhi mongols": [573, 324],
+ "Delhi mongols": [573, 334],
"Mountain Passes DS": [263, 183],
"Mountain Passes BK": [236, 110],
"Mountain Passes VE": [318, 105],
@@ -1134,19 +1134,19 @@ function on_update() {
// layout cavalry
items.length = 0
filter_calvary_tokens(items, DS)
- layout_cavalry(items, 1125, 100, 14)
+ layout_cavalry(items, 1125, 100, 13)
items.length = 0
filter_calvary_tokens(items, BK)
- layout_cavalry(items, 265, 920, 14)
+ layout_cavalry(items, 265, 920, 13)
items.length = 0
filter_calvary_tokens(items, VE)
- layout_cavalry(items, 265, 1420, 14)
+ layout_cavalry(items, 265, 1420, 13)
items.length = 0
filter_calvary_tokens(items, AVAILABLE)
- layout_cavalry(items, 1186, 1080, 17)
+ layout_cavalry(items, 725, 73, 13)
// layout pieces
items.length = 0
diff --git a/rules.js b/rules.js
index e80059f..625dd7f 100644
--- a/rules.js
+++ b/rules.js
@@ -1667,9 +1667,9 @@ function can_govern() {
}
function can_govern_in_space(s) {
- let is_event_4 = (game.vm && game.vm.fp === 9)
+ let is_space_agnostic = (game.vm && "ignore_loc_req" in game.vm && game.vm.ignore_loc_req)
let is_space = (is_tributary(s) || s === S_DELHI || s === S_MOUNTAIN_PASSES || s === S_PUNJAB || is_faction_control(s, DS))
- if (!is_event_4 && !is_space)
+ if (!is_space_agnostic && !is_space)
return false
if (has_piece(AVAILABLE, DS, ELITE))
@@ -1706,8 +1706,8 @@ function goto_govern_space() {
states.govern = {
inactive: "Govern",
prompt() {
- if (game.vm && game.vm.fp === 9)
- view.prompt = "Govern: Ignore Locations requirements."
+ if (game.vm && "ignore_loc_req" in game.vm && game.vm.ignore_loc_req)
+ view.prompt = "Govern: Ignore locations requirements."
else
view.prompt = "Govern: Select a Tributary, Controlled, Mongol Invader region or Delhi."
@@ -6032,6 +6032,7 @@ CODE[4 * 2 + 1] = [
[ vm_stay_eligible ],
[ vm_current, DS ],
[ vm_prompt, "Govern ignoring location requirements." ],
+ [ vm_asm, ()=>game.vm.ignore_loc_req = true ],
[ vm_govern ],
[ vm_return ],
]
@@ -6131,6 +6132,7 @@ CODE[8 * 2 + 0] = [
CODE[8 * 2 + 1] = [
[ vm_current, DS ],
[ vm_prompt, ()=>`In each Province adjacent to Devagiri and/or Gulbarga, Govern for free ignoring location requirements and place a Troop.` ],
+ [ vm_asm, ()=>game.vm.ignore_loc_req = true ],
[ vm_space, true, 0, 999, (s)=>(is_adjacent_to_city(C_DEVAGIRI, s) || is_adjacent_to_city(C_GULBARGA, s)) && can_govern_in_space(s) ],
[ vm_free_govern_in_space ],
[ vm_place, false, 1, 1, DS, TROOPS ],