diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-16 03:38:40 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 511f63e26b2d150396d917bef2cfbfc32593e81c (patch) | |
tree | 7775c2bd1c4a95bbe891f3020d83e76fe91bd72e /tools/gendata.js | |
parent | bcac31232a4c4c44d2eec5fcbe514d06f364a681 (diff) | |
download | table-battles-511f63e26b2d150396d917bef2cfbfc32593e81c.tar.gz |
fix counterattack order
Diffstat (limited to 'tools/gendata.js')
-rw-r--r-- | tools/gendata.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/gendata.js b/tools/gendata.js index ff38695..b2405ec 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -327,6 +327,7 @@ function process_card(c, ix) { for (let a of c.actions) { if (a.target) { let tname = a.target.replace(" out of reserve", "") + if (tname === "Any enemy attack" || tname === "Any enemy formation" || tname === "Any enemy attacking it") a.target_list = find_enemy_cards(c.scenario, c.wing) else if (tname === "Any friendly formation") @@ -356,12 +357,21 @@ function process_card(c, ix) { else a.target_list = tname.split(/, | OR | or | and /).map(name => find_card(c.scenario, name)) - // Hothenfriedberg invisible charles last target in list! + // 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 === "Absorb") + + 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 (c.rules) { for (let key in c.rules) { |