summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-04 00:13:37 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commitd7054787a94fd333eafb2bacbe8387ee117e5d80 (patch)
tree4b1f193c4cc5db753b3afeacd36c4141809b21ff /rules.js
parent0e8fb16e6f787da2ec0b5cd0a759fb9ca228ab39 (diff)
downloadrommel-in-the-desert-d7054787a94fd333eafb2bacbe8387ee117e5d80.tar.gz
Separate buttons for Rommel moves.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js81
1 files changed, 40 insertions, 41 deletions
diff --git a/rules.js b/rules.js
index 1d4f31c..d9e0d52 100644
--- a/rules.js
+++ b/rules.js
@@ -2991,11 +2991,10 @@ function goto_move_phase() {
game.forced = []
game.state = 'select_moves'
init_move_summary()
- if (game.phasing === AXIS) {
- // Automatically select Rommel Move for 1-move turn options
- if (game.turn_option !== 'offensive' && game.turn_option !== 'blitz' && game.scenario !== "1940")
+
+ if (game.phasing === AXIS && game.scenario !== "1940" && game.rommel === 0)
+ if (game.turn_option !== 'offensive' && game.turn_option !== 'blitz')
game.rommel = 1
- }
}
function show_move_commands() {
@@ -3014,31 +3013,48 @@ states.select_moves = {
view.prompt = `Designate second offensive move.`
else
view.prompt = `Designate first offensive move.`
+ } else if (game.turn_option === 'blitz') {
+ view.prompt = `Designate first blitz move.`
} else {
view.prompt = `Designate ${game.turn_option} move.`
}
- gen_action('group')
- gen_action('regroup')
+
+ if (game.phasing === AXIS && game.scenario !== "1940" && game.rommel === 0) {
+ if (game.turn_option === 'offensive' || game.turn_option === 'blitz') {
+ gen_action('group')
+ gen_action('regroup')
+ }
+ gen_action('group_rommel')
+ gen_action('regroup_rommel')
+ } else {
+ gen_action('group')
+ gen_action('regroup')
+ }
+
if (game.turn_option === 'pass')
gen_action('end_turn')
},
+ group_rommel() {
+ push_undo()
+ game.rommel = (game.from1 === 0) ? 1 : 2
+ goto_group()
+ },
group() {
push_undo()
game.state = 'group_move_from'
},
+ regroup_rommel() {
+ push_undo()
+ game.rommel = (game.from1 === 0) ? 1 : 2
+ goto_regroup()
+ },
regroup() {
push_undo()
- game.state = 'regroup_move_command_point'
- if (game.turn_option === 'pass') {
- game.withdraw = list_valid_withdrawal_regroup_command_points()
- save_withdrawal_supply_lines()
- }
+ goto_regroup()
},
end_turn() {
clear_undo()
- flush_move_summary()
game.summary = null
- reveal_visited_minefields()
goto_final_supply_check()
},
confirm_end_turn() {
@@ -3046,9 +3062,16 @@ states.select_moves = {
}
}
-function gen_rommel_move() {
- if (game.phasing === AXIS && game.scenario !== "1940")
- view.actions.rommel = game.rommel ? 0 : 1
+function goto_group() {
+ game.state = 'group_move_from'
+}
+
+function goto_regroup() {
+ game.state = 'regroup_move_command_point'
+ if (game.turn_option === 'pass') {
+ game.withdraw = list_valid_withdrawal_regroup_command_points()
+ save_withdrawal_supply_lines()
+ }
}
states.group_move_from = {
@@ -3056,7 +3079,6 @@ states.group_move_from = {
prompt() {
show_move_commands()
view.prompt = `Group Move: Select hex to move from.`
- gen_rommel_move()
if (game.turn_option !== 'pass') {
for (let x of all_hexes) {
if (x === game.from1 && !game.to1)
@@ -3091,13 +3113,6 @@ states.group_move_from = {
}
}
},
- rommel() {
- push_undo()
- if (game.from1 === 0)
- game.rommel = 1
- else
- game.rommel = 2
- },
hex(x) {
push_undo()
if (game.from1 === 0)
@@ -3144,7 +3159,6 @@ states.regroup_move_command_point = {
prompt() {
show_move_commands()
view.prompt = `Regroup Move: Designate the command point hex.`
- gen_rommel_move()
if (game.turn_option !== 'pass') {
for (let x of all_hexes) {
if (!is_enemy_hex(x)) {
@@ -3158,13 +3172,6 @@ states.regroup_move_command_point = {
gen_withdrawal_regroup_command_point()
}
},
- rommel() {
- push_undo()
- if (game.from1 === 0)
- game.rommel = 1
- else
- game.rommel = 2
- },
hex(x) {
push_undo()
if (game.from1 === 0)
@@ -3182,8 +3189,7 @@ states.regroup_move_destination = {
prompt() {
show_move_commands()
view.prompt = `Regroup Move: Select destination hex.`
- gen_rommel_move()
- let cp, rommel = false
+ let cp, rommel
if (game.from2 === 0)
cp = game.from1, rommel = (game.rommel === 1 ? 1 : 0)
else
@@ -3201,13 +3207,6 @@ states.regroup_move_destination = {
gen_withdrawal_regroup_destination()
}
},
- rommel() {
- push_undo()
- if (game.from2 === 0)
- game.rommel = 1
- else
- game.rommel = 2
- },
hex(x) {
push_undo()
if (game.from2 === 0)