summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-09-15 13:07:50 +0200
committerTor Andersson <tor@ccxvii.net>2023-09-15 13:07:50 +0200
commite877ac57c67e73fd0c4500498f5a573dc5b30745 (patch)
tree9f9dcb50d82fde71d5fcc018d3c095af5fb62a89
parent41aaecfbaed1ea7ade81668d816e874eef03a9b3 (diff)
downloadnevsky-e877ac57c67e73fd0c4500498f5a573dc5b30745.tar.gz
Fix strike_left_or_right if choice is only via strike group.
If center lord has no strikes of his own, we need to check the lords he is grouped with for strikes before assuming there are no strikes.
-rw-r--r--rules.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 91273ed..2aa19e8 100644
--- a/rules.js
+++ b/rules.js
@@ -8332,8 +8332,20 @@ function flanks_all_positions(S, TT) {
return true
}
+function has_strike_within_group(S) {
+ if (has_strike(S))
+ return true
+ if (game.battle.strikers) {
+ if (game.battle.strikers.includes(S))
+ for (let X of game.battle.strikers)
+ if (has_strike(X))
+ return true
+ }
+ return false
+}
+
function strike_left_or_right(S2, T1, T2, T3) {
- if (has_strike(S2)) {
+ if (has_strike_within_group(S2)) {
if (filled(T2))
return T2
let has_t1 = filled(T1)