summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-10-06 01:08:46 +0200
committerTor Andersson <tor@ccxvii.net>2023-10-06 01:08:46 +0200
commit753f5c085247c7210411031558a21f2b67e0bd79 (patch)
tree3424e7120323f585a98caa75e5b26adadbedd6e8 /rules.js
parentddc76182b70560cc348c16f556c2e59720e44e34 (diff)
downloadwaterloo-campaign-1815-753f5c085247c7210411031558a21f2b67e0bd79.tar.gz
Only 1 HQ counts for stars.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index 43704e7..5af0abc 100644
--- a/rules.js
+++ b/rules.js
@@ -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()) {