summaryrefslogtreecommitdiff
path: root/tools/gendata.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-13 00:35:32 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit4844a32353f470fadc3052113c09c9b2603f9d5c (patch)
treedff95e3936f10101316e6a339f8bdbc1a5c2184f /tools/gendata.js
parent89890d99c1f8b87ebeae1aff08c5be24a28247cb (diff)
downloadtable-battles-4844a32353f470fadc3052113c09c9b2603f9d5c.tar.gz
zero morale. dice ranges.
Diffstat (limited to 'tools/gendata.js')
-rw-r--r--tools/gendata.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index 98e4f20..61d1f2c 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -63,10 +63,15 @@ for (let c of card_records) {
}
else if (c.strength.endsWith("*")) {
card.strength = parseInt(c.strength)
- card.star = 1
+ card.morale = 2
+ }
+ else if (c.strength.endsWith("-")) {
+ card.strength = parseInt(c.strength)
+ card.morale = 0
}
else {
card.strength = parseInt(c.strength)
+ card.morale = 1
}
card.dice = c.dice
@@ -105,7 +110,7 @@ for (let c of card_records) {
}
if (c.dice) {
- if (card.star)
+ if (card.morale === 2)
result.push(`<div class="dice_area">${c.dice}<div class="star">&#x2605;</div></div>`)
else
result.push(`<div class="dice_area">${c.dice}</div>`)
@@ -229,7 +234,7 @@ function find_friendly_cards(scenario, wing) {
w1 = 2, w2 = 3
let list = []
for (let c of cards)
- if (c.scenario === scenario && (c.wing === w1 || c.wing === w1))
+ if (c.scenario === scenario && (c.wing === w1 || c.wing === w2))
list.push(card_index[c.number])
return list
}
@@ -352,8 +357,8 @@ for (let s of scenario_records) {
name: s.name,
date: s.date,
players: [
- { name: s.player1, cards: parse_cards(s.cards1), morale: parseInt(s.morale1), tactical: parseInt(s.tactical1) },
- { name: s.player2, cards: parse_cards(s.cards2), morale: parseInt(s.morale2), tactical: parseInt(s.tactical2) },
+ { name: s.player1, cards: parse_cards(s.cards1), morale: parseInt(s.morale1), tactical: parseInt(s.tactical1) || undefined },
+ { name: s.player2, cards: parse_cards(s.cards2), morale: parseInt(s.morale2), tactical: parseInt(s.tactical2) || undefined },
],
rule: s.rule || undefined,
rule_text: s.rule_text || undefined,