diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-12 20:50:14 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-12-12 20:50:14 +0100 |
commit | 7f18725fedd24399652c0890a1b98a6354682b34 (patch) | |
tree | bc931526f01c2c789798940f6aef46bc87b5c66b | |
parent | f9d52042ea56a64c9c5b1e18fa7a51fe049a0b0f (diff) | |
download | andean-abyss-7f18725fedd24399652c0890a1b98a6354682b34.tar.gz |
Don't allow removing the currently selected piece.
-rw-r--r-- | rules.js | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1798,19 +1798,24 @@ states.remove_pieces = { disable_negotiation: true, prompt() { view.prompt = "Remove pieces to Available Forces." + let who = -1 + if (game.op) + who = game.op.who + else if (game.prop) + who = game.prop.who for (let p = first_piece[game.current][BASE]; p <= last_piece[game.current][BASE]; ++p) - if (piece_space(p) >= 0) + if (piece_space(p) >= 0 && p !== who) gen_action_piece(p) if (game.current === GOVT) { for (let p = first_piece[game.current][TROOPS]; p <= last_piece[game.current][TROOPS]; ++p) - if (piece_space(p) >= 0) + if (piece_space(p) >= 0 && p !== who) gen_action_piece(p) for (let p = first_piece[game.current][POLICE]; p <= last_piece[game.current][POLICE]; ++p) - if (piece_space(p) >= 0) + if (piece_space(p) >= 0 && p !== who) gen_action_piece(p) } else { for (let p = first_piece[game.current][GUERRILLA]; p <= last_piece[game.current][GUERRILLA]; ++p) - if (piece_space(p) >= 0) + if (piece_space(p) >= 0 && p !== who) gen_action_piece(p) } view.actions.done = 1 |