summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js18
-rw-r--r--rules.js83
2 files changed, 91 insertions, 10 deletions
diff --git a/play.js b/play.js
index 67521de..2b08a6d 100644
--- a/play.js
+++ b/play.js
@@ -350,7 +350,8 @@ function update_map() {
ui.tracker[view.helo_max].appendChild(ui.markers.helo_max)
ui.tracker[view.naval].appendChild(ui.markers.naval)
- ui.drm[view.border_zone_drm].appendChild(ui.markers.border_zone)
+ ui.drm[-view.border_zone_drm].appendChild(ui.markers.border_zone)
+ ui.markers.border_zone.classList.toggle("hide", view.border_zone_drm === null)
ui.markers.border_zone.classList.toggle("neutralized", !view.border_zone_active)
for (let u = 0; u < unit_count; ++u) {
@@ -398,6 +399,21 @@ function on_update() { // eslint-disable-line no-unused-vars
action_button("end_deployment", "End deployment")
action_button("roll", "Roll")
+
+ // gov reinfircement
+ action_button("mobilization", "Mobilization")
+ action_button("activation", "Activation")
+ action_button("acquire_assets", "Acquire assets")
+
+ action_button("acquire_air_point", "+1 Air Point")
+ action_button("acquire_helo_point", "+1 Helo Point")
+ action_button("acquire_naval_point", "+1 Naval Point")
+ action_button("mobilize_border_zone", "Mobilize Border Zone")
+ action_button("improve_border_zone", "Improve Border Zone")
+
+ action_button("end_reinforcement", "End reinforcement")
+
+
action_button("done", "Done")
action_button("undo", "Undo")
action_button("restart", "Restart")
diff --git a/rules.js b/rules.js
index 90c1b17..0689aa1 100644
--- a/rules.js
+++ b/rules.js
@@ -627,7 +627,7 @@ exports.setup = function (seed, scenario, options) {
is_morocco_tunisia_independent: false,
border_zone_active: false,
- border_zone_drm: 0,
+ border_zone_drm: null,
units: new Array(unit_count).fill(0),
areas: new Array(area_count).fill(0),
@@ -652,7 +652,8 @@ const SCENARIOS = {
helo_max: 0,
naval: 0,
fln_psl: 50,
- is_morocco_tunisia_independent: false
+ is_morocco_tunisia_independent: false,
+ border_zone_drm: null
},
"1958": {
gov_psl: 50,
@@ -1083,24 +1084,88 @@ function goto_jean_paul_sartre() {
}
function end_random_event() {
- game.phasing = GOV_NAME
+ clear_undo()
goto_reinforcement_phase()
}
function goto_reinforcement_phase() {
+ goto_gov_reinforcement_phase()
+}
+
+function goto_gov_reinforcement_phase() {
+ game.phasing = GOV_NAME
set_active_player()
- game.state = "reinforcement"
+ log_h2(`${game.active} Reinforcement`)
+ game.state = "gov_reinforcement"
}
-states.reinforcement = {
+const COST_AIR_POINT = 2
+const COST_HELO_POINT = 3
+const COST_NAVAL_POINT = 3
+const COST_BORDER_ZONE = 6
+
+states.gov_reinforcement = {
inactive: "to do reinforcement",
prompt() {
- view.prompt = "Do reinforcement."
- gen_action("done")
+ view.prompt = "Reinforcement: Mobilize & activate units, and acquire assets"
+
+ if (game.gov_psl > COST_AIR_POINT)
+ gen_action("acquire_air_point")
+ if (game.gov_psl > COST_HELO_POINT)
+ gen_action("acquire_helo_point")
+ if (game.gov_psl > COST_NAVAL_POINT)
+ gen_action("acquire_naval_point")
+ if (game.gov_psl > COST_BORDER_ZONE) {
+ // TODO starts at no border zone instead of 0
+ if (game.border_zone_drm === null) {
+ gen_action("mobilize_border_zone")
+ } else if (game.border_zone_drm > -3) {
+ gen_action("improve_border_zone")
+ }
+ }
+
+ gen_action("end_reinforcement")
+ },
+ acquire_air_point() {
+ push_undo()
+ log_h3("Asset Acquired:")
+ log(`+1 Air Point (cost: ${COST_AIR_POINT} PSP)`)
+ game.gov_psl -= COST_AIR_POINT
+ game.air_avail += 1
+ game.air_max += 1
+ },
+ acquire_helo_point() {
+ push_undo()
+ log_h3("Asset Acquired:")
+ log(`+1 Helo Point (cost: ${COST_HELO_POINT} PSP)`)
+ game.gov_psl -= COST_HELO_POINT
+ game.helo_avail += 1
+ game.helo_max += 1
+ },
+ acquire_naval_point() {
+ push_undo()
+ log_h3("Asset Acquired:")
+ log(`+1 Naval Point (cost: ${COST_NAVAL_POINT} PSP)`)
+ game.gov_psl -= COST_NAVAL_POINT
+ game.naval += 1
+ },
+ mobilize_border_zone() {
+ push_undo()
+ log_h3("Border Zone:")
+ log(`>Mobilized (cost: ${COST_BORDER_ZONE} PSP)`)
+ game.gov_psl -= COST_BORDER_ZONE
+ game.border_zone_drm = 0
+ },
+ improve_border_zone() {
+ push_undo()
+ log_h3("Border Zone:")
+ log(`>Improved DRM (cost: ${COST_BORDER_ZONE} PSP)`)
+ game.gov_psl -= COST_BORDER_ZONE
+ game.border_zone_drm -= 1
},
- done() {
+ end_reinforcement() {
// XXX debug
- log("End of turn...")
+ log("End of Gov reinforcement...")
goto_next_turn()
}
}