diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-08-19 12:50:55 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-08-19 12:50:55 +0200 |
commit | 1e32cbd9bd1ca7052a924b8e2c98603d9e85838b (patch) | |
tree | 00210722df1880d6b72662d8c5815feae28cad6b /rules.js | |
parent | 39f63d040a198f0d7e57dc41f4e68576141217e2 (diff) | |
download | waterloo-campaign-1815-master.tar.gz |
TODO: What about Infantry support between Prussian and AA forces?
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -242,6 +242,10 @@ function enemy_corps() { return (game.active !== P1) ? p1_corps : p2_corps } function friendly_units() { return (game.active === P1) ? p1_units : p2_units } function enemy_units() { return (game.active !== P1) ? p1_units : p2_units } +function are_pieces_different_nationality(a, b) { + return data.pieces[a].side !== data.pieces[b].side +} + function set_piece_hex(p, hex) { zoc_valid = false game.pieces[p] &= 1 @@ -2038,18 +2042,29 @@ states.attack = { function can_attack_cavalry_support(p) { if (p === game.who) return false + // no support between prussia/aa + if (are_pieces_different_nationality(game.who, p)) + return false return is_adjacent(piece_hex(p), piece_hex(game.who)) } function can_defend_cavalry_support(p) { if (p === game.target) return false + // no support between prussia/aa + if (are_pieces_different_nationality(game.target, p)) + return false return is_adjacent(piece_hex(p), piece_hex(game.target)) } function can_attack_infantry_support(p) { if (p === game.who) return false + // TODO: no support between prussia/aa infantry ? + /* + if (are_pieces_different_nationality(game.who, p)) + return false + */ return is_adjacent(piece_hex(p), piece_hex(game.target)) } |