diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-10-06 01:08:46 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-10-06 01:08:46 +0200 |
commit | 753f5c085247c7210411031558a21f2b67e0bd79 (patch) | |
tree | 3424e7120323f585a98caa75e5b26adadbedd6e8 /rules.js | |
parent | ddc76182b70560cc348c16f556c2e59720e44e34 (diff) | |
download | waterloo-campaign-1815-753f5c085247c7210411031558a21f2b67e0bd79.tar.gz |
Only 1 HQ counts for stars.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -2034,10 +2034,13 @@ function goto_resolve_attack() { if (!(town && piece_is_cavalry(a_unit))) a_drm += log_drm(piece_stars(a_unit), "Battle Stars") + let hq_drm = 0 for (let hq of friendly_hqs()) if (piece_mode(hq) && pieces_are_associated(hq, a_unit)) if (calc_distance(piece_hex(hq), a_hex) <= piece_command_range(hq)) - a_drm += log_drm(piece_stars(hq), "HQ") + hq_drm = Math.max(hq_drm, piece_stars(hq)) + if (hq_drm > 0) + a_drm += log_drm(hq_drm, "HQ") // Fresh Cavalry support if (!town) { @@ -2095,10 +2098,13 @@ function goto_resolve_attack() { if (!(town && piece_is_cavalry(d_unit))) d_drm += log_drm(piece_stars(d_unit), "Battle Stars") + hq_drm = 0 for (let hq of enemy_hqs()) if (piece_mode(hq) && pieces_are_associated(hq, d_unit)) if (calc_distance(piece_hex(hq), d_hex) <= piece_command_range(hq)) - d_drm += log_drm(piece_stars(hq), "HQ") + hq_drm = Math.max(hq_drm, piece_stars(hq)) + if (hq_drm > 0) + d_drm += log_drm(hq_drm, "HQ") n = 0 for (let p of enemy_cavalry_corps()) { |