summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-03 13:51:17 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commita9edc45cec9971475f236f064c6e35fab6a44b80 (patch)
tree70f8b6e1d9f328910038051d790d7a23b6a60a14 /rules.js
parent064a1f0ec4d7859a378b36c7f6b5cdb05d4a1982 (diff)
downloadrommel-in-the-desert-a9edc45cec9971475f236f064c6e35fab6a44b80.tar.gz
Hatch pattern for showing battle control.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js19
1 files changed, 14 insertions, 5 deletions
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) {