summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.html39
-rw-r--r--rules.js33
2 files changed, 32 insertions, 40 deletions
diff --git a/play.html b/play.html
index acce28c..1727570 100644
--- a/play.html
+++ b/play.html
@@ -266,40 +266,6 @@ main { background-color: dimgray }
<div id="gov_supply_header" class="panel_header">Government Supply</div>
<div id="gov_supply" class="panel_body">
-<!-- <div class="counter fr_xx_2"></div>
-<div class="counter fr_xx_4"></div>
-<div class="counter fr_xx_9"></div>
-<div class="counter fr_xx_12"></div>
-<div class="counter fr_xx_13"></div>
-<div class="counter fr_xx_14 neutralized"></div>
-<div class="counter fr_xx_19"></div>
-<div class="counter fr_xx_20"></div>
-<div class="counter fr_xx_21"></div>
-<div class="counter fr_xx_29"></div>
-
-<div class="counter fr_xx_27"></div>
-<div class="counter fr_xx_5 neutralized"></div>
-<div class="counter fr_xx_7 action"></div>
-<div class="counter fr_xx_dispersed"></div>
-<div class="counter fr_x"></div>
-<div class="counter fr_x_airmobile"></div>
-<div class="counter fr_elite_x_para"></div>
-<div class="counter fr_elite_x_inf neutralized"></div>
-<div class="counter fr_elite_x_marine"></div>
-<div class="counter fr_elite_x_airmobile"></div>
-<div class="counter alg_x"></div>
-<div class="counter alg_x_airmobile neutralized"></div>
-<div class="counter alg_police neutralized"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div>
-<div class="counter alg_police"></div> -->
-
</div>
</div>
@@ -307,11 +273,6 @@ main { background-color: dimgray }
<div id="fln_supply_header" class="panel_header">FLN Supply</div>
<div id="fln_supply" class="panel_body">
-<!-- <div class="counter fln_failek neutralized"></div>
-<div class="counter fln_band"></div>
-<div class="counter fln_cadre"></div>
-<div class="counter fln_front neutralized"></div> -->
-
</div>
</div>
diff --git a/rules.js b/rules.js
index 25e4c3d..f0c7a8e 100644
--- a/rules.js
+++ b/rules.js
@@ -276,6 +276,14 @@ function clear_area_propagandized(l) {
// #endregion
+// #region AREA DATA
+
+function area_zone(l) {
+ return areas[l].zone
+}
+
+// #endregion
+
// #region UNIT STATE
function apply_select(u) {
@@ -415,6 +423,10 @@ function is_police_unit(u) {
return units[u].type === POL
}
+function unit_type(u) {
+ return units[u].type
+}
+
// #endregion
// #region ITERATORS
@@ -722,6 +734,23 @@ function goto_scenario_setup() {
game.summary = {}
}
+function current_player_deployment() {
+ let deployment = SCENARIO_DEPLOYMENT[game.scenario]
+ return is_fln_player() ? deployment.fln : deployment.gov
+}
+
+function can_deploy_to(u, to) {
+ let type = unit_type(u)
+ let zone = area_zone(to)
+ let deployment = current_player_deployment()
+ if (zone in deployment && deployment[zone].includes(type)) {
+ return deployment[zone].includes(type)
+
+ // TODO check current deployment counts
+ }
+ return false
+}
+
states.scenario_setup = {
inactive: "setup",
prompt() {
@@ -736,7 +765,9 @@ states.scenario_setup = {
if (game.selected.length > 0) {
for (let i = 3; i < area_count; ++i) {
let loc = areas[i].loc
- gen_action_loc(loc)
+ if (can_deploy_to(game.selected[0], loc)) {
+ gen_action_loc(loc)
+ }
}
}
// XXX