diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-15 14:00:05 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 0659b78aa31e23c8feb6d4ff57a1cd349021b28f (patch) | |
tree | da1bba07a9c82e1336939a1c1e0802a5a20be333 /tools/gendata.js | |
parent | 9b856bb5d402aa5f97e1c9c133dddbc6251e889d (diff) | |
download | table-battles-0659b78aa31e23c8feb6d4ff57a1cd349021b28f.tar.gz |
x
Diffstat (limited to 'tools/gendata.js')
-rw-r--r-- | tools/gendata.js | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/tools/gendata.js b/tools/gendata.js index f471387..4f091b5 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -164,16 +164,17 @@ for (let c of card_records) { result.push(`<div class="dice_area">${c.dice}</div>`) } - function make_action(type, requirement, target, effect) { + function make_action(type, requirement, target, effect, rule_text) { let a = { type } if (requirement) a.requirement = requirement if (target) a.target = target if (effect) a.effect = effect + if (rule_text) a.rule_text = rule_text return a } if (c.action1_type) { - card.actions.push(make_action(c.action1_type, c.action1_req, c.action1_target, c.action1_effect)) + card.actions.push(make_action(c.action1_type, c.action1_req, c.action1_target, c.action1_effect, c.action1_rule_text)) result.push(`<div class="action_row">`) if (/Screen|Absorb|Counterattack/.test(c.action1_type)) result.push(`<div class="action_type reaction">${c.action1_type}</div>`) @@ -181,13 +182,19 @@ for (let c of card_records) { result.push(`<div class="action_type">${c.action1_type}</div>`) result.push(`<div class="action_requirement">${c.action1_req}</div>`) result.push(`<div class="action_target">${c.action1_target}</div>`) - if (c.action1_effect) - result.push(`<div class="action_effect">${c.action1_effect}</div>`) + if (c.action1_effect) { + if (c.action1_rule_text) + result.push(`<div class="action_effect short">${c.action1_effect}</div>`) + else + result.push(`<div class="action_effect">${c.action1_effect}</div>`) + } result.push(`</div>`) + if (c.action1_rule_text) + result.push(`<div class="action_rule">${c.action1_rule_text}</div>`) } if (c.action2_type || c.action2_effect) { - card.actions.push(make_action(c.action2_type, c.action2_req, c.action2_target, c.action2_effect)) + card.actions.push(make_action(c.action2_type, c.action2_req, c.action2_target, c.action2_effect, c.action2_rule_text)) result.push(`<div class="action_row">`) if (/Screen|Absorb|Counterattack/.test(c.action2_type)) result.push(`<div class="action_type reaction">${c.action2_type}</div>`) @@ -195,9 +202,15 @@ for (let c of card_records) { result.push(`<div class="action_type">${c.action2_type}</div>`) result.push(`<div class="action_requirement">${c.action2_req}</div>`) result.push(`<div class="action_target">${c.action2_target}</div>`) - if (c.action2_effect) - result.push(`<div class="action_effect">${c.action2_effect}</div>`) + if (c.action2_effect) { + if (c.action2_rule_text) + result.push(`<div class="action_effect short">${c.action2_effect}</div>`) + else + result.push(`<div class="action_effect">${c.action2_effect}</div>`) + } result.push(`</div>`) + if (c.action2_rule_text) + result.push(`<div class="rule_text">${c.action2_rule_text}</div>`) } if (c.rule) { |