summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-08-05 19:56:59 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:26 +0100
commit8928a46b8869ef65fff4bd2a5d77504eeb532c8d (patch)
treebb6c959a73123bd99ef1d6e9c654a5100d1247ff /rules.js
parent2d6ca25d35f83bccaa9c06cdc21d6929a6ffa4b9 (diff)
downloadrommel-in-the-desert-8928a46b8869ef65fff4bd2a5d77504eeb532c8d.tar.gz
Fix rules interpretations based on answers from Craig.
* May not cross enemy hexsides when disengaging during redeployment. * "Unfired" refreshed every phase. * Units routed again during enemy phase don't recover.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js48
1 files changed, 28 insertions, 20 deletions
diff --git a/rules.js b/rules.js
index 3ebac16..320b085 100644
--- a/rules.js
+++ b/rules.js
@@ -1,32 +1,24 @@
"use strict"
// TODO: RAIDERS
-// TODO: MINEFIELDS
-// TODO: legal pass withdrawal moves (reduce supply net, withdraw from fortress attack)
-// TODO: fortress combat in pass turns (must withdraw)
// TODO: group move from queue holding box to base
// TODO: 1942 malta group (reinforce, reduce supply card draw)
+// TODO: MINEFIELDS
+// TODO: create minefields
+// TODO: tear down 2 minefields to create new minefield
+// TODO: track minefields to be revealed when moved through
+// TODO: reveal minefields at end of movement
+
+// TODO: legal pass withdrawal moves (reduce supply net, withdraw from fortress attack)
+// TODO: fortress combat in pass turns (must withdraw)
+
// TODO: log summaries (deploy, rebuild, move, etc)
// TODO: put initial deployment stack somewhere more accessible (spread out along the top?)
// UI: pause after all fires (in case 0 hits the dialog disappears fast)
-// RULES: may units redeploying out of battle hex cross enemy controlled hexsides? (yes / doesn't matter)
-
-// RULES: can fortress supplied units be part of supply lines for non-fortress supplied units for withdrawals to base?
-// RULES: can non-fortress supplied units be part of supply lines for fortress supplied units for withdrawals?
-
-// RULES: for sea redeployment, can bases be "besieged"? (NO?)
-// RULES: may units redeploying out of battle hex leave disrupted units behind to be routed? (no)
-// RULES: may units returning for refit enter enemy supply network? (no)
-
-// RULES: if disrupted units are routed again during their "full enemy turn", can they still recover?
-// RULES: may oasis supplied units refuse battle or withdraw to base? (yes)
-// RULES: when is "fired" status cleared?
-// RULES: are minefields moved through (but not stopped at) revealed?
-
// TODO: black hit outline in battles ("steploss/bad" action) and skip "apply 0 hits" step
// ERRATA: forbid single-group regroup moves or convert to group moves after the fact,
@@ -1659,7 +1651,7 @@ function search_path_bfs(from, cost, start, road, max_cost, retreat, sline, sdis
}
function search_path_redeploy_bfs(cost, start, road) {
- let path_enemy, friendly_network, enemy_network
+ let path_enemy, friendly_network, enemy_network, enemy_sides
if (presence_invalid)
update_presence()
@@ -1667,10 +1659,12 @@ function search_path_redeploy_bfs(cost, start, road) {
path_enemy = presence_allied
friendly_network = game.buildup.axis_network
enemy_network = game.buildup.allied_network
+ enemy_sides = game.allied_sides
} else {
path_enemy = presence_axis
friendly_network = game.buildup.allied_network
enemy_network = game.buildup.axis_network
+ enemy_sides = game.axis_sides
}
cost.fill(63)
@@ -1718,6 +1712,10 @@ function search_path_redeploy_bfs(cost, start, road) {
if (next_enemy)
continue
+ // if disengaging from battle, must not cross enemy hexside
+ if (here === start && path_enemy[here] && set_has(enemy_sides, side))
+ continue
+
cost[next] = next_cost
// don't care about distance (need to find home base for refit)
@@ -2233,6 +2231,8 @@ states.initial_supply_check_rout = {
function goto_final_supply_check() {
set_active_player()
+ set_clear(game.fired)
+
log_br()
capture_fortress(BARDIA, 2)
@@ -2295,6 +2295,7 @@ states.final_supply_check_rout = {
// ==== MOVEMENT PHASE ===
function goto_move_phase() {
+ set_clear(game.fired)
game.state = 'select_moves'
if (game.phasing === AXIS) {
// Automatically select Rommel Move for 1-move turn options
@@ -3454,6 +3455,11 @@ function goto_rout(from, enemy, after) {
if (enemy)
set_enemy_player()
+ // RULES: Will be disrupted again, so won't be able to recover.
+ for_each_friendly_unit_in_hex(from, u => {
+ set_delete(game.recover, u)
+ })
+
game.state = 'rout_attrition'
}
@@ -3672,7 +3678,6 @@ function goto_blitz_turn() {
log_h2(`Blitz Turn`)
if (game.rommel)
game.rommel = 3
- set_clear(game.fired)
game.turn_option = 'second blitz'
goto_move_phase()
}
@@ -5078,6 +5083,8 @@ function goto_initial_supply_cards() {
game.phasing = AXIS
set_active_player()
+ set_clear(game.fired)
+
log_br()
let scenario = current_scenario()
@@ -5629,7 +5636,8 @@ exports.setup = function (seed, scenario, options) {
axis_minefields: [],
allied_minefields: [],
- minefields: [],
+ reveal_minefields: [], // to be revealed at end of movement
+ minefields: [], // revealed to both players
// fortress control
fortress: 7,