From eaf0fc7b430ed0587fd02ccd91c6952daf6a4faf Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 13 Dec 2023 21:27:04 +0100 Subject: Only Absorb for others. --- tools/gendata.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tools') 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")) -- cgit v1.2.3