summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-11-05 01:02:16 +0100
committerTor Andersson <tor@ccxvii.net>2023-11-05 12:31:00 +0100
commit64d083cf2de573165ea43936e08ea1d772b5895e (patch)
tree522fb3d39af1afb19775a5c82e84c27b763f6df7
parentcf762c5b1e491b01ef5fdc9ea8bd3e791ae8d106 (diff)
downloadalgeria-64d083cf2de573165ea43936e08ea1d772b5895e.tar.gz
Show disabled build/convert buttons when out of ap/pieces.
-rw-r--r--rules.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/rules.js b/rules.js
index 20b55b3..744cb02 100644
--- a/rules.js
+++ b/rules.js
@@ -2703,24 +2703,35 @@ states.fln_reinforcement = {
// The FLN player may build new Cadres or Bands by spending the AP cost and placing them in the UG box of any area which contains a non-Neutralized Front
// (note that this requires the presence of a Front)
if (has_free_unit_by_type(CADRE) && game.fln_ap >= build_cost(first_unit_loc))
- gen_action("build_cadre")
+ view.actions.build_cadre = 1
+ else
+ view.actions.build_cadre = 0
if (has_free_unit_by_type(BAND) && game.fln_ap >= build_cost(first_unit_loc))
- gen_action("build_band")
+ view.actions.build_band = 1
+ else
+ view.actions.build_band = 0
if (has_free_unit_by_type(CADRE) && !is_area_morocco_or_tunisia(first_unit_loc))
- gen_action("convert_front_to_cadre")
+ view.actions.convert_front_to_cadre = 1
+ else
+ view.actions.convert_front_to_cadre = 0
} else if (first_unit_type === CADRE) {
view.prompt = "Reinforcement: Convert Cadre."
// Fronts may not be created in Remote areas (not enough people) and there may be only one Front per area.
- if (!(has_unit_type_in_loc(FRONT, first_unit_loc) || is_area_remote(first_unit_loc)) && has_free_unit_by_type(FRONT) && game.fln_ap >= convert_cost(FRONT)) {
- gen_action("convert_cadre_to_front")
- }
+ if (!(has_unit_type_in_loc(FRONT, first_unit_loc) || is_area_remote(first_unit_loc)) && has_free_unit_by_type(FRONT) && game.fln_ap >= convert_cost(FRONT))
+ view.actions.convert_cadre_to_front = 1
+ else
+ view.actions.convert_cadre_to_front = 0
if (has_free_unit_by_type(BAND) && game.fln_ap >= convert_cost(BAND))
- gen_action("convert_cadre_to_band")
+ view.actions.convert_cadre_to_band = 1
+ else
+ view.actions.convert_cadre_to_band = 0
} else if (first_unit_type === BAND) {
view.prompt = "Reinforcement: Convert Band."
if (has_free_unit_by_type(FAILEK) && game.fln_ap >= convert_cost(FAILEK))
- gen_action("convert_band_to_failek")
+ view.actions.convert_band_to_failek = 1
+ else
+ view.actions.convert_band_to_failek = 0
}
}
},