summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-13 21:27:04 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commiteaf0fc7b430ed0587fd02ccd91c6952daf6a4faf (patch)
tree7521f028b1bf8e2480c8df7b68b7d6d6a24a5cb2 /tools
parent58d9092f805c1e3563a11fc82606d8d0e50b17fe (diff)
downloadtable-battles-eaf0fc7b430ed0587fd02ccd91c6952daf6a4faf.tar.gz
Only Absorb for others.
Diffstat (limited to 'tools')
-rw-r--r--tools/gendata.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index c4f6efb..1e73c07 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -254,7 +254,7 @@ function find_wing_cards(scenario, wing) {
}
/* process action and reserve targets */
-function process_card(c) {
+function process_card(c, ix) {
for (let a of c.actions) {
if (a.target) {
let tname = a.target.replace(" out of reserve", "")
@@ -287,6 +287,8 @@ function process_card(c) {
else
a.target_list = tname.split(/, | OR | or | and /).map(name => find_card(c.scenario, name))
}
+ if (a.type === "Absorb")
+ a.target_list = a.target_list.filter(x => x !== ix) // never absorb for self
}
if (c.rules) {
for (let key in c.rules) {
@@ -307,14 +309,14 @@ function process_card(c) {
}
let failed = false
-for (let c of cards) {
+cards.forEach((c, ix) => {
try {
- process_card(c)
+ process_card(c, ix)
} catch (err) {
console.log(err)
failed = true
}
-}
+})
fs.writeFileSync("info/all-cards.html", result.join("\n"))