summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-08-19 12:50:55 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-19 12:50:55 +0200
commit1e32cbd9bd1ca7052a924b8e2c98603d9e85838b (patch)
tree00210722df1880d6b72662d8c5815feae28cad6b
parent39f63d040a198f0d7e57dc41f4e68576141217e2 (diff)
downloadwaterloo-campaign-1815-1e32cbd9bd1ca7052a924b8e2c98603d9e85838b.tar.gz
Fix Errata: No Cavalry support between Prussian and AA forces.HEADmaster
TODO: What about Infantry support between Prussian and AA forces?
-rw-r--r--rules.js15
1 files changed, 15 insertions, 0 deletions
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))
}