summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-03 18:02:09 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commitc872fe55bf8fafdbfce07cdc3363f08bef689f21 (patch)
tree2d69b6680d2943961caffdd9b3aa37cc4e4da851
parentd93ae767fd030a6e2f90adab2ff5c3b183782cd6 (diff)
downloadrommel-in-the-desert-c872fe55bf8fafdbfce07cdc3363f08bef689f21.tar.gz
Reduce number of control swaps during buildup.
Merge supply check and elimination steps. Merge discard and reinforcements and spending steps.
-rw-r--r--rules.js86
1 files changed, 40 insertions, 46 deletions
diff --git a/rules.js b/rules.js
index 943ae98..dc3dbac 100644
--- a/rules.js
+++ b/rules.js
@@ -2685,7 +2685,7 @@ function end_oasis_supply() {
if (game.state === 'final_oasis_supply')
goto_final_supply_check_disrupt()
if (game.state === 'buildup_oasis_supply')
- end_buildup_supply_check()
+ goto_buildup_supply_check_recover()
}
function assign_oasis_supply() {
@@ -5386,36 +5386,7 @@ function goto_buildup() {
game.phasing = AXIS
set_active_player()
- goto_buildup_discard()
-}
-
-function goto_buildup_discard() {
- log_br()
- game.state = 'buildup_discard'
- let hand = player_hand()
- if (hand[REAL] + hand[DUMMY] === 0)
- end_buildup_discard()
-}
-
-states.buildup_discard = {
- inactive: "buildup (discard)",
- prompt() {
- view.prompt = "Buildup: Discard any unwanted dummy cards."
- let hand = player_hand()
- if (hand[DUMMY] > 0)
- gen_action('dummy_card')
- gen_action_next()
- },
- dummy_card() {
- push_undo()
- log(game.active + " discarded dummy supply.")
- let hand = player_hand()
- hand[DUMMY]--
- },
- next() {
- clear_undo()
- goto_buildup_supply_check()
- },
+ goto_buildup_supply_check()
}
function goto_buildup_supply_check() {
@@ -5438,16 +5409,6 @@ function goto_buildup_supply_check() {
resume_fortress_supply()
}
-function end_buildup_supply_check() {
- if (is_axis_player()) {
- set_enemy_player()
- goto_buildup_discard()
- } else {
- set_enemy_player()
- goto_buildup_supply_check_recover()
- }
-}
-
function goto_buildup_supply_check_recover() {
let summary = []
for_each_friendly_unit_on_map(u => {
@@ -5471,7 +5432,7 @@ function resume_buildup_eliminate_unsupplied() {
if (done) {
if (is_axis_player()) {
set_enemy_player()
- goto_buildup_supply_check_recover()
+ goto_buildup_supply_check()
} else {
goto_buildup_point_determination()
}
@@ -5552,9 +5513,43 @@ function goto_buildup_point_determination() {
game.phasing = AXIS
set_active_player()
- goto_buildup_reinforcements()
+ goto_buildup_discard()
+}
+
+// === BUILDUP - DISCARD ===
+
+function goto_buildup_discard() {
+ log_h2(game.active + " Buildup")
+
+ game.state = 'buildup_discard'
+ let hand = player_hand()
+ if (hand[REAL] + hand[DUMMY] === 0)
+ goto_buildup_reinforcements()
+}
+
+states.buildup_discard = {
+ inactive: "buildup (discard)",
+ prompt() {
+ view.prompt = "Buildup: Discard any unwanted dummy cards."
+ let hand = player_hand()
+ if (hand[DUMMY] > 0)
+ gen_action('dummy_card')
+ gen_action_next()
+ },
+ dummy_card() {
+ push_undo()
+ log(game.active + " discarded dummy supply.")
+ let hand = player_hand()
+ hand[DUMMY]--
+ },
+ next() {
+ clear_undo()
+ goto_buildup_reinforcements()
+ },
}
+// === BUILDUP - REINFORCEMENTS ===
+
function have_scheduled_reinforcements() {
let refit = friendly_refit()
for (let u = first_friendly_unit; u <= last_friendly_unit; ++u) {
@@ -5565,7 +5560,6 @@ function have_scheduled_reinforcements() {
}
function goto_buildup_reinforcements() {
- log_h2(game.active + " Buildup")
if (have_scheduled_reinforcements())
game.state = 'buildup_reinforcements'
else
@@ -5953,7 +5947,7 @@ states.spending_bps = {
function end_buildup_spending() {
if (is_active_player()) {
set_enemy_player()
- goto_buildup_reinforcements()
+ goto_buildup_discard()
} else {
goto_buildup_resupply()
}
@@ -6368,7 +6362,7 @@ function begin_game() {
game.axis_bps = 30
game.allied_bps = 30
set_active_player()
- goto_buildup_reinforcements()
+ goto_buildup_discard()
return
}