diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gendata.js | 10 |
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")) |