summaryrefslogtreecommitdiff
path: root/tools/gendata.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-10 01:53:39 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:47 +0100
commitcd6d8cfe96128e79400417e10084433a53c0ea37 (patch)
treeb2bd04a02874ff2aeabe2a09d883ec8232f1de68 /tools/gendata.js
parent295d729f92179fd2f402c63451292cdb5e3705e1 (diff)
downloadtable-battles-cd6d8cfe96128e79400417e10084433a53c0ea37.tar.gz
more card data
Diffstat (limited to 'tools/gendata.js')
-rw-r--r--tools/gendata.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index 1bc9099..07f58c0 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -165,6 +165,10 @@ for (let c of card_records) {
card.retire = 1
card.reserve = [ "Ward" ]
}
+ else if (c.reserve === "RETIRE, PURSUIT") {
+ card.retire = 1
+ card.pursuit = 1
+ }
else if (c.reserve === "RETIRE")
card.retire = 1
else if (c.reserve === "PURSUIT")
@@ -176,6 +180,8 @@ for (let c of card_records) {
if (card.retire && card.reserve)
result.push(`<div class="reserve">RETIRE; RESERVE (${card.reserve.join(", ")})</div>`)
+ else if (card.retire && card.pursuit)
+ result.push(`<div class="reserve">RETIRE, PURSUIT)})</div>`)
else if (card.retire)
result.push(`<div class="reserve">RETIRE</div>`)
else if (card.pursuit)
@@ -191,6 +197,8 @@ for (let c of card_records) {
}
function find_card(scenario, name) {
+ name = name.replace("*", "")
+ name = name.replace(" (Voluntary)", "")
for (let c of cards)
if (c.scenario === scenario && (c.name === name || c.alias === name))
return card_index[c.number]
@@ -260,6 +268,8 @@ function process_card(c) {
a.target_list = [ "Retreat to Nivelles" ]
else if (tname === "The Fog Lifts...")
a.target_list = [ "The Fog" ]
+ else if (tname === "See Below")
+ a.target_list = [ ]
else
a.target_list = tname.split(/, | OR | or | and /).map(name => find_card(c.scenario, name))
}
@@ -272,7 +282,8 @@ function process_card(c) {
}
}
if (c.pursuit) {
- if (c.actions[0].type !== "Attack") throw new Error("PURSUIT without Attack as first action")
+ if (c.actions[0].type !== "Attack" && c.actions[0].type !== "Counterattack")
+ throw new Error("PURSUIT without Attack or Counterattack as first action")
if (c.actions[0].target_list.length !== 1) throw new Error("PURSUIT with more than one target!")
c.pursuit = c.actions[0].target_list[0]
}
@@ -290,8 +301,7 @@ for (let c of cards) {
}
}
-if (!failed)
- fs.writeFileSync("info/all-cards.html", result.join("\n"))
+fs.writeFileSync("info/all-cards.html", result.join("\n"))
result = [
`<!doctype html>