summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-05 19:02:29 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commitbcfb60a802e8297b984b3519c8fe70efa5129b89 (patch)
treed126c9d5076303adbe89ce6587f0fd58220e2b87 /rules.js
parent4b8e84d1173502ff82d30d49c02adafe2b0b6b27 (diff)
downloadrommel-in-the-desert-bcfb60a802e8297b984b3519c8fe70efa5129b89.tar.gz
Add badges for disrupted/unsupplied enemy units.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js39
1 files changed, 24 insertions, 15 deletions
diff --git a/rules.js b/rules.js
index ead708f..2811b83 100644
--- a/rules.js
+++ b/rules.js
@@ -2965,10 +2965,10 @@ 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
+ if (game.from1 && game.from2)
+ view.selected_hexes = [ game.from1, game.from2 ]
+ else if (game.from1)
+ view.selected_hexes = game.from1
}
states.select_moves = {
@@ -3082,10 +3082,13 @@ states.group_move_from = {
},
hex(x) {
push_undo()
- if (game.from1 === 0)
+ if (game.from1 === 0) {
game.from1 = x
- else
+ print_move_1()
+ } else {
game.from2 = x
+ print_move_2()
+ }
if (x === friendly_queue()) {
for_each_friendly_unit_in_hex(friendly_queue(), u => {
@@ -3176,10 +3179,13 @@ states.regroup_move_destination = {
},
hex(x) {
push_undo()
- if (game.from2 === 0)
+ if (game.from2 === 0) {
game.to1 = x
- else
+ print_move_1()
+ } else {
game.to2 = x
+ print_move_2()
+ }
if (game.turn_option === 'offensive' && !game.from2)
game.state = 'select_moves'
else
@@ -3212,30 +3218,35 @@ function search_current_move(who, is_retreat) {
}
}
-function goto_move() {
+function print_move_1() {
if (game.rommel === 1) {
if (game.from1 && game.to1)
- log(`Rommel Regroup move\nfrom #${game.from1}\nto #${game.to1}.`)
+ log(`Regroup move with Rommel\nfrom #${game.from1}\nto #${game.to1}.`)
else if (game.from1)
- log(`Rommel Group move\nfrom #${game.from1}.`)
+ log(`Group move with Rommel\nfrom #${game.from1}.`)
} else {
if (game.from1 && game.to1)
log(`Regroup move\nfrom #${game.from1}\nto #${game.to1}.`)
else if (game.from1)
log(`Group move\nfrom #${game.from1}.`)
}
+}
+
+function print_move_2() {
if (game.rommel === 2) {
if (game.from2 && game.to2)
- log(`Rommel Regroup move\nfrom #${game.from2}\nto #${game.to2}.`)
+ log(`Regroup (R) move\nfrom #${game.from2}\nto #${game.to2}.`)
else if (game.from2)
- log(`Rommel Group move\nfrom #${game.from2}.`)
+ log(`Group (R) move\nfrom #${game.from2}.`)
} else {
if (game.from2 && game.to2)
log(`Regroup move\nfrom #${game.from2}\nto #${game.to2}.`)
else if (game.from2)
log(`Group move\nfrom #${game.from2}.`)
}
+}
+function goto_move() {
log_br()
game.state = 'move'
}
@@ -3280,8 +3291,6 @@ states.move = {
if (game.selected < 0) {
view.prompt = `Move: Select unit to move.`
- show_move_commands()
-
// Select Group Move 1
if (!game.to1 && game.from1) {
if (!is_battle_hex(game.from1)) {