From 2b1d488ddede1e27f11d055e30ef399e392bafe8 Mon Sep 17 00:00:00 2001 From: Joël Simoneau Date: Thu, 10 Apr 2025 10:20:19 -0400 Subject: Better Govern Events --- rules.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'rules.js') 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 ], -- cgit v1.2.3