Move cyberpunk arsenal into combat tab
This commit is contained in:
parent
9a436f9456
commit
7ce392e034
|
|
@ -46,14 +46,17 @@ Dans Compétences, quatre sous-onglets séparent **Combat et combat libre**,
|
|||
**Compétences libres**, **Magie** et **Équipement**. Les lignes répétables
|
||||
gardent leurs noms d'attributs et de section. La variante cyberpunk conserve
|
||||
les onglets **Compétences**, **Combat** et **Autres**. Ses sous-onglets issus du
|
||||
catalogue YAML sont **Physique**, **Intellectuelles**, **Social** et **Arsenal**.
|
||||
catalogue YAML sont **Physique**, **Intellectuelles** et **Social**.
|
||||
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
|
||||
les attaques et dégâts des armes sont gérés dans **Arsenal**, sous **Combat**.
|
||||
Les personnages qui avaient sélectionné l'ancien onglet de compétences
|
||||
**Arsenal** voient **Physique** lors du prochain affichage des compétences.
|
||||
La variante base
|
||||
conserve ses champs de combat génériques et ses armes équipées.
|
||||
Le choix principal est stocké dans `d10_tab`, celui des sous-onglets base dans
|
||||
`d10_skill_tab` et celui des catégories cyberpunk dans `d10_category_tab`.
|
||||
|
|
|
|||
1
TASKS.md
1
TASKS.md
|
|
@ -29,6 +29,7 @@
|
|||
- [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.
|
||||
- [x] Add a root build script for all publishable variants with an optional clean rebuild.
|
||||
- [x] Move cyberpunk Arsenal from Skills into Combat while preserving its subtabs and repeating sections.
|
||||
|
||||
## Live Roll20 checks after local verification
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
.sheet-d10 .sheet-tab-state[value="other"] ~ .sheet-tab-nav .sheet-tab-other { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }
|
||||
.sheet-d10.sheet-variant-base .sheet-tab-state[value="other"] ~ .sheet-tab-nav .sheet-tab-skills { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }
|
||||
.sheet-d10 .sheet-skill-tab-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; margin: 2px 0 12px; }
|
||||
.sheet-d10 .sheet-category-tab-nav { grid-template-columns: repeat(4,minmax(0,1fr)); }
|
||||
.sheet-d10 .sheet-category-tab-nav { grid-template-columns: repeat(3,minmax(0,1fr)); }
|
||||
.sheet-d10 .sheet-arsenal-tab-nav { grid-template-columns: repeat(3,minmax(0,1fr)); }
|
||||
.sheet-d10 .sheet-skill-tab-nav button[type=action] { min-height: 37px; margin: 0 !important; padding: 6px 4px; color: var(--d10-accent); background: var(--d10-background); border: 1px solid var(--d10-border); border-radius: 3px; box-shadow: none; font: bold 11px Georgia,serif; text-shadow: none; }
|
||||
.sheet-d10 .sheet-skill-tab-nav button[type=action]:hover, .sheet-d10 .sheet-skill-tab-nav button[type=action]:focus { background: var(--d10-panel); outline: 2px solid var(--d10-border); outline-offset: -2px; }
|
||||
|
|
|
|||
|
|
@ -48,10 +48,16 @@ class BuildTests(unittest.TestCase):
|
|||
markup.index(f'class="repeating_{section}"'))
|
||||
self.assertEqual(markup.count(f'class="repeating_{section}"'), 1)
|
||||
else:
|
||||
self.assertEqual(files['sheet.html'].count('class="sheet-skill-pane sheet-category-pane-'), 4)
|
||||
self.assertEqual(files['sheet.html'].count('class="sheet-skill-pane sheet-category-pane-'), 3)
|
||||
self.assertIn('name="attr_d10_category_tab" value="physique"', files['sheet.html'])
|
||||
for tab in ('physique', 'intellectuelles', 'social', 'arsenal'):
|
||||
for tab in ('physique', 'intellectuelles', 'social'):
|
||||
self.assertIn(f'.sheet-category-tab-state[value="{tab}"] ~ .sheet-category-pane-{tab}', files['sheet.css'])
|
||||
self.assertNotIn('name="act_category_tab_arsenal"', files['sheet.html'])
|
||||
combat_page = files['sheet.html'].split('class="sheet-page sheet-page-combat"', 1)[1].split('class="sheet-page sheet-page-skills"', 1)[0]
|
||||
self.assertIn('name="attr_d10_arsenal_tab"', combat_page)
|
||||
self.assertIn('class="repeating_distance"', combat_page)
|
||||
self.assertIn('class="repeating_melee"', combat_page)
|
||||
self.assertIn('class="repeating_consommable"', combat_page)
|
||||
for section in ('distance', 'melee', 'consommable'):
|
||||
self.assertIn(f'name="act_arsenal_tab_{section}"', files['sheet.html'])
|
||||
self.assertEqual(files['sheet.html'].count(f'class="repeating_{section}"'), 1)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const buildRoot = process.env.D10_BUILD_ROOT ?? 'build';
|
|||
for (const variant of ['base', 'cyberpunk']) {
|
||||
const tabs = variant === 'base' ? ['skills', 'combat'] : ['skills', 'combat', 'other'];
|
||||
const skillTabs = variant === 'base' ? ['fight', 'free', 'magic', 'equipment'] : [];
|
||||
const categoryTabs = variant === 'cyberpunk' ? ['physique', 'intellectuelles', 'social', 'arsenal'] : [];
|
||||
const categoryTabs = variant === 'cyberpunk' ? ['physique', 'intellectuelles', 'social'] : [];
|
||||
const arsenalTabs = variant === 'cyberpunk' ? ['distance', 'melee', 'consommable'] : [];
|
||||
const html = readFileSync(`${buildRoot}/${variant}/parchment/sheet.html`, 'utf8');
|
||||
const script = html.match(/<script type="text\/worker">\s*([\s\S]*?)<\/script>/)?.[1];
|
||||
|
|
@ -59,7 +59,11 @@ for (const variant of ['base', 'cyberpunk']) {
|
|||
}
|
||||
if (variant === 'base') assert.match(html, /name="attr_d10_skill_tab" value="fight"/);
|
||||
if (variant === 'cyberpunk') assert.ok(!handlers.has('clicked:skill_tab_fight'));
|
||||
if (variant === 'cyberpunk') assert.match(html, /name="attr_d10_category_tab" value="physique"/);
|
||||
if (variant === 'cyberpunk') {
|
||||
assert.match(html, /name="attr_d10_category_tab" value="physique"/);
|
||||
assert.ok(!handlers.has('clicked:category_tab_arsenal'));
|
||||
assert.match(html, /class="sheet-page sheet-page-combat"[\s\S]*name="attr_d10_arsenal_tab"[\s\S]*class="sheet-page sheet-page-skills"/);
|
||||
}
|
||||
if (variant === 'cyberpunk') {
|
||||
assert.match(html, /name="attr_d10_theme_choice"/);
|
||||
assert.match(html, /name="attr_d10_theme" value="parchment"/);
|
||||
|
|
|
|||
|
|
@ -344,6 +344,24 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
|
|||
f'<input type="text" name="attr_general_item_weapon{number}_name" title="Nom">'
|
||||
f'<input type="number" name="attr_general_item_weapon{number}" value="0" title="Dégâts">'
|
||||
f'<input type="checkbox" name="attr_item_weapon{number}_activation" value="1" title="Équipée"></div>')
|
||||
else:
|
||||
equipment = [group for section in skills['sections'] for group in section['groups']
|
||||
if group.get('equipment')]
|
||||
repeating = {block['id']: block for block in model['repeating']}
|
||||
weapon_skills = combat_skills(skills)
|
||||
parts.append('</div><h3 class="sheet-subheading">Arsenal</h3><div class="sheet-arsenal">')
|
||||
parts.append('<input type="hidden" class="sheet-arsenal-tab-state" name="attr_d10_arsenal_tab" value="distance">')
|
||||
parts.append('<nav class="sheet-skill-tab-nav sheet-arsenal-tab-nav" aria-label="Catégories d’arsenal">')
|
||||
for group in equipment:
|
||||
key = group['equipment']
|
||||
parts.append(f'<button type="action" class="sheet-arsenal-tab-{key}" name="act_arsenal_tab_{key}">{esc(group["name"])}</button>')
|
||||
parts.append('</nav>')
|
||||
for group in equipment:
|
||||
key = group['equipment']
|
||||
parts.append(f'<div class="sheet-skill-pane sheet-arsenal-pane-{key}">')
|
||||
parts.append(render_weapon_block(repeating[key], weapon_skills) if key in ('distance', 'melee')
|
||||
else render_repeating_block(repeating[key], model['attributes'], expanded=True))
|
||||
parts.append('</div>')
|
||||
parts.append('</div></section></div><div class="sheet-page sheet-page-skills"><section class="sheet-panel"><div class="sheet-section-title"><span>04</span><h2>Compétences</h2></div>')
|
||||
if model.get('skill_tabs'):
|
||||
skill_tabs = model['skill_tabs']
|
||||
|
|
@ -361,7 +379,7 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
|
|||
parts.append('</div>')
|
||||
elif model.get('skill_category_tabs'):
|
||||
categories = [section for section in skills['sections']
|
||||
if any(group.get('skills') or group.get('equipment') for group in section['groups'])]
|
||||
if any(group.get('skills') for group in section['groups'])]
|
||||
parts.append(f'<input type="hidden" class="sheet-category-tab-state" name="attr_d10_category_tab" value="{esc(categories[0]["id"])}">')
|
||||
parts.append('<nav class="sheet-skill-tab-nav sheet-category-tab-nav" aria-label="Catégories de compétences">')
|
||||
for section in categories:
|
||||
|
|
@ -370,24 +388,7 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
|
|||
parts.append('</nav>')
|
||||
for section in categories:
|
||||
parts.append(f'<div class="sheet-skill-pane sheet-category-pane-{section["id"]}">')
|
||||
equipment = [group for group in section['groups'] if group.get('equipment')]
|
||||
if equipment:
|
||||
parts.append('<input type="hidden" class="sheet-arsenal-tab-state" name="attr_d10_arsenal_tab" value="distance">')
|
||||
parts.append('<nav class="sheet-skill-tab-nav sheet-arsenal-tab-nav" aria-label="Catégories d’arsenal">')
|
||||
for group in equipment:
|
||||
key = group['equipment']
|
||||
parts.append(f'<button type="action" class="sheet-arsenal-tab-{key}" name="act_arsenal_tab_{key}">{esc(group["name"])}</button>')
|
||||
parts.append('</nav>')
|
||||
weapon_skills = combat_skills(skills)
|
||||
repeating = {block['id']: block for block in model['repeating']}
|
||||
for group in equipment:
|
||||
key = group['equipment']
|
||||
parts.append(f'<div class="sheet-skill-pane sheet-arsenal-pane-{key}">')
|
||||
parts.append(render_weapon_block(repeating[key], weapon_skills) if key in ('distance', 'melee')
|
||||
else render_repeating_block(repeating[key], model['attributes'], expanded=True))
|
||||
parts.append('</div>')
|
||||
else:
|
||||
parts.append(render_fixed_skills(skills, variant, show_sections=False, sections=[section]))
|
||||
parts.append(render_fixed_skills(skills, variant, show_sections=False, sections=[section]))
|
||||
parts.append('</div>')
|
||||
else:
|
||||
parts.append(render_fixed_skills(skills, variant))
|
||||
|
|
@ -424,7 +425,9 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
|
|||
css += '\n'.join(
|
||||
f'.sheet-d10 .sheet-category-tab-state[value="{section["id"]}"] ~ .sheet-category-pane-{section["id"]} {{ display: block; }}\n'
|
||||
f'.sheet-d10 .sheet-category-tab-state[value="{section["id"]}"] ~ .sheet-category-tab-nav .sheet-category-tab-{section["id"]} {{ color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }}\n'
|
||||
for section in skills['sections'] if any(group.get('skills') or group.get('equipment') for group in section['groups']))
|
||||
for section in skills['sections'] if any(group.get('skills') for group in section['groups']))
|
||||
css += ('.sheet-d10 .sheet-category-tab-state[value="arsenal"] ~ .sheet-category-pane-physique { display: block; }\n'
|
||||
'.sheet-d10 .sheet-category-tab-state[value="arsenal"] ~ .sheet-category-tab-nav .sheet-category-tab-physique { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }\n')
|
||||
arsenal = [group['equipment'] for section in skills['sections'] for group in section['groups']
|
||||
if group.get('equipment')]
|
||||
css += '\n'.join(
|
||||
|
|
@ -467,7 +470,7 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
|
|||
if model.get('skill_category_tabs'):
|
||||
html_text += ''.join(
|
||||
f'on("clicked:category_tab_{section["id"]}", function () {{ setAttrs({{d10_category_tab: "{section["id"]}"}}); }});\n'
|
||||
for section in skills['sections'] if any(group.get('skills') or group.get('equipment') for group in section['groups']))
|
||||
for section in skills['sections'] if any(group.get('skills') for group in section['groups']))
|
||||
html_text += ''.join(
|
||||
f'on("clicked:arsenal_tab_{key}", function () {{ setAttrs({{d10_arsenal_tab: "{key}"}}); }});\n'
|
||||
for key in arsenal)
|
||||
|
|
|
|||
Loading…
Reference in New Issue