diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-10-28 12:47:18 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-10-28 12:47:18 +0100 |
commit | a20df50959feced99132b6b12bcfd7956d5ee41f (patch) | |
tree | 42f4c7adfd4050b8158a40d4caee87c171022521 /rules.js | |
parent | dbf1f1822b3f6de67941aca87ee55f55360eaa56 (diff) | |
download | maria-a20df50959feced99132b6b12bcfd7956d5ee41f.tar.gz |
streamline movement by clicking on pieces at destination like fritz
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 36 |
1 files changed, 23 insertions, 13 deletions
@@ -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] |