diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-17 22:26:28 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 91d6d6fbc8243eb544f15e10bd756924e8c720b6 (patch) | |
tree | 570fdd420b27e96158256b17bd6040bdfe7b3f56 /tools/gendata.js | |
parent | 07ad3d0deaf49aaa8655ead84f96046f0b3bdb6f (diff) | |
download | table-battles-91d6d6fbc8243eb544f15e10bd756924e8c720b6.tar.gz |
terse effect texts
Diffstat (limited to 'tools/gendata.js')
-rw-r--r-- | tools/gendata.js | 40 |
1 files changed, 39 insertions, 1 deletions
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", "<br>If reduced to") + effect = effect.replace(" Take dice", "<br>Take dice") + effect = effect.replace(" (See", "<br>(See") + return effect +} + +function get_raw_effect(effect) { + effect = effect.replace(/<br>/, " ") + 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(`<div class="action_requirement">${c.action1_req}</div>`) html.push(`<div class="action_target">${nbsp_target(c.action1_target)}</div>`) if (c.action1_effect) { + c.action1_effect = get_html_effect(c.action1_effect) if (c.rule_text_1 || squeeze) html.push(`<div class="action_effect short">${c.action1_effect}</div>`) else @@ -232,6 +269,7 @@ for (let c of card_records) { html.push(`<div class="action_requirement">${c.action2_req}</div>`) html.push(`<div class="action_target">${nbsp_target(c.action2_target)}</div>`) if (c.action2_effect) { + c.action2_effect = get_html_effect(c.action2_effect) if (c.rule_text_2 || squeeze) html.push(`<div class="action_effect short">${c.action2_effect}</div>`) else |