diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-03-24 02:15:19 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | ed2e67651cfb9a8a1969969231733e7973103df9 (patch) | |
tree | 8b286743b99fab78590cefc6d90df80618340b36 | |
parent | e5edcf0b76e59e73c491291ce41b81549f0fa0b8 (diff) | |
download | wilderness-war-ed2e67651cfb9a8a1969969231733e7973103df9.tar.gz |
Use separate "drop off" state to reduce mis-clicking "end move".
-rw-r--r-- | play.js | 3 | ||||
-rw-r--r-- | rules.js | 62 |
2 files changed, 47 insertions, 18 deletions
@@ -1425,10 +1425,9 @@ function update_map() { action_button("assault", "Assault"); action_button("move", "Move"); action_button("naval_move", "Naval"); - action_button("boat_move", "Boat"); - action_button("land_move", "Land"); action_button("eliminate", "Eliminate"); action_button("pick_up_all", "Pick up all"); + action_button("drop_off", "Drop off"); action_button("exchange", "Exchange"); action_button("stop", "Stop"); action_button("pass", "Pass"); @@ -3165,15 +3165,8 @@ states.move = { } if (game.move.used < 9) { - if (is_leader(who)) { - for_each_leader_in_force(who, p => { - if (p !== who && can_drop_off_leader(who, p)) - gen_action_piece(p); - }); - for_each_unit_in_force(who, p => { - gen_action_piece(p); - }); - } + if (is_leader(who) && count_pieces_in_force(who) > 1) + gen_action('drop_off'); } }, play_event(card) { @@ -3208,11 +3201,9 @@ states.move = { goto_intercept(); }, - piece(who) { + drop_off() { push_undo(); - log(`Dropped off ${piece_name(who)}.`); - move_piece_to(who, moving_piece_space()); - resume_move(); + game.state = 'drop_off'; }, siege() { goto_siege(moving_piece_space()); @@ -3225,11 +3216,50 @@ states.move = { goto_designate_inside(); }, next() { - end_move(); + if (game.move.used > 0) { + end_move(); + } else { + push_undo(); + game.state = 'confirm_end_move'; + } }, - pass() { + demolish_fort: goto_demolish_fort, + demolish_stockade: goto_demolish_stockade, + demolish_fieldworks: goto_demolish_fieldworks, +} + +states.drop_off = { + inactive() { + inactive_prompt("move"); + view.who = moving_piece(); + }, + prompt() { + let who = moving_piece(); + let where = moving_piece_space(); + + view.prompt = `Drop off subordinate units or leaders in ${space_name(where)}.`; + view.who = who; + view.where = where; + + gen_action_next() + gen_action_demolish(); + + for_each_leader_in_force(who, p => { + if (p !== who && can_drop_off_leader(who, p)) + gen_action_piece(p); + }); + for_each_unit_in_force(who, p => { + gen_action_piece(p); + }); + }, + piece(who) { push_undo(); - game.state = 'confirm_end_move'; + log(`Dropped off ${piece_name(who)}.`); + move_piece_to(who, moving_piece_space()); + }, + next() { + push_undo(); + resume_move(); }, demolish_fort: goto_demolish_fort, demolish_stockade: goto_demolish_stockade, |