From 91d6d6fbc8243eb544f15e10bd756924e8c720b6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 17 Dec 2023 22:26:28 +0100 Subject: terse effect texts --- tools/gendata.js | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'tools/gendata.js') diff --git a/tools/gendata.js b/tools/gendata.js index 548d9b0..0211a3e 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -20,6 +20,41 @@ var scenarios = [] var a_seq = 0 var b_seq = 0 +/* +var message_map = {} +var msg_old = [] +fs.readFileSync("tools/messages.txt", "utf-8").split("\n").forEach(line => { + line = line.trimEnd() + if (line === "") + return + if (line.startsWith("\t")) { + line = line.trimStart() + for (let old of msg_old) + message_map[old] = line + msg_old = [] + } else { + msg_old.push(line) + } +}) +*/ + +function get_html_effect(effect) { + effect = effect.replace(" If reduced to", "
If reduced to") + effect = effect.replace(" Take dice", "
Take dice") + effect = effect.replace(" (See", "
(See") + return effect +} + +function get_raw_effect(effect) { + effect = effect.replace(/
/, " ") + effect = effect.replace(/ \(See .*/, "") + effect = effect.replace(/ Take dice.*/, "") + effect = effect.replace(/ You CHOOSE the target./, "") + effect = effect.replace(/ Ignores Link./i, "") + effect = effect.replace(/ Warwick retires.*/, "") + return effect +} + function remap(x) { if (x >= 42 && x <= 50) return (x - 42) + 51 if (x >= 51) x += 9 @@ -191,7 +226,8 @@ for (let c of card_records) { let a = { type } if (requirement) a.requirement = requirement if (target) a.target = target - if (effect) a.effect = effect + if (effect) a.effect_text = get_html_effect(effect) + if (effect) a.effect = get_raw_effect(effect) if (rule_text) a.rule_text = rule_text if (short) a.short = 1 return a @@ -208,6 +244,7 @@ for (let c of card_records) { html.push(`
${c.action1_req}
`) html.push(`
${nbsp_target(c.action1_target)}
`) if (c.action1_effect) { + c.action1_effect = get_html_effect(c.action1_effect) if (c.rule_text_1 || squeeze) html.push(`
${c.action1_effect}
`) else @@ -232,6 +269,7 @@ for (let c of card_records) { html.push(`
${c.action2_req}
`) html.push(`
${nbsp_target(c.action2_target)}
`) if (c.action2_effect) { + c.action2_effect = get_html_effect(c.action2_effect) if (c.rule_text_2 || squeeze) html.push(`
${c.action2_effect}
`) else -- cgit v1.2.3