From 2d33721655f8b188ff23560079ec872cebcb3325 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 19 Sep 2026 01:20:43 +0200 Subject: [PATCH] Add Show card for cyberpunk consumables --- README.md | 2 ++ TASKS.md | 1 + templates/sheet.css | 10 +++++----- tests/test_build.py | 9 +++++++++ tools/build.py | 11 ++++++++++- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ee9ab02..19c7c63 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ catalogue YAML sont **Physique**, **Intellectuelles**, **Social** et **Arsenal** Les compétences libres et les contacts répétables restent dans **Autres**. Les contacts ont un nom et un niveau, sans caractéristique associée. Leur bouton **Show** affiche ces informations dans le chat sans lancer de dé. +Les consommables d'**Arsenal** ont aussi un bouton **Show** qui affiche leur +nom, leur quantité et leurs notes sans lancer de dé ni modifier la quantité. L'onglet **Combat** cyberpunk contient seulement l'initiative et son jet; les attaques et dégâts des armes sont gérés dans **Arsenal**. La variante base conserve ses champs de combat génériques et ses armes équipées. diff --git a/TASKS.md b/TASKS.md index 549e9f5..b8c2c48 100644 --- a/TASKS.md +++ b/TASKS.md @@ -27,6 +27,7 @@ - [x] Rename the parchment and night theme labels in the cyberpunk selector without changing saved theme IDs. - [x] Prompt for the cyberpunk weapon dice count on each attack instead of storing a fixed value on the weapon. - [x] Count cyberpunk ammo reserve as spare magazines and consume one per reload. +- [x] Add a Show chat card for cyberpunk consumables without changing their quantity. ## Live Roll20 checks after local verification diff --git a/templates/sheet.css b/templates/sheet.css index d77a76a..9ad1885 100644 --- a/templates/sheet.css +++ b/templates/sheet.css @@ -127,14 +127,14 @@ .sheet-d10 .sheet-weapon-actions { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1/-1; } .sheet-d10 .sheet-weapon-actions button[type=action] { min-height: 30px; margin: 0 !important; padding: 3px 9px; color: var(--d10-panel); background: var(--d10-accent); border: 1px solid var(--d10-accent); border-radius: 2px; box-shadow: none; font: bold 11px Arial,sans-serif; text-shadow: none; } .sheet-d10 .sheet-weapon-status { grid-column: 1/-1; min-height: 16px; color: var(--d10-accent); font: 11px Arial,sans-serif; } -.sheet-rolltemplate-d10skillcheck, .sheet-rolltemplate-d10weapon, .sheet-rolltemplate-d10contact { overflow: hidden; color: var(--d10-ink); background: var(--d10-panel); border: 1px solid var(--d10-border); border-left: 4px solid var(--d10-accent); font: 12px Georgia,serif; } -.sheet-rolltemplate-d10skillcheck .sheet-roll-title, .sheet-rolltemplate-d10weapon .sheet-roll-title, .sheet-rolltemplate-d10contact .sheet-roll-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 7px; padding: 7px 9px; border-bottom: 1px solid var(--d10-border); } -.sheet-rolltemplate-d10skillcheck .sheet-roll-title strong, .sheet-rolltemplate-d10weapon .sheet-roll-title strong, .sheet-rolltemplate-d10contact .sheet-roll-title strong { font-size: 14px; } -.sheet-rolltemplate-d10skillcheck .sheet-roll-title span, .sheet-rolltemplate-d10weapon .sheet-roll-title span, .sheet-rolltemplate-d10contact .sheet-roll-title span { opacity: .85; } +.sheet-rolltemplate-d10skillcheck, .sheet-rolltemplate-d10weapon, .sheet-rolltemplate-d10contact, .sheet-rolltemplate-d10consumable { overflow: hidden; color: var(--d10-ink); background: var(--d10-panel); border: 1px solid var(--d10-border); border-left: 4px solid var(--d10-accent); font: 12px Georgia,serif; } +.sheet-rolltemplate-d10skillcheck .sheet-roll-title, .sheet-rolltemplate-d10weapon .sheet-roll-title, .sheet-rolltemplate-d10contact .sheet-roll-title, .sheet-rolltemplate-d10consumable .sheet-roll-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 7px; padding: 7px 9px; border-bottom: 1px solid var(--d10-border); } +.sheet-rolltemplate-d10skillcheck .sheet-roll-title strong, .sheet-rolltemplate-d10weapon .sheet-roll-title strong, .sheet-rolltemplate-d10contact .sheet-roll-title strong, .sheet-rolltemplate-d10consumable .sheet-roll-title strong { font-size: 14px; } +.sheet-rolltemplate-d10skillcheck .sheet-roll-title span, .sheet-rolltemplate-d10weapon .sheet-roll-title span, .sheet-rolltemplate-d10contact .sheet-roll-title span, .sheet-rolltemplate-d10consumable .sheet-roll-title span { opacity: .85; } .sheet-rolltemplate-d10skillcheck .sheet-roll-values, .sheet-rolltemplate-d10weapon .sheet-roll-values { display: grid; grid-template-columns: auto minmax(36px,auto) auto minmax(36px,auto); gap: 6px; align-items: center; justify-content: start; padding: 8px 9px; } .sheet-rolltemplate-d10skillcheck .sheet-roll-value, .sheet-rolltemplate-d10weapon .sheet-roll-value { min-width: 30px; text-align: center; } .sheet-rolltemplate-d10skillcheck .inlinerollresult, .sheet-rolltemplate-d10weapon .inlinerollresult { display: inline-block; min-width: 28px; padding: 2px 5px; color: #20242b !important; background: #ffffff !important; border: 1px solid #68717d !important; border-radius: 3px; font-weight: bold; text-align: center; text-shadow: none !important; } -.sheet-rolltemplate-d10weapon .sheet-roll-detail, .sheet-rolltemplate-d10contact .sheet-roll-detail { padding: 4px 9px; border-top: 1px solid var(--d10-border); } +.sheet-rolltemplate-d10weapon .sheet-roll-detail, .sheet-rolltemplate-d10contact .sheet-roll-detail, .sheet-rolltemplate-d10consumable .sheet-roll-detail { padding: 4px 9px; border-top: 1px solid var(--d10-border); } @media (max-width: 760px) { .sheet-d10 { padding: 9px; } .sheet-d10 .sheet-stat-grid, .sheet-d10 .sheet-resource-grid, .sheet-d10 .sheet-weapon-grid { grid-template-columns: 1fr; } diff --git a/tests/test_build.py b/tests/test_build.py index 4cc82a7..a611cba 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -68,6 +68,15 @@ class BuildTests(unittest.TestCase): self.assertIn('>Show', contacts.group(1)) self.assertIn('&{template:d10contact}', contacts.group(1)) self.assertIn('sheet-rolltemplate-d10contact', files['sheet.html']) + consumables = re.search(r'
(.*?)
', + files['sheet.html'], re.DOTALL) + self.assertIsNotNone(consumables) + self.assertIn('>Show', consumables.group(1)) + self.assertIn('&{template:d10consumable}', consumables.group(1)) + for field in ('name', 'quantity', 'notes'): + self.assertIn(f'@{{{field}}}', consumables.group(1)) + self.assertIn('', files['sheet.html']) + self.assertIn('Quantité : {{quantity}}', files['sheet.html']) self.assertIn('.sheet-d10 .sheet-stat-grid { display: grid;', files['sheet.css']) self.assertIn('.sheet-d10 .sheet-skill-head, .sheet-d10 .sheet-skill-row { display: grid;', files['sheet.css']) self.assertIn('.sheet-d10 .sheet-body-maps { display: grid; grid-template-columns: repeat(2,minmax(0,1fr));', files['sheet.css']) diff --git a/tools/build.py b/tools/build.py index 3565b87..685a141 100644 --- a/tools/build.py +++ b/tools/build.py @@ -228,6 +228,9 @@ def render_repeating_block(block, attributes, expanded=False): if block['id'] == 'contacts-skills': command = '&{template:d10contact} {{name=@{skillname}}} {{level=@{skilllevel}}}' parts.append(f'') + elif block['id'] == 'consommable': + command = '&{template:d10consumable} {{name=@{name}}} {{quantity=@{quantity}}} {{notes=@{notes}}}' + parts.append(f'') elif 'skilllevel' in block['fields']: options = ''.join( f'' @@ -402,7 +405,7 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='') if switchable: parts.append('') html_text = '\n'.join(parts) + '\n' - css = ('.sheet-d10, .sheet-rolltemplate-d10skillcheck, .sheet-rolltemplate-d10weapon, .sheet-rolltemplate-d10contact {\n' + '\n'.join( + css = ('.sheet-d10, .sheet-rolltemplate-d10skillcheck, .sheet-rolltemplate-d10weapon, .sheet-rolltemplate-d10contact, .sheet-rolltemplate-d10consumable {\n' + '\n'.join( f' --d10-{key}: {theme[key]};' for key in ('background', 'panel', 'ink', 'accent', 'border')) + f'\n --d10-figure-filter: {figure_filter(theme["background"])};\n}}\n') css += (ROOT / 'templates' / 'sheet.css').read_text(encoding='utf-8') @@ -438,6 +441,12 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
Contact{{name}}
Niveau : {{level}}
+''' + html_text += ''' +
Consommable{{name}}
+
Quantité : {{quantity}}
+{{#notes}}
{{notes}}
{{/notes}} +
''' html_text += '''
{{name}}{{mode}}