From 1e32cbd9bd1ca7052a924b8e2c98603d9e85838b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 19 Aug 2024 12:50:55 +0200 Subject: Fix Errata: No Cavalry support between Prussian and AA forces. TODO: What about Infantry support between Prussian and AA forces? --- rules.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 137e3ff..1292291 100644 --- a/rules.js +++ b/rules.js @@ -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)) } -- cgit v1.2.3