summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js72
1 files changed, 66 insertions, 6 deletions
diff --git a/rules.js b/rules.js
index b03cd77..e205eed 100644
--- a/rules.js
+++ b/rules.js
@@ -93,6 +93,45 @@ const speed_name_cap = [ "Zero", "Leg", "Motorized", "Mechanized", "Recon" ]
const die_face_hit = [ 0, '\u2776', '\u2777', '\u2778', '\u2779', '\u277A', '\u277B' ]
const die_face_miss = [ 0, '\u2460', '\u2461', '\u2462', '\u2463', '\u2464', '\u2465' ]
+const month_names_1940 = [ "",
+ "September 1940",
+ "October 1940",
+ "November 1940",
+ "December 1940",
+ "January 1940",
+ "February 1940",
+]
+
+const month_names = [ "",
+ "April 1941",
+ "May 1941",
+ "June 1941",
+ "July 1941",
+ "August 1941",
+ "September 1941",
+ "October 1941",
+ "November 1941",
+ "December 1941",
+ "January 1942",
+ "February 1942",
+ "March 1942",
+ "April 1942",
+ "May 1942",
+ "June 1942",
+ "July 1942",
+ "August 1942",
+ "September 1942",
+ "October 1942",
+ "November 1942",
+]
+
+function current_month_name() {
+ if (game.scenario === "1940")
+ return month_names_1940[game.month]
+ else
+ return month_names[game.month]
+}
+
const SF = 6
const DF = 5
const TF = 4
@@ -1857,8 +1896,10 @@ function end_player_turn() {
if (check_sudden_death_victory())
return
- if (game.passed === 2)
+ if (game.passed === 2) {
+ game.passed = 0
return end_month()
+ }
if (game.phasing === AXIS)
game.phasing = ALLIED
@@ -4290,7 +4331,7 @@ function end_month() {
function goto_buildup() {
++game.month
- log_h1(`Month ${game.month}`)
+ log_h1(current_month_name())
game.phasing = AXIS
set_active_player()
@@ -4767,7 +4808,6 @@ function end_buildup_spending() {
set_enemy_player()
goto_buildup_reinforcements()
} else {
- delete game.buildup
goto_buildup_resupply()
}
}
@@ -4803,6 +4843,8 @@ function goto_buildup_resupply() {
deal_axis_supply_cards(axis_resupply)
deal_allied_supply_cards(allied_resupply)
+ delete game.buildup
+
goto_player_initiative()
}
@@ -5073,7 +5115,7 @@ states.initial_supply_cards = {
}
function begin_game() {
- log_h1(`Month ${game.month}`)
+ log_h1(current_month_name())
if (game.scenario === "Crusader") {
game.phasing = ALLIED
@@ -5639,8 +5681,12 @@ exports.setup = function (seed, scenario, options) {
exports.view = function(state, current) {
load_state(state)
+ let scenario = current_scenario()
+
view = {
month: game.month,
+ start: scenario.start,
+ end: scenario.end,
units: game.units,
revealed: game.revealed,
moved: game.moved,
@@ -5654,14 +5700,28 @@ exports.view = function(state, current) {
allied_sides: game.allied_sides,
}
- if (current === AXIS)
+ if (current === AXIS) {
view.cards = game.axis_hand
- if (current === ALLIED)
+ if (game.axis_minefields.length > 0)
+ view.minefields = game.minefields.concat(game.axis_minefields)
+ else
+ view.minefields = game.minefields
+ }
+ else if (current === ALLIED) {
view.cards = game.allied_hand
+ if (game.allied_minefields.length > 0)
+ view.minefields = game.minefields.concat(game.allied_minefields)
+ else
+ view.minefields = game.minefields
+ }
+ else {
+ view.minefields = game.minefields
+ }
if (current === game.active)
view.selected = game.selected
+
if (game.from1) view.from1 = game.from1
if (game.from2) view.from2 = game.from2
if (game.to1) view.to1 = game.to1