summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js36
1 files changed, 23 insertions, 13 deletions
diff --git a/rules.js b/rules.js
index 21836cb..0e0be91 100644
--- a/rules.js
+++ b/rules.js
@@ -930,6 +930,9 @@ function set_active_to_power(new_power) {
}
function get_top_piece(s) {
+ for (let p of all_hussars)
+ if (game.pos[p] === s)
+ return p
for (let p of all_trains)
if (game.pos[p] === s)
return p
@@ -2278,18 +2281,21 @@ states.move_supply_train = {
if (game.count < 2 + game.main)
for (let next of data.cities.main_roads[here])
if (can_move_train_to(who, here, next))
- gen_action_space(next)
+ gen_action_space_or_piece(next)
if (game.count < 2)
for (let next of data.cities.roads[here])
if (can_move_train_to(who, here, next))
- gen_action_space(next)
+ gen_action_space_or_piece(next)
if (game.count > 0)
gen_action_piece(who)
view.actions.stop = 1
},
- piece(_) {
- this.stop()
+ piece(p) {
+ if (p === game.selected)
+ this.stop()
+ else
+ this.space(game.pos[p])
},
stop() {
end_move_piece()
@@ -2366,14 +2372,10 @@ states.move_general = {
game.state = "move_give"
},
piece(p) {
- if (game.count === 0) {
+ if (p === game.selected)
+ this.stop()
+ else
this.space(game.pos[p])
- } else {
- if (p === game.selected)
- this.stop()
- else
- this.space(game.pos[p])
- }
},
stop() {
end_move_piece()
@@ -2440,9 +2442,17 @@ states.force_march = {
let here = game.pos[game.selected]
if (game.count < 8)
for (let s of search_force_march(game.selected, null, here, 8 - game.count))
- gen_action_space(s)
- if (game.count > 0)
+ gen_action_space_or_piece(s)
+ if (game.count > 0) {
+ gen_action_piece(game.selected)
view.actions.stop = 1
+ }
+ },
+ piece(p) {
+ if (p === game.selected)
+ this.stop()
+ else
+ this.space(game.pos[p])
},
space(to) {
let here = game.pos[game.selected]