summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-16 16:54:20 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit02da527ebfd7455706e0adf79f1ee1a0ec699e1f (patch)
treeb70704cc21c5a2956e0726cb536e14a43570d1c7 /tools
parentaf6aa3ec9445ddf8cfeebd0810c6f123c4a11b2a (diff)
downloadtable-battles-02da527ebfd7455706e0adf79f1ee1a0ec699e1f.tar.gz
Strict order for Absorb with ","
Diffstat (limited to 'tools')
-rw-r--r--tools/gendata.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index 1740f70..0a8ab7c 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -356,23 +356,22 @@ function process_card(c, ix) {
a.target_list = null
else
a.target_list = tname.split(/, | OR | or | and /).map(name => find_card(c.scenario, name))
-
- // Hohenfriedberg invisible charles last target in list!
- if (c.number === "267A" || c.number === "268A" || c.number === "269A")
- a.target_list.push(find_card(c.scenario, "Charles"))
- }
-
- if (a.type === "Counterattack") {
- if (/, /.test(a.target))
- a.choice = 0
- else
- a.choice = 1
}
if (a.type === "Absorb") {
a.target_list = a.target_list.filter(x => x !== ix) // never absorb for self
}
+
+ if (/, /.test(a.target) || !a.target_list || a.target_list.length < 2)
+ a.choice = 0
+ else
+ a.choice = 1
}
+
+ // Hohenfriedberg invisible charles last target in list!
+ if (c.number === "267A" || c.number === "268A" || c.number === "269A")
+ c.actions[0].target_list.push(find_card(c.scenario, "Charles"))
+
if (c.rules) {
for (let key in c.rules) {
let val = c.rules[key]