From 4844a32353f470fadc3052113c09c9b2603f9d5c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 13 Dec 2023 00:35:32 +0100 Subject: zero morale. dice ranges. --- tools/gendata.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tools') 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(`
${c.dice}
`) else result.push(`
${c.dice}
`) @@ -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, -- cgit v1.2.3