From a9edc45cec9971475f236f064c6e35fab6a44b80 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 3 Sep 2022 13:51:17 +0200 Subject: Hatch pattern for showing battle control. --- rules.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 19f9451..823562b 100644 --- a/rules.js +++ b/rules.js @@ -2957,9 +2957,17 @@ function goto_move_phase() { } } +function show_move_commands() { + if (game.from1) view.from1 = game.from1 + if (game.from2) view.from2 = game.from2 + if (game.to1) view.to1 = game.to1 + if (game.to2) view.to2 = game.to2 +} + states.select_moves = { inactive: "move phase", prompt() { + show_move_commands() if (game.turn_option === 'offensive') { if (game.from1) view.prompt = `Designate second offensive move.` @@ -3005,6 +3013,7 @@ function gen_rommel_move() { states.group_move_from = { inactive: "move phase", prompt() { + show_move_commands() view.prompt = `Group Move: Select hex to move from.` gen_rommel_move() if (game.turn_option !== 'pass') { @@ -3089,6 +3098,7 @@ states.group_move_from = { states.regroup_move_command_point = { inactive: "move phase", prompt() { + show_move_commands() view.prompt = `Regroup Move: Designate the command point hex.` gen_rommel_move() if (game.turn_option !== 'pass') { @@ -3126,6 +3136,7 @@ states.regroup_move_command_point = { states.regroup_move_destination = { inactive: "move phase", prompt() { + show_move_commands() view.prompt = `Regroup Move: Select destination hex.` gen_rommel_move() let cp, rommel = false @@ -3256,6 +3267,9 @@ states.move = { let rommel1 = (game.rommel === 1) ? 1 : 0 let rommel2 = (game.rommel === 2) ? 1 : 0 + if (game.to1) view.to1 = game.to1 + if (game.to2) view.to2 = game.to2 + if (game.selected < 0) { view.prompt = `Move: Select unit to move.` @@ -6857,11 +6871,6 @@ exports.view = function(state, current) { 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 - if (game.to2) view.to2 = game.to2 - if (game.pursuit) view.pursuit = game.pursuit if (game.battle) view.battle = game.battle if (game.battle || game.pursuit) { -- cgit v1.2.3