summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
}